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

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

Issue 13905008: Merge local_omnibox_popup into local_ntp. Render the Google logo and fakebox if Google is the sear… (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Address Samarth's comments. Created 7 years, 8 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
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 <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // Helper for OmniboxFocusChanged. Commit or discard the overlay. 277 // Helper for OmniboxFocusChanged. Commit or discard the overlay.
278 void OmniboxLostFocus(gfx::NativeView view_gaining_focus); 278 void OmniboxLostFocus(gfx::NativeView view_gaining_focus);
279 279
280 // Creates a new NTP, using the instant_url property of the default 280 // Creates a new NTP, using the instant_url property of the default
281 // TemplateURL, or chrome::kChromeSearchLocalNTPURL if |use_local_ntp| is 281 // TemplateURL, or chrome::kChromeSearchLocalNTPURL if |use_local_ntp| is
282 // true. For |ignore_blacklist| look at comments in GetInstantURL(). 282 // true. For |ignore_blacklist| look at comments in GetInstantURL().
283 void ResetNTP(bool ignore_blacklist, bool use_local_ntp); 283 void ResetNTP(bool ignore_blacklist, bool use_local_ntp);
284 284
285 // Ensures that |overlay_| uses the Instant URL returned by GetInstantURL(), 285 // Ensures that |overlay_| uses the Instant URL returned by GetInstantURL(),
286 // creating a new overlay if necessary. In extended mode, will fallback to 286 // creating a new overlay if necessary. In extended mode, will fallback to
287 // using the kLocalOmniboxPopupURL as the Instant URL in case GetInstantURL() 287 // using the kChromeSearchLocalNtpUrl as the Instant URL in case
288 // returns false. Returns true if an Instant URL could be determined. 288 // GetInstantURL() returns false. Returns true if an Instant URL could be
289 // For |ignore_blacklist| look at comments in GetInstantURL(). 289 // determined. For |ignore_blacklist| look at comments in GetInstantURL().
290 bool EnsureOverlayIsCurrent(bool ignore_blacklist); 290 bool EnsureOverlayIsCurrent(bool ignore_blacklist);
291 291
292 // Recreates the |overlay_| with |instant_url|. Note that |overlay_| is 292 // Recreates the |overlay_| with |instant_url|. Note that |overlay_| is
293 // deleted in this call. 293 // deleted in this call.
294 void CreateOverlay(const std::string& instant_url, 294 void CreateOverlay(const std::string& instant_url,
295 const content::WebContents* active_tab); 295 const content::WebContents* active_tab);
296 296
297 // If the |overlay_| being used is in fallback mode, it will be switched back 297 // If the |overlay_| being used is in fallback mode, it will be switched back
298 // to the remote overlay if the overlay is not showing and the omnibox does 298 // to the remote overlay if the overlay is not showing and the omnibox does
299 // not have focus. 299 // not have focus.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 // Sends a collection of MostVisitedItems to the renderer process via 353 // Sends a collection of MostVisitedItems to the renderer process via
354 // the appropriate InstantPage subclass. 354 // the appropriate InstantPage subclass.
355 void SendMostVisitedItems( 355 void SendMostVisitedItems(
356 const std::vector<InstantMostVisitedItemIDPair>& items); 356 const std::vector<InstantMostVisitedItemIDPair>& items);
357 357
358 // If possible, tries to mutate |suggestion| to a valid suggestion. Returns 358 // If possible, tries to mutate |suggestion| to a valid suggestion. Returns
359 // true if successful. (Note that |suggestion| may be modified even if this 359 // true if successful. (Note that |suggestion| may be modified even if this
360 // returns false.) 360 // returns false.)
361 bool FixSuggestion(InstantSuggestion* suggestion) const; 361 bool FixSuggestion(InstantSuggestion* suggestion) const;
362 362
363 // Returns true if we should use |instant_tab_| instead of |overlay_| for
364 // handling suggestions.
365 // TODO(samarth|sreeram): this is brittle. Instead, we should probably just
366 // combine the two local pages into one.
367 bool UseInstantTabToShowSuggestions() const;
368
369 // Returns true if we should switch to using the local NTP. 363 // Returns true if we should switch to using the local NTP.
370 bool ShouldSwitchToLocalNTP() const; 364 bool ShouldSwitchToLocalNTP() const;
371 365
372 BrowserInstantController* const browser_; 366 BrowserInstantController* const browser_;
373 367
374 // Whether the extended API and regular API are enabled. If both are false, 368 // Whether the extended API and regular API are enabled. If both are false,
375 // Instant is effectively disabled. 369 // Instant is effectively disabled.
376 const bool extended_enabled_; 370 const bool extended_enabled_;
377 bool instant_enabled_; 371 bool instant_enabled_;
378 372
379 // If true, the Instant URL is set to kLocalOmniboxPopupURL. 373 // If true, the Instant URL is set to kChromeSearchLocalNtpUrl.
380 bool use_local_page_only_; 374 bool use_local_page_only_;
381 375
382 // The state of the overlay page, i.e., the page owned by |overlay_|. Ignored 376 // The state of the overlay page, i.e., the page owned by |overlay_|. Ignored
383 // if |instant_tab_| is in use. 377 // if |instant_tab_| is in use.
384 InstantOverlayModel model_; 378 InstantOverlayModel model_;
385 379
386 // The three instances of InstantPage maintained by InstantController as 380 // The three instances of InstantPage maintained by InstantController as
387 // described above. All three may be non-NULL in extended mode. If 381 // described above. All three may be non-NULL in extended mode. If
388 // |instant_tab_| is not NULL, then |overlay_| is guaranteed to be hidden and 382 // |instant_tab_| is not NULL, then |overlay_| is guaranteed to be hidden and
389 // messages will be sent to |instant_tab_| instead. 383 // messages will be sent to |instant_tab_| instead.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 // Used for Top Sites async retrieval. 464 // Used for Top Sites async retrieval.
471 base::WeakPtrFactory<InstantController> weak_ptr_factory_; 465 base::WeakPtrFactory<InstantController> weak_ptr_factory_;
472 466
473 // Used to get notifications about Most Visted changes. 467 // Used to get notifications about Most Visted changes.
474 content::NotificationRegistrar registrar_; 468 content::NotificationRegistrar registrar_;
475 469
476 DISALLOW_COPY_AND_ASSIGN(InstantController); 470 DISALLOW_COPY_AND_ASSIGN(InstantController);
477 }; 471 };
478 472
479 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ 473 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698