| 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_INSTANT_INSTANT_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ | 6 #define CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // Invoked by InstantLoader when the preview gains focus, usually due to the | 169 // Invoked by InstantLoader when the preview gains focus, usually due to the |
| 170 // user clicking on it. | 170 // user clicking on it. |
| 171 void InstantLoaderContentsFocused(); | 171 void InstantLoaderContentsFocused(); |
| 172 | 172 |
| 173 // Invoked by the InstantLoader when its RenderView crashes. | 173 // Invoked by the InstantLoader when its RenderView crashes. |
| 174 void InstantLoaderRenderViewGone(); | 174 void InstantLoaderRenderViewGone(); |
| 175 | 175 |
| 176 // Invoked by InstantLoader when the instant page is about to navigate. | 176 // Invoked by InstantLoader when the instant page is about to navigate. |
| 177 void InstantLoaderAboutToNavigateMainFrame(const GURL& url); | 177 void InstantLoaderAboutToNavigateMainFrame(const GURL& url); |
| 178 | 178 |
| 179 // Invoked by InstantLoader when it's underlying RenderView is created. |
| 180 // TODO(shishir): We assume that the WebContent's current RenderViewHost is |
| 181 // the RenderViewHost being created which is not always true. Fix this. |
| 182 void InstantLoaderRenderViewCreated(); |
| 183 |
| 179 // Invoked by the InstantLoader when the instant page wants to navigate to | 184 // Invoked by the InstantLoader when the instant page wants to navigate to |
| 180 // the speicfied URL. | 185 // the speicfied URL. |
| 181 void NavigateToURL(const GURL& url, content::PageTransition transition); | 186 void NavigateToURL(const GURL& url, content::PageTransition transition); |
| 182 | 187 |
| 183 // Adds a new event to |debug_events_| and also DVLOG's it. Ensures that | 188 // Adds a new event to |debug_events_| and also DVLOG's it. Ensures that |
| 184 // |debug_events_| doesn't get too large. | 189 // |debug_events_| doesn't get too large. |
| 185 void LogDebugEvent(const std::string& info) const; | 190 void LogDebugEvent(const std::string& info) const; |
| 186 | 191 |
| 187 // See comments for |debug_events_| below. | 192 // See comments for |debug_events_| below. |
| 188 const std::list<std::pair<int64, std::string> >& debug_events() { | 193 const std::list<std::pair<int64, std::string> >& debug_events() { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 210 // ensure that the |loader_| is not already on the stack since it is deleted | 215 // ensure that the |loader_| is not already on the stack since it is deleted |
| 211 // in this call. | 216 // in this call. |
| 212 void CreateLoader(const std::string& instant_url, | 217 void CreateLoader(const std::string& instant_url, |
| 213 const content::WebContents* active_tab); | 218 const content::WebContents* active_tab); |
| 214 | 219 |
| 215 // Called when the |loader_| might be stale. If it's actually stale, and the | 220 // Called when the |loader_| might be stale. If it's actually stale, and the |
| 216 // omnibox doesn't have focus, and the preview isn't showing, the |loader_| is | 221 // omnibox doesn't have focus, and the preview isn't showing, the |loader_| is |
| 217 // deleted and recreated. Else the refresh is skipped. | 222 // deleted and recreated. Else the refresh is skipped. |
| 218 void OnStaleLoader(); | 223 void OnStaleLoader(); |
| 219 | 224 |
| 225 // If the |loader_| being used is in fallback mode, it will be switched back |
| 226 // to the remote loader if the loader is not showing and the omnibox does not |
| 227 // have focus. |
| 228 void MaybeSwitchToRemoteLoader(); |
| 229 |
| 220 // If the active tab is an Instant search results page, sets |instant_tab_| to | 230 // If the active tab is an Instant search results page, sets |instant_tab_| to |
| 221 // point to it. Else, deletes any existing |instant_tab_|. | 231 // point to it. Else, deletes any existing |instant_tab_|. |
| 222 void ResetInstantTab(); | 232 void ResetInstantTab(); |
| 223 | 233 |
| 224 // Hide the preview. Also sends an onchange event (with blank query) to the | 234 // Hide the preview. Also sends an onchange event (with blank query) to the |
| 225 // preview, telling it to clear out results for any old queries. | 235 // preview, telling it to clear out results for any old queries. |
| 226 void HideLoader(); | 236 void HideLoader(); |
| 227 | 237 |
| 228 // Like HideLoader(), but doesn't call OnStaleLoader(). Use HideLoader() | 238 // Like HideLoader(), but doesn't call OnStaleLoader(). Use HideLoader() |
| 229 // unless you are going to call loader_.reset() yourself subsequently. | 239 // unless you are going to call loader_.reset() yourself subsequently. |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 // MODE_SEARCH_SUGGESTIONS, except in those cases where this is false. | 353 // MODE_SEARCH_SUGGESTIONS, except in those cases where this is false. |
| 344 bool allow_preview_to_show_search_suggestions_; | 354 bool allow_preview_to_show_search_suggestions_; |
| 345 | 355 |
| 346 // List of events and their timestamps, useful in debugging Instant behaviour. | 356 // List of events and their timestamps, useful in debugging Instant behaviour. |
| 347 mutable std::list<std::pair<int64, std::string> > debug_events_; | 357 mutable std::list<std::pair<int64, std::string> > debug_events_; |
| 348 | 358 |
| 349 DISALLOW_COPY_AND_ASSIGN(InstantController); | 359 DISALLOW_COPY_AND_ASSIGN(InstantController); |
| 350 }; | 360 }; |
| 351 | 361 |
| 352 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ | 362 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ |
| OLD | NEW |