| 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/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/strings/string16.h" |
| 13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 14 #include "chrome/browser/search/instant_service_observer.h" | 15 #include "chrome/browser/search/instant_service_observer.h" |
| 15 #include "chrome/browser/ui/search/search_ipc_router.h" | 16 #include "chrome/browser/ui/search/search_ipc_router.h" |
| 16 #include "chrome/browser/ui/search/search_model.h" | 17 #include "chrome/browser/ui/search/search_model.h" |
| 17 #include "chrome/common/search/instant_types.h" | 18 #include "chrome/common/search/instant_types.h" |
| 18 #include "chrome/common/search/ntp_logging_events.h" | 19 #include "chrome/common/search/ntp_logging_events.h" |
| 19 #include "components/omnibox/common/omnibox_focus_state.h" | 20 #include "components/omnibox/common/omnibox_focus_state.h" |
| 20 #include "content/public/browser/web_contents_observer.h" | 21 #include "content/public/browser/web_contents_observer.h" |
| 21 #include "content/public/browser/web_contents_user_data.h" | 22 #include "content/public/browser/web_contents_user_data.h" |
| 22 #include "ui/base/window_open_disposition.h" | 23 #include "ui/base/window_open_disposition.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, | 104 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, |
| 104 PageURLDoesntBelongToInstantRenderer); | 105 PageURLDoesntBelongToInstantRenderer); |
| 105 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, | 106 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, |
| 106 OnChromeIdentityCheckMatch); | 107 OnChromeIdentityCheckMatch); |
| 107 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, | 108 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, |
| 108 OnChromeIdentityCheckMatchSlightlyDifferentGmail); | 109 OnChromeIdentityCheckMatchSlightlyDifferentGmail); |
| 109 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, | 110 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, |
| 110 OnChromeIdentityCheckMatchSlightlyDifferentGmail2); | 111 OnChromeIdentityCheckMatchSlightlyDifferentGmail2); |
| 111 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, OnChromeIdentityCheckMismatch); | 112 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, OnChromeIdentityCheckMismatch); |
| 112 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, | 113 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, |
| 113 OnChromeIdentityCheckSignedOutMatch); | |
| 114 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, | |
| 115 OnChromeIdentityCheckSignedOutMismatch); | 114 OnChromeIdentityCheckSignedOutMismatch); |
| 116 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, | 115 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, |
| 117 OnHistorySyncCheckSyncInactive); | |
| 118 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, | |
| 119 OnHistorySyncCheckSyncing); | 116 OnHistorySyncCheckSyncing); |
| 120 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, | 117 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, |
| 121 OnHistorySyncCheckNotSyncing); | 118 OnHistorySyncCheckNotSyncing); |
| 122 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, | |
| 123 OnMostVisitedItemsChangedFromServer); | |
| 124 FRIEND_TEST_ALL_PREFIXES(SearchTabHelperTest, | |
| 125 OnMostVisitedItemsChangedFromClient); | |
| 126 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, | 119 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, |
| 127 IgnoreMessageIfThePageIsNotActive); | 120 IgnoreMessageIfThePageIsNotActive); |
| 128 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, HandleTabChangedEvents); | 121 FRIEND_TEST_ALL_PREFIXES(SearchIPCRouterTest, HandleTabChangedEvents); |
| 129 FRIEND_TEST_ALL_PREFIXES(InstantTabTest, | 122 FRIEND_TEST_ALL_PREFIXES(InstantTabTest, |
| 130 DetermineIfPageSupportsInstant_Local); | 123 DetermineIfPageSupportsInstant_Local); |
| 131 FRIEND_TEST_ALL_PREFIXES(InstantTabTest, | 124 FRIEND_TEST_ALL_PREFIXES(InstantTabTest, |
| 132 DetermineIfPageSupportsInstant_NonLocal); | 125 DetermineIfPageSupportsInstant_NonLocal); |
| 133 FRIEND_TEST_ALL_PREFIXES(InstantTabTest, | 126 FRIEND_TEST_ALL_PREFIXES(InstantTabTest, |
| 134 PageURLDoesntBelongToInstantRenderer); | 127 PageURLDoesntBelongToInstantRenderer); |
| 135 FRIEND_TEST_ALL_PREFIXES(InstantTabTest, PageSupportsInstant); | 128 FRIEND_TEST_ALL_PREFIXES(InstantTabTest, PageSupportsInstant); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 179 |
| 187 Profile* profile() const; | 180 Profile* profile() const; |
| 188 | 181 |
| 189 // Returns whether input is in progress, i.e. if the omnibox has focus and the | 182 // Returns whether input is in progress, i.e. if the omnibox has focus and the |
| 190 // active tab is in mode SEARCH_SUGGESTIONS. | 183 // active tab is in mode SEARCH_SUGGESTIONS. |
| 191 bool IsInputInProgress() const; | 184 bool IsInputInProgress() const; |
| 192 | 185 |
| 193 // Returns the OmniboxView for |web_contents_| or NULL if not available. | 186 // Returns the OmniboxView for |web_contents_| or NULL if not available. |
| 194 OmniboxView* GetOmniboxView() const; | 187 OmniboxView* GetOmniboxView() const; |
| 195 | 188 |
| 196 typedef bool (*OmniboxHasFocusFn)(OmniboxView*); | |
| 197 | |
| 198 void set_omnibox_has_focus_fn(OmniboxHasFocusFn fn) { | |
| 199 omnibox_has_focus_fn_ = fn; | |
| 200 } | |
| 201 | |
| 202 const bool is_search_enabled_; | 189 const bool is_search_enabled_; |
| 203 | 190 |
| 204 // Model object for UI that cares about search state. | 191 // Model object for UI that cares about search state. |
| 205 SearchModel model_; | 192 SearchModel model_; |
| 206 | 193 |
| 207 content::WebContents* web_contents_; | 194 content::WebContents* web_contents_; |
| 208 | 195 |
| 209 SearchIPCRouter ipc_router_; | 196 SearchIPCRouter ipc_router_; |
| 210 | 197 |
| 211 InstantService* instant_service_; | 198 InstantService* instant_service_; |
| 212 | 199 |
| 213 // Delegate for notifying our owner about the SearchTabHelper state. Not owned | 200 // Delegate for notifying our owner about the SearchTabHelper state. Not owned |
| 214 // by us. | 201 // by us. |
| 215 // NULL on iOS and Android because they don't use the Instant framework. | 202 // NULL on iOS and Android because they don't use the Instant framework. |
| 216 SearchTabHelperDelegate* delegate_; | 203 SearchTabHelperDelegate* delegate_; |
| 217 | 204 |
| 218 // Function to check if the omnibox has focus. Tests use this to modify the | |
| 219 // default behavior. | |
| 220 OmniboxHasFocusFn omnibox_has_focus_fn_; | |
| 221 | |
| 222 DISALLOW_COPY_AND_ASSIGN(SearchTabHelper); | 205 DISALLOW_COPY_AND_ASSIGN(SearchTabHelper); |
| 223 }; | 206 }; |
| 224 | 207 |
| 225 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ | 208 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ |
| OLD | NEW |