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_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 <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 // Invoked by the InstantLoader when its RenderView crashes. | 165 // Invoked by the InstantLoader when its RenderView crashes. |
| 166 void InstantLoaderRenderViewGone(); | 166 void InstantLoaderRenderViewGone(); |
| 167 | 167 |
| 168 // Invoked by InstantLoader when the instant page is about to navigate. | 168 // Invoked by InstantLoader when the instant page is about to navigate. |
| 169 void InstantLoaderAboutToNavigateMainFrame(const GURL& url); | 169 void InstantLoaderAboutToNavigateMainFrame(const GURL& url); |
| 170 | 170 |
| 171 // Invoked by the InstantLoader when the instant page wants to navigate to | 171 // Invoked by the InstantLoader when the instant page wants to navigate to |
| 172 // the speicfied URL. | 172 // the speicfied URL. |
| 173 void NavigateToURL(const GURL& url, content::PageTransition transition); | 173 void NavigateToURL(const GURL& url, content::PageTransition transition); |
| 174 | 174 |
| 175 // Call to force InstantController to enter testing mode. In particular, this | |
| 176 // doesn't force the instant page to be served over HTTPS. | |
| 177 // | |
| 178 // Only call from tests. | |
| 179 void SetTestingMode(); | |
|
sreeram
2013/01/02 18:12:10
I'd prefer instead to have the tests set --instant
samarth
2013/01/02 23:35:15
Ah yes, forget about that. I agree: that's much be
| |
| 180 | |
| 175 private: | 181 private: |
| 176 FRIEND_TEST_ALL_PREFIXES(InstantTest, OmniboxFocusLoadsInstant); | 182 FRIEND_TEST_ALL_PREFIXES(InstantTest, OmniboxFocusLoadsInstant); |
| 177 FRIEND_TEST_ALL_PREFIXES(InstantTest, NonInstantSearchProvider); | 183 FRIEND_TEST_ALL_PREFIXES(InstantTest, NonInstantSearchProvider); |
| 178 FRIEND_TEST_ALL_PREFIXES(InstantTest, InstantLoaderRefresh); | 184 FRIEND_TEST_ALL_PREFIXES(InstantTest, InstantLoaderRefresh); |
| 185 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ExtendedModeIsOn); | |
| 186 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OmniboxFocusLoadsInstant); | |
| 179 | 187 |
| 180 // Helper for OmniboxFocusChanged. Commit or discard the preview. | 188 // Helper for OmniboxFocusChanged. Commit or discard the preview. |
| 181 void OmniboxLostFocus(gfx::NativeView view_gaining_focus); | 189 void OmniboxLostFocus(gfx::NativeView view_gaining_focus); |
| 182 | 190 |
| 183 // Creates a new loader if necessary, using the instant_url property of the | 191 // Creates a new loader if necessary, using the instant_url property of the |
| 184 // |template_url| (for example, if the Instant URL has changed since the last | 192 // |template_url| (for example, if the Instant URL has changed since the last |
| 185 // time the loader was created). If |fallback_to_local| is true will use | 193 // time the loader was created). If |fallback_to_local| is true will use |
| 186 // kLocalOmniboxPopupURL as the fallback url (in extended mode) in case | 194 // kLocalOmniboxPopupURL as the fallback url (in extended mode) in case |
| 187 // the |template_url| doesn't have a valid Instant URL. Returns true if an | 195 // the |template_url| doesn't have a valid Instant URL. Returns true if an |
| 188 // instant URL could be determined. | 196 // instant URL could be determined. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 chrome::BrowserInstantController* const browser_; | 243 chrome::BrowserInstantController* const browser_; |
| 236 | 244 |
| 237 // Whether the extended API and regular API are enabled. If both are false, | 245 // Whether the extended API and regular API are enabled. If both are false, |
| 238 // Instant is effectively disabled. | 246 // Instant is effectively disabled. |
| 239 const bool extended_enabled_; | 247 const bool extended_enabled_; |
| 240 bool instant_enabled_; | 248 bool instant_enabled_; |
| 241 | 249 |
| 242 // If true, the instant URL is set to kLocalOmniboxPopupURL. | 250 // If true, the instant URL is set to kLocalOmniboxPopupURL. |
| 243 const bool use_local_preview_only_; | 251 const bool use_local_preview_only_; |
| 244 | 252 |
| 253 // If true, we are being used in a test. | |
| 254 bool in_testing_mode_; | |
| 255 | |
| 245 // The state of the preview page, i.e., the page owned by |loader_|. Ignored | 256 // The state of the preview page, i.e., the page owned by |loader_|. Ignored |
| 246 // if |instant_tab_| is in use. | 257 // if |instant_tab_| is in use. |
| 247 InstantModel model_; | 258 InstantModel model_; |
| 248 | 259 |
| 249 // The preview WebContents. | 260 // The preview WebContents. |
| 250 scoped_ptr<InstantLoader> loader_; | 261 scoped_ptr<InstantLoader> loader_; |
| 251 | 262 |
| 252 // A committed WebContents that supports Instant. If non-NULL, the |loader_| | 263 // A committed WebContents that supports Instant. If non-NULL, the |loader_| |
| 253 // is guaranteed to be hidden and messages will be sent to this instead. | 264 // is guaranteed to be hidden and messages will be sent to this instead. |
| 254 scoped_ptr<InstantTab> instant_tab_; | 265 scoped_ptr<InstantTab> instant_tab_; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 321 | 332 |
| 322 // Whether to allow the preview to show search suggestions. In general, the | 333 // Whether to allow the preview to show search suggestions. In general, the |
| 323 // preview is allowed to show search suggestions whenever |search_mode_| is | 334 // preview is allowed to show search suggestions whenever |search_mode_| is |
| 324 // MODE_SEARCH_SUGGESTIONS, except in those cases where this is false. | 335 // MODE_SEARCH_SUGGESTIONS, except in those cases where this is false. |
| 325 bool allow_preview_to_show_search_suggestions_; | 336 bool allow_preview_to_show_search_suggestions_; |
| 326 | 337 |
| 327 DISALLOW_COPY_AND_ASSIGN(InstantController); | 338 DISALLOW_COPY_AND_ASSIGN(InstantController); |
| 328 }; | 339 }; |
| 329 | 340 |
| 330 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ | 341 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ |
| OLD | NEW |