| 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" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 public content::WebContentsUserData<SearchTabHelper>, | 45 public content::WebContentsUserData<SearchTabHelper>, |
| 46 public InstantServiceObserver, | 46 public InstantServiceObserver, |
| 47 public SearchIPCRouter::Delegate { | 47 public SearchIPCRouter::Delegate { |
| 48 public: | 48 public: |
| 49 ~SearchTabHelper() override; | 49 ~SearchTabHelper() override; |
| 50 | 50 |
| 51 SearchModel* model() { | 51 SearchModel* model() { |
| 52 return &model_; | 52 return &model_; |
| 53 } | 53 } |
| 54 | 54 |
| 55 // Sets up the initial state correctly for a preloaded NTP. | |
| 56 void InitForPreloadedNTP(); | |
| 57 | |
| 58 // Invoked when the omnibox input state is changed in some way that might | 55 // Invoked when the omnibox input state is changed in some way that might |
| 59 // affect the search mode. | 56 // affect the search mode. |
| 60 void OmniboxInputStateChanged(); | 57 void OmniboxInputStateChanged(); |
| 61 | 58 |
| 62 // Called to indicate that the omnibox focus state changed with the given | 59 // Called to indicate that the omnibox focus state changed with the given |
| 63 // |reason|. | 60 // |reason|. |
| 64 void OmniboxFocusChanged(OmniboxFocusState state, | 61 void OmniboxFocusChanged(OmniboxFocusState state, |
| 65 OmniboxFocusChangeReason reason); | 62 OmniboxFocusChangeReason reason); |
| 66 | 63 |
| 67 // Invoked when the active navigation entry is updated in some way that might | 64 // Invoked when the active navigation entry is updated in some way that might |
| 68 // affect the search mode. This is used by Instant when it "fixes up" the | 65 // affect the search mode. This is used by Instant when it "fixes up" the |
| 69 // virtual URL of the active entry. Regular navigations are captured through | 66 // virtual URL of the active entry. Regular navigations are captured through |
| 70 // the notification system and shouldn't call this method. | 67 // the notification system and shouldn't call this method. |
| 71 void NavigationEntryUpdated(); | 68 void NavigationEntryUpdated(); |
| 72 | 69 |
| 73 // Invoked to update the instant support state. | |
| 74 void InstantSupportChanged(bool supports_instant); | |
| 75 | |
| 76 // Returns true if the page supports instant. If the instant support state is | 70 // Returns true if the page supports instant. If the instant support state is |
| 77 // not determined or if the page does not support instant returns false. | 71 // not determined or if the page does not support instant returns false. |
| 78 bool SupportsInstant() const; | 72 bool SupportsInstant() const; |
| 79 | 73 |
| 80 // Sends the current SearchProvider suggestion to the Instant page if any. | 74 // Sends the current SearchProvider suggestion to the Instant page if any. |
| 81 void SetSuggestionToPrefetch(const InstantSuggestion& suggestion); | 75 void SetSuggestionToPrefetch(const InstantSuggestion& suggestion); |
| 82 | 76 |
| 83 // Tells the page that the user pressed Enter in the omnibox. | 77 // Tells the page that the user pressed Enter in the omnibox. |
| 84 void Submit(const base::string16& text, | 78 void Submit(const base::string16& text, |
| 85 const EmbeddedSearchRequestParams& params); | 79 const EmbeddedSearchRequestParams& params); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 NTPLoggingTileSource tile_source) override; | 164 NTPLoggingTileSource tile_source) override; |
| 171 void PasteIntoOmnibox(const base::string16& text) override; | 165 void PasteIntoOmnibox(const base::string16& text) override; |
| 172 void OnChromeIdentityCheck(const base::string16& identity) override; | 166 void OnChromeIdentityCheck(const base::string16& identity) override; |
| 173 void OnHistorySyncCheck() override; | 167 void OnHistorySyncCheck() override; |
| 174 | 168 |
| 175 // Overridden from InstantServiceObserver: | 169 // Overridden from InstantServiceObserver: |
| 176 void ThemeInfoChanged(const ThemeBackgroundInfo& theme_info) override; | 170 void ThemeInfoChanged(const ThemeBackgroundInfo& theme_info) override; |
| 177 void MostVisitedItemsChanged( | 171 void MostVisitedItemsChanged( |
| 178 const std::vector<InstantMostVisitedItem>& items) override; | 172 const std::vector<InstantMostVisitedItem>& items) override; |
| 179 | 173 |
| 174 // Invoked to update the instant support state. |
| 175 void InstantSupportChanged(bool supports_instant); |
| 176 |
| 180 // Sets the mode of the model based on the current URL of web_contents(). | 177 // Sets the mode of the model based on the current URL of web_contents(). |
| 181 // Only updates the origin part of the mode if |update_origin| is true, | 178 // Only updates the origin part of the mode if |update_origin| is true, |
| 182 // otherwise keeps the current origin. If |is_preloaded_ntp| is true, the mode | 179 // otherwise keeps the current origin. |
| 183 // is set to NTP regardless of the current URL; this is used to ensure that | 180 void UpdateMode(bool update_origin); |
| 184 // InstantController can bind InstantTab to new tab pages immediately. | |
| 185 void UpdateMode(bool update_origin, bool is_preloaded_ntp); | |
| 186 | 181 |
| 187 // Tells the renderer to determine if the page supports the Instant API, which | 182 // Tells the renderer to determine if the page supports the Instant API, which |
| 188 // results in a call to OnInstantSupportDetermined() when the reply is | 183 // results in a call to OnInstantSupportDetermined() when the reply is |
| 189 // received. | 184 // received. |
| 190 void DetermineIfPageSupportsInstant(); | 185 void DetermineIfPageSupportsInstant(); |
| 191 | 186 |
| 192 // Used by unit tests. | 187 // Used by unit tests. |
| 193 SearchIPCRouter& ipc_router() { return ipc_router_; } | 188 SearchIPCRouter& ipc_router() { return ipc_router_; } |
| 194 | 189 |
| 195 Profile* profile() const; | 190 Profile* profile() const; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 224 SearchTabHelperDelegate* delegate_; | 219 SearchTabHelperDelegate* delegate_; |
| 225 | 220 |
| 226 // Function to check if the omnibox has focus. Tests use this to modify the | 221 // Function to check if the omnibox has focus. Tests use this to modify the |
| 227 // default behavior. | 222 // default behavior. |
| 228 OmniboxHasFocusFn omnibox_has_focus_fn_; | 223 OmniboxHasFocusFn omnibox_has_focus_fn_; |
| 229 | 224 |
| 230 DISALLOW_COPY_AND_ASSIGN(SearchTabHelper); | 225 DISALLOW_COPY_AND_ASSIGN(SearchTabHelper); |
| 231 }; | 226 }; |
| 232 | 227 |
| 233 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ | 228 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ |
| OLD | NEW |