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/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 explicit SearchTabHelper(content::WebContents* web_contents); | 146 explicit SearchTabHelper(content::WebContents* web_contents); |
147 | 147 |
148 // Overridden from contents::WebContentsObserver: | 148 // Overridden from contents::WebContentsObserver: |
149 void RenderViewCreated(content::RenderViewHost* render_view_host) override; | 149 void RenderViewCreated(content::RenderViewHost* render_view_host) override; |
150 void DidStartNavigationToPendingEntry( | 150 void DidStartNavigationToPendingEntry( |
151 const GURL& url, | 151 const GURL& url, |
152 content::NavigationController::ReloadType reload_type) override; | 152 content::NavigationController::ReloadType reload_type) override; |
153 void DidNavigateMainFrame( | 153 void DidNavigateMainFrame( |
154 const content::LoadCommittedDetails& details, | 154 const content::LoadCommittedDetails& details, |
155 const content::FrameNavigateParams& params) override; | 155 const content::FrameNavigateParams& params) override; |
156 void DidFailProvisionalLoad(content::RenderFrameHost* render_frame_host, | |
157 const GURL& validated_url, | |
158 int error_code, | |
159 const base::string16& error_description) override; | |
160 void DidFinishLoad(content::RenderFrameHost* render_frame_host, | 156 void DidFinishLoad(content::RenderFrameHost* render_frame_host, |
161 const GURL& validated_url) override; | 157 const GURL& validated_url) override; |
162 void NavigationEntryCommitted( | 158 void NavigationEntryCommitted( |
163 const content::LoadCommittedDetails& load_details) override; | 159 const content::LoadCommittedDetails& load_details) override; |
164 | 160 |
165 // Overridden from SearchIPCRouter::Delegate: | 161 // Overridden from SearchIPCRouter::Delegate: |
166 void OnInstantSupportDetermined(bool supports_instant) override; | 162 void OnInstantSupportDetermined(bool supports_instant) override; |
167 void OnSetVoiceSearchSupport(bool supports_voice_search) override; | 163 void OnSetVoiceSearchSupport(bool supports_voice_search) override; |
168 void FocusOmnibox(OmniboxFocusState state) override; | 164 void FocusOmnibox(OmniboxFocusState state) override; |
169 void NavigateToURL(const GURL& url, | 165 void NavigateToURL(const GURL& url, |
(...skipping 27 matching lines...) Expand all Loading... |
197 // Tells the renderer to determine if the page supports the Instant API, which | 193 // Tells the renderer to determine if the page supports the Instant API, which |
198 // results in a call to OnInstantSupportDetermined() when the reply is | 194 // results in a call to OnInstantSupportDetermined() when the reply is |
199 // received. | 195 // received. |
200 void DetermineIfPageSupportsInstant(); | 196 void DetermineIfPageSupportsInstant(); |
201 | 197 |
202 // Used by unit tests. | 198 // Used by unit tests. |
203 SearchIPCRouter& ipc_router() { return ipc_router_; } | 199 SearchIPCRouter& ipc_router() { return ipc_router_; } |
204 | 200 |
205 Profile* profile() const; | 201 Profile* profile() const; |
206 | 202 |
207 // Helper function to navigate the given contents to the local fallback | |
208 // Instant URL and trim the history correctly. | |
209 void RedirectToLocalNTP(); | |
210 | |
211 // Returns whether input is in progress, i.e. if the omnibox has focus and the | 203 // Returns whether input is in progress, i.e. if the omnibox has focus and the |
212 // active tab is in mode SEARCH_SUGGESTIONS. | 204 // active tab is in mode SEARCH_SUGGESTIONS. |
213 bool IsInputInProgress() const; | 205 bool IsInputInProgress() const; |
214 | 206 |
215 // Returns the OmniboxView for |web_contents_| or NULL if not available. | 207 // Returns the OmniboxView for |web_contents_| or NULL if not available. |
216 OmniboxView* GetOmniboxView() const; | 208 OmniboxView* GetOmniboxView() const; |
217 | 209 |
218 typedef bool (*OmniboxHasFocusFn)(OmniboxView*); | 210 typedef bool (*OmniboxHasFocusFn)(OmniboxView*); |
219 | 211 |
220 void set_omnibox_has_focus_fn(OmniboxHasFocusFn fn) { | 212 void set_omnibox_has_focus_fn(OmniboxHasFocusFn fn) { |
(...skipping 17 matching lines...) Expand all Loading... |
238 SearchTabHelperDelegate* delegate_; | 230 SearchTabHelperDelegate* delegate_; |
239 | 231 |
240 // Function to check if the omnibox has focus. Tests use this to modify the | 232 // Function to check if the omnibox has focus. Tests use this to modify the |
241 // default behavior. | 233 // default behavior. |
242 OmniboxHasFocusFn omnibox_has_focus_fn_; | 234 OmniboxHasFocusFn omnibox_has_focus_fn_; |
243 | 235 |
244 DISALLOW_COPY_AND_ASSIGN(SearchTabHelper); | 236 DISALLOW_COPY_AND_ASSIGN(SearchTabHelper); |
245 }; | 237 }; |
246 | 238 |
247 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ | 239 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ |
OLD | NEW |