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

Side by Side Diff: ios/chrome/browser/ui/contextual_search/contextual_search_panel_protocols.h

Issue 2588713002: Upstream Chrome on iOS source code [4/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 2016 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_CONTEXTUAL_SEARCH_CONTEXTUAL_SEARCH_PANEL_PROTOCOL S_H_
6 #define IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_CONTEXTUAL_SEARCH_PANEL_PROTOCOL S_H_
7
8 #import <UIKit/UIKit.h>
9
10 #import "ios/chrome/browser/ui/contextual_search/panel_configuration.h"
11
12 namespace ContextualSearch {
13
14 typedef struct {
15 PanelState state; // state when the panel started moving, or current state if
16 // static.
17 PanelState nextState; // state panel is moving towards.
18 CGFloat position; // y-origin of top of panel in superview.
19 CGFloat gradation; // fractional progress to next state.
20 } PanelMotion;
21 }
22
23 @class ContextualSearchPanelView;
24
25 @protocol ContextualSearchPanelMotionObserver<NSObject>
26 @optional
27
28 // Called repeatedly as |panel| is moved. If |panel| is being animated,
29 // it will be called once from inside the animation block (so any view changes
30 // the observers make will also be animated).
31 // Use this call to handle any updates that must be made continuously as
32 // |panel| moves.
33 - (void)panel:(ContextualSearchPanelView*)panel
34 didMoveWithMotion:(ContextualSearch::PanelMotion)motion;
35
36 // Called when a source of motion stops |panel| from moving. If |panel| was
37 // animated, this is called as part of the animation completion.
38 - (void)panel:(ContextualSearchPanelView*)panel
39 didStopMovingWithMotion:(ContextualSearch::PanelMotion)motion;
40
41 // Called when |panel| has stopped moving and has changed state. If |panel|
42 // is animating to the new state, this is called *outside* of the animation
43 // block.
44 // |toState| will never be the same as |fromState|.
45 - (void)panel:(ContextualSearchPanelView*)panel
46 didChangeToState:(ContextualSearch::PanelState)toState
47 fromState:(ContextualSearch::PanelState)fromState;
48
49 // Called before |panel| will be used to animate a transition into a new tab.
50 // Observers who don't want to be notified of further panel motion activity
51 // should remove thmeselves at this point.
52 - (void)panelWillPromote:(ContextualSearchPanelView*)panel;
53
54 // Called as |panel| is animating into the position used for a new tab.
55 // Observers who need to make animated changes for this transition should do
56 // that in this method. |panel| will be destroyed shortly after this call is
57 // made; observers should expect no further calls after this.
58 - (void)panelIsPromoting:(ContextualSearchPanelView*)panel;
59
60 @end
61
62 // Protocol for a subview of a panel that has scrolling behavior that needs to
63 // interoperate with the panel's drag behavior.
64 @protocol ContextualSearchPanelScrollSynchronizer
65 // YES if the receiver has scrolled (e.g., its scroll offset is not {0,0}).
66 @property(nonatomic, readonly) BOOL scrolled;
67 // Gesture recognizer used by the receiver to detect scrolling.
68 @property(nonatomic, readonly) UIGestureRecognizer* scrollRecognizer;
69
70 @end
71
72 // Protocol for a an object that panel subview can forward panel-affecting
73 // events to.
74 @protocol ContextualSearchPanelTapHandler
75 // A panel subview was tapped with |gesture|; suitable for a gestrure
76 // recognizer's action method.
77 - (void)panelWasTapped:(UIGestureRecognizer*)gesture;
78 // A subview wants the panel to close.
79 - (void)closePanel;
80 @end
81
82 #endif // IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_CONTEXTUAL_SEARCH_PANEL_PROTO COLS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698