| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_CONTEXTUAL_SEARCH_CONTROLLER_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_CONTEXTUAL_SEARCH_CONTROLLER_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_CONTEXTUAL_SEARCH_CONTROLLER_H_ | 6 #define IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_CONTEXTUAL_SEARCH_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
| 9 | 9 |
| 10 #include "base/ios/block_types.h" | 10 #include "base/ios/block_types.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "ios/chrome/browser/ui/contextual_search/panel_configuration.h" | 12 #include "ios/chrome/browser/ui/contextual_search/panel_configuration.h" |
| 13 | 13 |
| 14 namespace ios { | 14 namespace ios { |
| 15 class ChromeBrowserState; | 15 class ChromeBrowserState; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace web { | 18 namespace web { |
| 19 class WebState; | 19 class WebState; |
| 20 } | 20 } |
| 21 | 21 |
| 22 class GURL; | 22 class GURL; |
| 23 @class Tab; | 23 @class Tab; |
| 24 @class TouchToSearchPermissionsMediator; | 24 @class TouchToSearchPermissionsMediator; |
| 25 struct WebStateOpener; |
| 25 | 26 |
| 26 namespace ContextualSearch { | 27 namespace ContextualSearch { |
| 27 // Possible reason for panel state changes. | 28 // Possible reason for panel state changes. |
| 28 enum StateChangeReason { | 29 enum StateChangeReason { |
| 29 UNKNOWN, | 30 UNKNOWN, |
| 30 RESET, | 31 RESET, |
| 31 BACK_PRESS, // This is Android-only; we should never use this value. | 32 BACK_PRESS, // This is Android-only; we should never use this value. |
| 32 TEXT_SELECT_TAP, | 33 TEXT_SELECT_TAP, |
| 33 TEXT_SELECT_LONG_PRESS, | 34 TEXT_SELECT_LONG_PRESS, |
| 34 INVALID_SELECTION, | 35 INVALID_SELECTION, |
| 35 BASE_PAGE_TAP, | 36 BASE_PAGE_TAP, |
| 36 BASE_PAGE_SCROLL, | 37 BASE_PAGE_SCROLL, |
| 37 SEARCH_BAR_TAP, | 38 SEARCH_BAR_TAP, |
| 38 SERP_NAVIGATION, | 39 SERP_NAVIGATION, |
| 39 TAB_PROMOTION, | 40 TAB_PROMOTION, |
| 40 CLICK, | 41 CLICK, |
| 41 SWIPE, // Moved by going to the nearest state when a drag ends. | 42 SWIPE, // Moved by going to the nearest state when a drag ends. |
| 42 FLING, // Moved by interpolating a drag with velocity. | 43 FLING, // Moved by interpolating a drag with velocity. |
| 43 OPTIN, | 44 OPTIN, |
| 44 OPTOUT | 45 OPTOUT |
| 45 }; | 46 }; |
| 46 } // namespace ContextualSearch | 47 } // namespace ContextualSearch |
| 47 | 48 |
| 48 @class ContextualSearchController; | 49 @class ContextualSearchController; |
| 49 @class ContextualSearchPanelView; | 50 @class ContextualSearchPanelView; |
| 50 @class ContextualSearchResultsView; | 51 @class ContextualSearchResultsView; |
| 51 | 52 |
| 52 @protocol ContextualSearchTabProvider<NSObject> | 53 @protocol ContextualSearchTabProvider<NSObject> |
| 53 // Disassociate the internal Tab object from this view and return it. | 54 // Disassociate the internal WebState from this view and return it. |
| 54 - (Tab*)releaseTab; | 55 - (std::unique_ptr<web::WebState>)releaseWebState; |
| 56 // Information about the opener of the internal WebState. |
| 57 - (WebStateOpener)webStateOpener; |
| 55 @end | 58 @end |
| 56 | 59 |
| 57 @protocol ContextualSearchControllerDelegate<NSObject> | 60 @protocol ContextualSearchControllerDelegate<NSObject> |
| 58 | 61 |
| 59 // Called by the controller when it has tab content for the delegate to load | 62 // Called by the controller when it has tab content for the delegate to load |
| 60 // and display as a new tab; the content is provided by -releaseSearchTab. | 63 // and display as a new tab; the content is provided by -releaseSearchTab. |
| 61 // |focusInput| indicates that the after promoting the tab, the delegate must | 64 // |focusInput| indicates that the after promoting the tab, the delegate must |
| 62 // focus the main input. | 65 // focus the main input. |
| 63 - (void)promotePanelToTabProvidedBy:(id<ContextualSearchTabProvider>)tabProvider | 66 - (void)promotePanelToTabProvidedBy:(id<ContextualSearchTabProvider>)tabProvider |
| 64 focusInput:(BOOL)focusInput; | 67 focusInput:(BOOL)focusInput; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 @end | 119 @end |
| 117 | 120 |
| 118 // Testing category that allows a permissions class to be injected. | 121 // Testing category that allows a permissions class to be injected. |
| 119 @interface ContextualSearchController (Testing) | 122 @interface ContextualSearchController (Testing) |
| 120 | 123 |
| 121 - (void)setPermissions:(TouchToSearchPermissionsMediator*)permissions; | 124 - (void)setPermissions:(TouchToSearchPermissionsMediator*)permissions; |
| 122 | 125 |
| 123 @end | 126 @end |
| 124 | 127 |
| 125 #endif // IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_CONTEXTUAL_SEARCH_CONTROLLER_
H_ | 128 #endif // IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_CONTEXTUAL_SEARCH_CONTROLLER_
H_ |
| OLD | NEW |