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

Unified Diff: chrome/browser/ui/browser.cc

Issue 12386019: Instant: Use only one hidden WebContents per profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index efda053694c2ffc68eee22b45643a3fb567f1d61..f672dc6092542f432f136f2e0806a8816768a903 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -59,6 +59,7 @@
#include "chrome/browser/file_select_helper.h"
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/google/google_url_tracker.h"
+#include "chrome/browser/instant/instant_controller.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/notifications/notification_ui_manager.h"
@@ -989,7 +990,7 @@ void Browser::TabDeactivated(WebContents* contents) {
window_->GetLocationBar()->SaveStateToContents(contents);
if (instant_controller_)
- instant_controller_->TabDeactivated(contents);
+ instant_controller_->instant()->TabDeactivated(contents);
}
void Browser::ActiveTabChanged(WebContents* old_contents,
@@ -1061,7 +1062,7 @@ void Browser::ActiveTabChanged(WebContents* old_contents,
// This needs to be called after UpdateSearchState().
if (instant_controller_)
- instant_controller_->ActiveTabChanged();
+ instant_controller_->instant()->ActiveTabChanged();
}
void Browser::TabMoved(WebContents* contents,
@@ -1205,18 +1206,15 @@ void Browser::ShowFirstRunBubble() {
window()->GetLocationBar()->ShowFirstRunBubble();
}
-void Browser::MaybeUpdateBookmarkBarStateForInstantPreview(
- const chrome::search::Mode& mode) {
+void Browser::MaybeUpdateBookmarkBarStateForInstantOverlay() {
// This is invoked by a platform-specific implementation of
- // |InstantPreviewController| to update bookmark bar state according to
- // instant preview state.
+ // |InstantOverlayController| to update bookmark bar state according to
+ // Instant overlay state.
// ModeChanged() updates bookmark bar state for all mode transitions except
// when new mode is |SEARCH_SUGGESTIONS|, because that needs to be done when
// the suggestions are ready.
- if (mode.is_search_suggestions() &&
- bookmark_bar_state_ == BookmarkBar::SHOW) {
+ if (bookmark_bar_state_ == BookmarkBar::SHOW)
UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE);
- }
}
///////////////////////////////////////////////////////////////////////////////
@@ -1815,8 +1813,8 @@ void Browser::Observe(int type,
void Browser::ModeChanged(const chrome::search::Mode& old_mode,
const chrome::search::Mode& new_mode) {
// If new mode is |SEARCH_SUGGESTIONS|, don't update bookmark bar state now;
- // wait till the instant preview is ready to show suggestions before hiding
- // the bookmark bar (in MaybeUpdateBookmarkBarStateForInstantPreview()).
+ // wait till the Instant overlay is ready to show suggestions before hiding
+ // the bookmark bar (in MaybeUpdateBookmarkBarStateForInstantOverlay()).
// TODO(kuan): but for now, only delay updating bookmark bar state if origin
// is |DEFAULT|; other origins require more complex logic to be implemented
// to prevent jankiness caused by hiding bookmark bar, so just hide the
@@ -1828,6 +1826,9 @@ void Browser::ModeChanged(const chrome::search::Mode& old_mode,
return;
}
UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE);
+
+ if (instant_controller_)
+ instant_controller_->instant()->SearchModeChanged(old_mode, new_mode);
}
///////////////////////////////////////////////////////////////////////////////
@@ -1977,7 +1978,6 @@ void Browser::RemoveScheduledUpdatesFor(WebContents* contents) {
scheduled_updates_.erase(i);
}
-
///////////////////////////////////////////////////////////////////////////////
// Browser, Getters for UI (private):
@@ -2147,8 +2147,10 @@ void Browser::UpdateBookmarkBarState(BookmarkBarStateChangeReason reason) {
// Inform NTP page of change in bookmark bar state, so that it can adjust the
// theme image top offset if necessary.
- if (instant_controller_)
- instant_controller_->UpdateThemeInfo(true);
+ if (instant_controller_) {
+ instant_controller_->instant()->BookmarkBarStateChanged(
+ bookmark_bar_state_ == BookmarkBar::DETACHED);
+ }
if (!window_)
return; // This is called from the constructor when window_ is NULL.

Powered by Google App Engine
This is Rietveld 408576698