Index: ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_controller.h |
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_controller.h b/ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_controller.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..402f74c6ca8a784c36281bfc1ef9c35f56cfb71e |
--- /dev/null |
+++ b/ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_controller.h |
@@ -0,0 +1,101 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_SWITCHER_PANEL_CONTROLLER_H_ |
+#define IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_SWITCHER_PANEL_CONTROLLER_H_ |
+ |
+#import <UIKit/UIKit.h> |
+ |
+#include "base/ios/block_types.h" |
+#import "ios/chrome/browser/ui/tab_switcher/tab_switcher_model.h" |
+#import "ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_cell.h" |
+ |
+namespace ios { |
+class ChromeBrowserState; |
+} |
+ |
+@class TabSwitcherLocalSessionCell; |
+@class TabSwitcherPanelController; |
+ |
+@protocol TabSwitcherPanelControllerDelegate<NSObject> |
+ |
+// Called when the user selects the cell representing the distant tab |tab|. |
+- (void)tabSwitcherPanelController: |
+ (TabSwitcherPanelController*)tabSwitcherPanelController |
+ didSelectDistantTab:(synced_sessions::DistantTab*)tab; |
+ |
+// Called when the user selects the cell representing the local tab |tab|. |
+- (void)tabSwitcherPanelController: |
+ (TabSwitcherPanelController*)tabSwitcherPanelController |
+ didSelectLocalTab:(Tab*)tab; |
+ |
+// Called when the user pressed the close button on the cell representing the |
+// local tab |tab|. |
+- (void)tabSwitcherPanelController: |
+ (TabSwitcherPanelController*)tabSwitcherPanelController |
+ didCloseLocalTab:(Tab*)tab; |
+ |
+// Called when the overlay view visibility changed. |
+- (void)tabSwitcherPanelControllerDidUpdateOverlayViewVisibility: |
+ (TabSwitcherPanelController*)tabSwitcherPanelController; |
+ |
+@end |
+ |
+@class TabSwitcherPanelView; |
+// The tab switcher panel controller manages a panel view. |
+// It can manage either distant or local sessions and uses a TabSwitcherModel |
+// as its data source. |
+@class TabSwitcherCache; |
+ |
+@interface TabSwitcherPanelController : NSObject |
+ |
+@property(nonatomic, readonly) TabSwitcherPanelView* view; |
+@property(nonatomic, assign) id<TabSwitcherPanelControllerDelegate> delegate; |
+@property(nonatomic, readonly) ios_internal::SessionType sessionType; |
+ |
+// Initializes a controller for a view showing local tabs. |offTheRecord| |
+// determines whether the tabs will be shown for the incognito browser state or |
+// not. |model| is used to populate the view and must not be nil. |
+- (instancetype)initWithModel:(TabSwitcherModel*)model |
+ forLocalSessionOfType:(ios_internal::SessionType)type |
+ withCache:(TabSwitcherCache*)cache |
+ browserState:(ios::ChromeBrowserState*)browserState; |
+ |
+// Initializes a controller for a view showing the tabs of a distant session. |
+// |model| is used to populate the view and must not be nil. |
+- (instancetype)initWithModel:(TabSwitcherModel*)model |
+ forDistantSessionWithTag:(std::string const&)sessionTag |
+ browserState:(ios::ChromeBrowserState*)browserState; |
+ |
+// Tells the controller that the collectionview's content may need to be |
+// updated. |
+- (void)updateCollectionViewIfNeeded; |
+ |
+// Returns the tag of the distant session. |
+- (std::string)sessionTag; |
+ |
+// Returns true if the new tab button should be shown. |
+- (BOOL)shouldShowNewTabButton; |
+ |
+// Scrolls the collection view so that the tab cell at the given index is |
+// visible. |
+- (void)scrollTabIndexToVisible:(NSInteger)index triggerLayout:(BOOL)layout; |
+ |
+// Returns the cell for the tab at the given index. |
+// This methods should only be used for animation purpose. |
+- (TabSwitcherLocalSessionCell*)localSessionCellForTabAtIndex:(NSInteger)index; |
+ |
+- (CGRect)localSessionCellFrameForTabAtIndex:(NSInteger)index; |
+ |
+// Reloads cells. |
+- (void)reload; |
+ |
+- (UICollectionView*)collectionView; |
+ |
+// Returns the distantSession owned and displayed by this controller. |
+- (const synced_sessions::DistantSession*)distantSession; |
+ |
+@end |
+ |
+#endif // IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_SWITCHER_PANEL_CONTROLLER_H_ |