host_collection_view_controller.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef REMOTING_IOS_APP_HOST_COLLECTION_VIEW_CONTROLLER_H_
  5. #define REMOTING_IOS_APP_HOST_COLLECTION_VIEW_CONTROLLER_H_
  6. #import <UIKit/UIKit.h>
  7. #import <MaterialComponents/MaterialCollections.h>
  8. #import "remoting/ios/app/host_collection_view_cell.h"
  9. #import "remoting/ios/domain/host_info.h"
  10. // The host collection view controller delegate provides the data for available
  11. // hosts and receives selection events from the collection view controller.
  12. @protocol HostCollectionViewControllerDelegate<NSObject>
  13. // Notifies the delegate if a selection happens for the provided cell.
  14. // The delegate should run the completionBlock when processing for this event
  15. // has finished.
  16. @optional
  17. - (void)didSelectCell:(HostCollectionViewCell*)cell
  18. completion:(void (^)())completionBlock;
  19. // The delegate should provide the HostInfo object for the given path if
  20. // available from the cache.
  21. - (HostInfo*)getHostAtIndexPath:(NSIndexPath*)path;
  22. // The delegate must provide the total number of hosts currently cached.
  23. - (NSInteger)getHostCount;
  24. @end
  25. @interface HostCollectionViewController : MDCCollectionViewController
  26. @property(weak, nonatomic) id<HostCollectionViewControllerDelegate> delegate;
  27. @property(weak, nonatomic) id<UIScrollViewDelegate> scrollViewDelegate;
  28. @end
  29. #endif // REMOTING_IOS_APP_HOST_COLLECTION_VIEW_CONTROLLER_H_