| Index: chrome/browser/ui/browser.cc
|
| diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
|
| index 9e3fdc5a78ce0ab551a603950e19e178a23bf904..19832cbb2a24930abe11dd27b7531888da819644 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_->OnTabDetached(contents);
|
| +
|
| registrar_.Remove(this, content::NOTIFICATION_INTERSTITIAL_ATTACHED,
|
| content::Source<WebContents>(contents->web_contents()));
|
| registrar_.Remove(this, content::NOTIFICATION_INTERSTITIAL_DETACHED,
|
|
|