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

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

Issue 10944016: Switch SearchTabHelper to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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/search/search_delegate.cc
diff --git a/chrome/browser/ui/search/search_delegate.cc b/chrome/browser/ui/search/search_delegate.cc
index 1f873100224d86ee450c1c3f6f9c3cd1d762cfc7..05dae464275edae03a750158f123da799dd79625 100644
--- a/chrome/browser/ui/search/search_delegate.cc
+++ b/chrome/browser/ui/search/search_delegate.cc
@@ -7,7 +7,6 @@
#include "chrome/browser/ui/search/search_model.h"
#include "chrome/browser/ui/search/search_tab_helper.h"
#include "chrome/browser/ui/search/toolbar_search_animator.h"
-#include "chrome/browser/ui/tab_contents/tab_contents.h"
namespace chrome {
namespace search {
@@ -27,31 +26,33 @@ void SearchDelegate::ModeChanged(const Mode& old_mode, const Mode& new_mode) {
browser_model_->SetMode(new_mode);
}
-void SearchDelegate::OnTabActivated(TabContents* contents) {
+void SearchDelegate::OnTabActivated(content::WebContents* web_contents) {
if (tab_model_)
tab_model_->RemoveObserver(this);
- tab_model_ = contents->search_tab_helper()->model();
- DCHECK_EQ(tab_model_->tab_contents(), contents);
- browser_model_->set_tab_contents(contents);
+ tab_model_ =
+ chrome::search::SearchTabHelper::FromWebContents(web_contents)->model();
+ DCHECK_EQ(tab_model_->web_contents(), web_contents);
+ browser_model_->set_web_contents(web_contents);
browser_model_->SetMode(tab_model_->mode());
tab_model_->AddObserver(this);
}
-void SearchDelegate::OnTabDeactivated(TabContents* contents) {
- StopObserveringTab(contents);
+void SearchDelegate::OnTabDeactivated(content::WebContents* web_contents) {
+ StopObservingTab(web_contents);
}
-void SearchDelegate::OnTabDetached(TabContents* contents) {
- StopObserveringTab(contents);
+void SearchDelegate::OnTabDetached(content::WebContents* web_contents) {
+ StopObservingTab(web_contents);
}
-void SearchDelegate::StopObserveringTab(
- TabContents* contents) {
- if (contents->search_tab_helper()->model() == tab_model_) {
+void SearchDelegate::StopObservingTab(content::WebContents* web_contents) {
+ chrome::search::SearchTabHelper* search_tab_helper =
+ chrome::search::SearchTabHelper::FromWebContents(web_contents);
+ if (search_tab_helper->model() == tab_model_) {
tab_model_->RemoveObserver(this);
- browser_model_->set_tab_contents(NULL);
+ browser_model_->set_web_contents(NULL);
tab_model_ = NULL;
- toolbar_search_animator_.FinishAnimation(contents);
+ toolbar_search_animator_.FinishAnimation(web_contents);
}
}

Powered by Google App Engine
This is Rietveld 408576698