Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(868)

Side by Side Diff: ios/chrome/browser/ui/side_swipe/side_swipe_controller.h

Issue 2587023002: Upstream Chrome on iOS source code [8/11]. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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
5 #ifndef IOS_CHROME_BROWSER_UI_SIDE_SWIPE_SIDE_SWIPE_CONTROLLER_H_
6 #define IOS_CHROME_BROWSER_UI_SIDE_SWIPE_SIDE_SWIPE_CONTROLLER_H_
7
8 #import <UIKit/UIKit.h>
9
10 #include "ios/chrome/browser/infobars/infobar_container_ios.h"
11 #import "ios/chrome/browser/tabs/tab_model.h"
12 #import "ios/chrome/browser/tabs/tab_snapshotting_delegate.h"
13 #import "ios/chrome/browser/ui/tabs/tab_strip_controller.h"
14 #import "ios/chrome/browser/ui/toolbar/web_toolbar_controller.h"
15 #import "ios/web/web_state/ui/crw_swipe_recognizer_provider.h"
16
17 @class CardSideSwipeView;
18 @class SideSwipeGestureRecognizer;
19
20 namespace ios_internal {
21 // Notification sent when the user starts a side swipe (on tablet).
22 extern NSString* const kSideSwipeWillStartNotification;
23 // Notification sent when the user finishes a side swipe (on tablet).
24 extern NSString* const kSideSwipeDidStopNotification;
25 } // namespace ios_internal
26
27 // A protocol for the Side Swipe controller sources.
28 @protocol SideSwipeContentProvider
29 // Returns whether this source can provide content for a back/forward side swipe
30 // gesture.
31 - (BOOL)canGoBack;
32 - (BOOL)canGoForward;
33
34 // Called on completion of a back/forward gesture.
35 - (void)goBack:(web::WebState*)webState;
36 - (void)goForward:(web::WebState*)webState;
37
38 // The icon to display in the side panel.
39 - (UIImage*)paneIcon;
40
41 // Whether the icon is oriented and should be reflected on forward pane.
42 - (BOOL)rotateForwardIcon;
43 @end
44
45 @protocol SideSwipeControllerDelegate
46 @required
47 // Called when the horizontal stack view is done and should be removed.
48 - (void)sideSwipeViewDismissAnimationDidEnd:(UIView*)sideSwipeView;
49 // Returns the main content view.
50 - (UIView*)contentView;
51 // Returns the toolbar controller.
52 - (WebToolbarController*)toolbarController;
53 // Returns the tabstrip controller.
54 - (TabStripController*)tabStripController;
55 // Makes |tab| the currently visible tab, displaying its view. Calls
56 // -selectedTabChanged on the toolbar only if |newSelection| is YES.
57 - (void)displayTab:(Tab*)tab isNewSelection:(BOOL)newSelection;
58 // Check the invariant of "toolbar in front of infobar container which
59 // is in front of content area." This DCHECK happens if addSubview and/or
60 // insertSubview messed up the view ordering earlier.
61 - (BOOL)verifyToolbarViewPlacementInView:(UIView*)views;
62 // Controls the visibility of views such as the findbar, infobar and voice
63 // search bar.
64 - (void)updateAccessoryViewsForSideSwipeWithVisibility:(BOOL)visible;
65 // Returns the height of the header view for the tab model's current tab.
66 - (CGFloat)headerHeight;
67 // Returns |YES| if side swipe should be blocked from initiating, such as when
68 // voice search is up, or if the tools menu is enabled.
69 - (BOOL)preventSideSwipe;
70 @end
71
72 // Controls how an edge gesture is processed, either as tab change or a page
73 // change. For tab changes two full screen CardSideSwipeView views are dragged
74 // across the screen. For page changes the SideSwipeControllerDelegate
75 // |contentView| is moved across the screen and a SideSwipeNavigationView is
76 // shown in the remaining space.
77 @interface SideSwipeController
78 : NSObject<CRWSwipeRecognizerProvider, UIGestureRecognizerDelegate>
79
80 @property(nonatomic, assign) BOOL inSwipe;
81 @property(nonatomic, assign) id<SideSwipeControllerDelegate> swipeDelegate;
82 @property(nonatomic, assign) id<TabSnapshottingDelegate> snapshotDelegate;
83
84 // Initializer.
85 - (id)initWithTabModel:(TabModel*)model
86 browserState:(ios::ChromeBrowserState*)browserState;
87
88 // Set up swipe gesture recognizers.
89 - (void)addHorizontalGesturesToView:(UIView*)view;
90
91 // Returns set of UIGestureRecognizer objects.
92 - (NSSet*)swipeRecognizers;
93
94 // Enable or disable the side swipe gesture recognizer.
95 - (void)setEnabled:(BOOL)enabled;
96
97 // Returns |NO| if the device should not rotate.
98 - (BOOL)shouldAutorotate;
99
100 @end
101
102 #endif // IOS_CHROME_BROWSER_UI_SIDE_SWIPE_SIDE_SWIPE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698