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