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

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: Header 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..60221d6624984fa6560baf32abbf3524231211f3 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());
@@ -2832,6 +2838,7 @@ void Browser::TabClosingAt(TabStripModel* tab_strip_model,
TabContents* contents,
int index) {
fullscreen_controller_->OnTabClosing(contents->web_contents());
+ search_delegate_->OnTabClosing(contents);
sky 2012/06/21 18:26:49 I think you want TabDetachedAt, not this.
dhollowa 2012/06/21 22:16:43 TabDetachedAt is handled below. So I've removed t
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_TAB_CLOSING,
content::Source<NavigationController>(
@@ -2848,6 +2855,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 +2901,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 +4437,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 +4804,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);
+
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