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

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

Issue 10644002: Add core plumbing for Instant Extended work (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed UI stuff from SearchModel Created 8 years, 6 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 9e3fdc5a78ce0ab551a603950e19e178a23bf904..8a671f080d956136d86a23774e9cc57eed6cdf89 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -119,6 +119,9 @@
#include "chrome/browser/ui/omnibox/location_bar.h"
#include "chrome/browser/ui/panels/panel.h"
#include "chrome/browser/ui/panels/panel_manager.h"
+#include "chrome/browser/ui/search/search.h"
+#include "chrome/browser/ui/search/search_delegate.h"
+#include "chrome/browser/ui/search/search_model.h"
#include "chrome/browser/ui/search_engines/search_engine_tab_helper.h"
#include "chrome/browser/ui/status_bubble.h"
#include "chrome/browser/ui/sync/browser_synced_window_delegate.h"
@@ -374,6 +377,9 @@ Browser::Browser(Type type, Profile* profile)
tab_strip_model_->AddObserver(this);
toolbar_model_.reset(new ToolbarModel(toolbar_model_delegate_.get()));
+ search_model_.reset(new chrome::search::SearchModel(NULL));
+ search_delegate_.reset(
+ new chrome::search::SearchDelegate(search_model_.get()));
registrar_.Add(this, content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED,
content::NotificationService::AllSources());
@@ -2848,6 +2854,8 @@ void Browser::TabDetachedAt(TabContents* contents, int index) {
void Browser::TabDeactivated(TabContents* contents) {
fullscreen_controller_->OnTabDeactivated(contents);
+ search_delegate_->OnTabDeactivated(contents);
+
if (instant())
instant()->Hide();
@@ -2892,6 +2900,9 @@ void Browser::ActiveTabChanged(TabContents* old_contents,
// Propagate the profile to the location bar.
UpdateToolbar(true);
+ // Propagate tab state to toolbar, tab-strip, etc.
+ UpdateSearchState(new_contents);
+
// Update reload/stop state.
UpdateReloadStopState(new_contents->web_contents()->IsLoading(), true);
@@ -4425,6 +4436,11 @@ void Browser::UpdateToolbar(bool should_restore_state) {
window_->UpdateToolbar(GetActiveTabContents(), should_restore_state);
}
+void Browser::UpdateSearchState(TabContents* contents) {
+ if (chrome::search::IsInstantExtendedAPIEnabled(profile_))
+ search_delegate_->OnTabActivated(contents);
+}
+
void Browser::ScheduleUIUpdate(const WebContents* source,
unsigned changed_flags) {
if (!source)
@@ -4787,6 +4803,9 @@ void Browser::TabDetachedAtImpl(TabContents* contents, int index,
ClearUnloadState(contents->web_contents(), false);
}
+ // Stop observing search model changes for this tab.
+ search_delegate_->OnTabDettached(contents);
sky 2012/06/21 22:52:49 OnTabDetached
dhollowa 2012/06/21 23:53:42 Done.
+
registrar_.Remove(this, content::NOTIFICATION_INTERSTITIAL_ATTACHED,
content::Source<WebContents>(contents->web_contents()));
registrar_.Remove(this, content::NOTIFICATION_INTERSTITIAL_DETACHED,

Powered by Google App Engine
This is Rietveld 408576698