| 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_INSTANT_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, | 243 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, |
| 244 OmniboxCommitsWhenShownFullHeight); | 244 OmniboxCommitsWhenShownFullHeight); |
| 245 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, LocalNTPIsNotPreloaded); | 245 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, LocalNTPIsNotPreloaded); |
| 246 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OverlayRenderViewGone); | 246 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OverlayRenderViewGone); |
| 247 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OverlayDoesntSupportInstant); | 247 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OverlayDoesntSupportInstant); |
| 248 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, | 248 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, |
| 249 MANUAL_OmniboxFocusLoadsInstant); | 249 MANUAL_OmniboxFocusLoadsInstant); |
| 250 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, | 250 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, |
| 251 MANUAL_BackspaceFromQueryToSelectedUrlAndNavigate); | 251 MANUAL_BackspaceFromQueryToSelectedUrlAndNavigate); |
| 252 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OnDefaultSearchProviderChanged); | 252 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OnDefaultSearchProviderChanged); |
| 253 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, UsesOverlayIfTabNotReady); |
| 253 | 254 |
| 254 Profile* profile() const; | 255 Profile* profile() const; |
| 255 InstantOverlay* overlay() const; | 256 InstantOverlay* overlay() const; |
| 256 InstantTab* instant_tab() const; | 257 InstantTab* instant_tab() const; |
| 257 InstantNTP* ntp() const; | 258 InstantNTP* ntp() const; |
| 258 | 259 |
| 259 // Overridden from content::NotificationObserver: | 260 // Overridden from content::NotificationObserver: |
| 260 virtual void Observe(int type, | 261 virtual void Observe(int type, |
| 261 const content::NotificationSource& source, | 262 const content::NotificationSource& source, |
| 262 const content::NotificationDetails& details) OVERRIDE; | 263 const content::NotificationDetails& details) OVERRIDE; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 const std::vector<InstantMostVisitedItemIDPair>& items); | 376 const std::vector<InstantMostVisitedItemIDPair>& items); |
| 376 | 377 |
| 377 // If possible, tries to mutate |suggestion| to a valid suggestion. Returns | 378 // If possible, tries to mutate |suggestion| to a valid suggestion. Returns |
| 378 // true if successful. (Note that |suggestion| may be modified even if this | 379 // true if successful. (Note that |suggestion| may be modified even if this |
| 379 // returns false.) | 380 // returns false.) |
| 380 bool FixSuggestion(InstantSuggestion* suggestion) const; | 381 bool FixSuggestion(InstantSuggestion* suggestion) const; |
| 381 | 382 |
| 382 // Returns true if the local page is being used. | 383 // Returns true if the local page is being used. |
| 383 bool UsingLocalPage() const; | 384 bool UsingLocalPage() const; |
| 384 | 385 |
| 386 // Returns true iff |use_tab_for_suggestions_| is true and |instant_tab_| |
| 387 // exists. |
| 388 bool UseTabForSuggestions() const; |
| 389 |
| 385 BrowserInstantController* const browser_; | 390 BrowserInstantController* const browser_; |
| 386 | 391 |
| 387 // Whether the extended API and regular API are enabled. If both are false, | 392 // Whether the extended API and regular API are enabled. If both are false, |
| 388 // Instant is effectively disabled. | 393 // Instant is effectively disabled. |
| 389 const bool extended_enabled_; | 394 const bool extended_enabled_; |
| 390 bool instant_enabled_; | 395 bool instant_enabled_; |
| 391 | 396 |
| 392 // If true, the Instant URL is set to kChromeSearchLocalNtpUrl. | 397 // If true, the Instant URL is set to kChromeSearchLocalNtpUrl. |
| 393 bool use_local_page_only_; | 398 bool use_local_page_only_; |
| 394 | 399 |
| 395 // The state of the overlay page, i.e., the page owned by |overlay_|. Ignored | 400 // The state of the overlay page, i.e., the page owned by |overlay_|. Ignored |
| 396 // if |instant_tab_| is in use. | 401 // if |instant_tab_| is in use. |
| 397 InstantOverlayModel model_; | 402 InstantOverlayModel model_; |
| 398 | 403 |
| 399 // The three instances of InstantPage maintained by InstantController as | 404 // The three instances of InstantPage maintained by InstantController as |
| 400 // described above. All three may be non-NULL in extended mode. If | 405 // described above. All three may be non-NULL in extended mode. If |
| 401 // |instant_tab_| is not NULL, then |overlay_| is guaranteed to be hidden and | 406 // |instant_tab_| is not NULL, then |overlay_| is guaranteed to be hidden and |
| 402 // messages will be sent to |instant_tab_| instead. | 407 // messages will be sent to |instant_tab_| instead. |
| 403 // | 408 // |
| 404 // In non-extended mode, only |overlay_| is ever non-NULL. | 409 // In non-extended mode, only |overlay_| is ever non-NULL. |
| 405 scoped_ptr<InstantOverlay> overlay_; | 410 scoped_ptr<InstantOverlay> overlay_; |
| 406 scoped_ptr<InstantNTP> ntp_; | 411 scoped_ptr<InstantNTP> ntp_; |
| 407 scoped_ptr<InstantTab> instant_tab_; | 412 scoped_ptr<InstantTab> instant_tab_; |
| 408 | 413 |
| 414 // If true, send suggestion-related events (such as user key strokes, auto |
| 415 // complete results, etc.) to |instant_tab_| instead of |overlay_|. Once set |
| 416 // to false, will stay false until the overlay is hidden or committed. |
| 417 bool use_tab_for_suggestions_; |
| 418 |
| 409 // The most recent full_text passed to Update(). If empty, we'll not accept | 419 // The most recent full_text passed to Update(). If empty, we'll not accept |
| 410 // search suggestions from |overlay_| or |instant_tab_|. | 420 // search suggestions from |overlay_| or |instant_tab_|. |
| 411 string16 last_omnibox_text_; | 421 string16 last_omnibox_text_; |
| 412 | 422 |
| 413 // The most recent user_text passed to Update(). Used to filter out-of-date | 423 // The most recent user_text passed to Update(). Used to filter out-of-date |
| 414 // URL suggestions from the Instant page. Set in Update() and cleared when | 424 // URL suggestions from the Instant page. Set in Update() and cleared when |
| 415 // the page sets temporary text (SetSuggestions() with REPLACE behavior). | 425 // the page sets temporary text (SetSuggestions() with REPLACE behavior). |
| 416 string16 last_user_text_; | 426 string16 last_user_text_; |
| 417 | 427 |
| 418 // True if the last Update() had an inline autocompletion. Used only to make | 428 // True if the last Update() had an inline autocompletion. Used only to make |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 // Used for Top Sites async retrieval. | 485 // Used for Top Sites async retrieval. |
| 476 base::WeakPtrFactory<InstantController> weak_ptr_factory_; | 486 base::WeakPtrFactory<InstantController> weak_ptr_factory_; |
| 477 | 487 |
| 478 // Used to get notifications about Most Visted changes. | 488 // Used to get notifications about Most Visted changes. |
| 479 content::NotificationRegistrar registrar_; | 489 content::NotificationRegistrar registrar_; |
| 480 | 490 |
| 481 DISALLOW_COPY_AND_ASSIGN(InstantController); | 491 DISALLOW_COPY_AND_ASSIGN(InstantController); |
| 482 }; | 492 }; |
| 483 | 493 |
| 484 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ | 494 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ |
| OLD | NEW |