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

Unified Diff: chrome/browser/ui/search/search_tab_helper.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
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper.h ('k') | chrome/browser/ui/search/toolbar_search_animator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/search/search_tab_helper.cc
diff --git a/chrome/browser/ui/search/search_tab_helper.cc b/chrome/browser/ui/search/search_tab_helper.cc
index 37378103c0486ef2fae28eb85dea48b267f19042..871bd92dfc43cf271060178a6fe16c0457cae247 100644
--- a/chrome/browser/ui/search/search_tab_helper.cc
+++ b/chrome/browser/ui/search/search_tab_helper.cc
@@ -5,7 +5,8 @@
#include "chrome/browser/ui/search/search_tab_helper.h"
#include "chrome/browser/google/google_util.h"
-#include "chrome/browser/ui/tab_contents/tab_contents.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/search/search.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_details.h"
@@ -15,6 +16,8 @@
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
+int chrome::search::SearchTabHelper::kUserDataKey;
+
namespace {
bool IsNTP(const GURL& url) {
@@ -27,23 +30,24 @@ bool IsNTP(const GURL& url) {
namespace chrome {
namespace search {
-SearchTabHelper::SearchTabHelper(
- TabContents* contents,
- bool is_search_enabled)
- : WebContentsObserver(contents->web_contents()),
- is_search_enabled_(is_search_enabled),
+SearchTabHelper::SearchTabHelper(content::WebContents* web_contents)
sky 2012/09/19 00:31:07 Move implementation to match new position in heade
+ : WebContentsObserver(web_contents),
is_initial_navigation_commit_(true),
- model_(contents),
+ model_(web_contents),
ntp_load_state_(DEFAULT),
main_frame_id_(0) {
- if (!is_search_enabled)
+ Profile* profile =
sky 2012/09/19 00:31:07 Can you move determing if search is enabled to a f
Avi (use Gerrit) 2012/09/19 14:42:15 Clever! Yes, I'll do that.
+ Profile::FromBrowserContext(web_contents->GetBrowserContext());
+ is_search_enabled_ = chrome::search::IsInstantExtendedAPIEnabled(profile);
+
+ if (!is_search_enabled_)
return;
registrar_.Add(
this,
content::NOTIFICATION_NAV_ENTRY_COMMITTED,
content::Source<content::NavigationController>(
- &contents->web_contents()->GetController()));
+ &web_contents->GetController()));
}
SearchTabHelper::~SearchTabHelper() {
@@ -157,8 +161,8 @@ void SearchTabHelper::UpdateModelBasedOnURL(const GURL& url,
model_.SetMode(Mode(type, animate));
}
-content::WebContents* SearchTabHelper::web_contents() {
- return model_.tab_contents()->web_contents();
+const content::WebContents* SearchTabHelper::web_contents() const {
+ return model_.web_contents();
}
content::RenderWidgetHost* SearchTabHelper::GetRenderWidgetHost() {
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper.h ('k') | chrome/browser/ui/search/toolbar_search_animator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698