Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: chrome/browser/ui/search/instant_controller.h

Issue 14843002: InstantExtended: don't reset InstantTab if not ready. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/search/instant_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 content::PageTransition last_transition_type() const { 204 content::PageTransition last_transition_type() const {
205 return last_transition_type_; 205 return last_transition_type_;
206 } 206 }
207 207
208 // Non-const for Add/RemoveObserver only. Other model changes should only 208 // Non-const for Add/RemoveObserver only. Other model changes should only
209 // happen through the InstantController interface. 209 // happen through the InstantController interface.
210 InstantOverlayModel* model() { return &model_; } 210 InstantOverlayModel* model() { return &model_; }
211 211
212 private: 212 private:
213 FRIEND_TEST_ALL_PREFIXES(InstantTest, OmniboxFocusLoadsInstant); 213 FRIEND_TEST_ALL_PREFIXES(InstantTest, OmniboxFocusLoadsInstant);
214 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, UsesOverlayIfTabNotReady);
214 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, 215 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest,
215 SearchQueryNotDisplayedForNavsuggest); 216 SearchQueryNotDisplayedForNavsuggest);
216 FRIEND_TEST_ALL_PREFIXES(InstantTest, SetWithTemplateURL); 217 FRIEND_TEST_ALL_PREFIXES(InstantTest, SetWithTemplateURL);
217 FRIEND_TEST_ALL_PREFIXES(InstantTest, NonInstantSearchProvider); 218 FRIEND_TEST_ALL_PREFIXES(InstantTest, NonInstantSearchProvider);
218 FRIEND_TEST_ALL_PREFIXES(InstantTest, InstantOverlayRefresh); 219 FRIEND_TEST_ALL_PREFIXES(InstantTest, InstantOverlayRefresh);
219 FRIEND_TEST_ALL_PREFIXES(InstantTest, InstantOverlayRefreshDifferentOrder); 220 FRIEND_TEST_ALL_PREFIXES(InstantTest, InstantOverlayRefreshDifferentOrder);
220 FRIEND_TEST_ALL_PREFIXES(InstantTest, InstantRenderViewGone); 221 FRIEND_TEST_ALL_PREFIXES(InstantTest, InstantRenderViewGone);
221 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ExtendedModeIsOn); 222 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ExtendedModeIsOn);
222 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, MostVisited); 223 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, MostVisited);
223 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, RestrictedItemReadback); 224 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, RestrictedItemReadback);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/search/instant_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698