Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ |
| 6 #define CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "chrome/browser/search/instant_service_observer.h" | 14 #include "chrome/browser/search/instant_service_observer.h" |
| 15 #include "chrome/browser/ui/search/search_ipc_router.h" | 15 #include "chrome/browser/ui/search/search_ipc_router.h" |
| 16 #include "chrome/browser/ui/search/search_model.h" | 16 #include "chrome/browser/ui/search/search_model.h" |
| 17 #include "chrome/common/search/instant_types.h" | 17 #include "chrome/common/search/instant_types.h" |
| 18 #include "chrome/common/search/ntp_logging_events.h" | 18 #include "chrome/common/search/ntp_logging_events.h" |
| 19 #include "components/ntp_tiles/ntp_tile_source.h" | 19 #include "components/ntp_tiles/ntp_tile_source.h" |
| 20 #include "components/omnibox/common/omnibox_focus_state.h" | 20 #include "components/omnibox/common/omnibox_focus_state.h" |
| 21 #include "content/public/browser/reload_type.h" | 21 #include "content/public/browser/reload_type.h" |
| 22 #include "content/public/browser/web_contents_observer.h" | 22 #include "content/public/browser/web_contents_observer.h" |
| 23 #include "content/public/browser/web_contents_user_data.h" | 23 #include "content/public/browser/web_contents_user_data.h" |
| 24 | 24 |
| 25 namespace content { | 25 namespace content { |
| 26 class WebContents; | 26 class WebContents; |
| 27 struct LoadCommittedDetails; | 27 struct LoadCommittedDetails; |
| 28 } | 28 } |
| 29 | 29 |
| 30 class BrowserWindow; | |
| 31 class GURL; | 30 class GURL; |
| 32 class InstantService; | 31 class InstantService; |
| 33 class InstantTabTest; | 32 class InstantTabTest; |
| 34 class OmniboxView; | 33 class OmniboxView; |
| 35 class Profile; | 34 class Profile; |
| 36 class SearchIPCRouterTest; | 35 class SearchIPCRouterTest; |
| 37 | 36 |
| 38 // Per-tab search "helper". Acts as the owner and controller of the tab's | 37 // Per-tab search "helper". Acts as the owner and controller of the tab's |
| 39 // search UI model. | 38 // search UI model. |
| 40 // | 39 // |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 68 // the notification system and shouldn't call this method. | 67 // the notification system and shouldn't call this method. |
| 69 void NavigationEntryUpdated(); | 68 void NavigationEntryUpdated(); |
| 70 | 69 |
| 71 // Sends the current SearchProvider suggestion to the Instant page if any. | 70 // Sends the current SearchProvider suggestion to the Instant page if any. |
| 72 void SetSuggestionToPrefetch(const InstantSuggestion& suggestion); | 71 void SetSuggestionToPrefetch(const InstantSuggestion& suggestion); |
| 73 | 72 |
| 74 // Tells the page that the user pressed Enter in the omnibox. | 73 // Tells the page that the user pressed Enter in the omnibox. |
| 75 void Submit(const base::string16& text, | 74 void Submit(const base::string16& text, |
| 76 const EmbeddedSearchRequestParams& params); | 75 const EmbeddedSearchRequestParams& params); |
| 77 | 76 |
| 78 // Called when the tab corresponding to |this| instance is attached to a | |
| 79 // browser window. | |
| 80 void OnTabAttachedToWindow(BrowserWindow* window); | |
| 81 | |
| 82 // Called when the tab corresponding to |this| instance is activated. | 77 // Called when the tab corresponding to |this| instance is activated. |
| 83 void OnTabActivated(); | 78 void OnTabActivated(); |
| 84 | 79 |
| 85 // Called when the tab corresponding to |this| instance is deactivated. | 80 // Called when the tab corresponding to |this| instance is deactivated. |
| 86 void OnTabDeactivated(); | 81 void OnTabDeactivated(); |
| 87 | 82 |
| 88 SearchIPCRouter& ipc_router_for_testing() { return ipc_router_; } | 83 SearchIPCRouter& ipc_router_for_testing() { return ipc_router_; } |
| 89 | 84 |
| 90 private: | 85 private: |
| 91 friend class content::WebContentsUserData<SearchTabHelper>; | 86 friend class content::WebContentsUserData<SearchTabHelper>; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 // Sets the mode of the model based on the current URL of web_contents(). | 160 // Sets the mode of the model based on the current URL of web_contents(). |
| 166 // Only updates the origin part of the mode if |update_origin| is true, | 161 // Only updates the origin part of the mode if |update_origin| is true, |
| 167 // otherwise keeps the current origin. | 162 // otherwise keeps the current origin. |
| 168 void UpdateMode(bool update_origin); | 163 void UpdateMode(bool update_origin); |
| 169 | 164 |
| 170 // Tells the renderer to determine if the page supports the Instant API, which | 165 // Tells the renderer to determine if the page supports the Instant API, which |
| 171 // results in a call to OnInstantSupportDetermined() when the reply is | 166 // results in a call to OnInstantSupportDetermined() when the reply is |
| 172 // received. | 167 // received. |
| 173 void DetermineIfPageSupportsInstant(); | 168 void DetermineIfPageSupportsInstant(); |
| 174 | 169 |
| 170 OmniboxView* GetOmniboxView() const; | |
|
Peter Kasting
2017/03/17 21:16:13
Nit: const methods should not return non-const poi
Marc Treib
2017/03/20 14:52:31
Done (made const and non-const overloads).
| |
| 171 | |
| 175 Profile* profile() const; | 172 Profile* profile() const; |
| 176 | 173 |
| 177 // Returns whether input is in progress, i.e. if the omnibox has focus and the | 174 // Returns whether input is in progress, i.e. if the omnibox has focus and the |
| 178 // active tab is in mode SEARCH_SUGGESTIONS. | 175 // active tab is in mode SEARCH_SUGGESTIONS. |
| 179 bool IsInputInProgress() const; | 176 bool IsInputInProgress() const; |
| 180 | 177 |
| 181 const bool is_search_enabled_; | 178 const bool is_search_enabled_; |
| 182 | 179 |
| 183 // Model object for UI that cares about search state. | 180 // Model object for UI that cares about search state. |
| 184 SearchModel model_; | 181 SearchModel model_; |
| 185 | 182 |
| 186 content::WebContents* web_contents_; | 183 content::WebContents* web_contents_; |
| 187 | 184 |
| 188 SearchIPCRouter ipc_router_; | 185 SearchIPCRouter ipc_router_; |
| 189 | 186 |
| 190 InstantService* instant_service_; | 187 InstantService* instant_service_; |
| 191 | 188 |
| 192 OmniboxView* omnibox_view_; | |
| 193 | |
| 194 DISALLOW_COPY_AND_ASSIGN(SearchTabHelper); | 189 DISALLOW_COPY_AND_ASSIGN(SearchTabHelper); |
| 195 }; | 190 }; |
| 196 | 191 |
| 197 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ | 192 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ |
| OLD | NEW |