summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordharani@google.com <dharani@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-28 17:00:14 +0000
committerdharani@google.com <dharani@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-28 17:00:14 +0000
commit3f735995e6a2ed67cb0d4b01b50b058da1179a38 (patch)
treebfb3cb8f485e29ad302662c2662f5374c4df3b5e
parent05adeba6452d76ab39c0c407660df9ec4291e0f7 (diff)
downloadchromium_src-3f735995e6a2ed67cb0d4b01b50b058da1179a38.zip
chromium_src-3f735995e6a2ed67cb0d4b01b50b058da1179a38.tar.gz
chromium_src-3f735995e6a2ed67cb0d4b01b50b058da1179a38.tar.bz2
Revert 159158 - Make using WebContentsUserData simpler.
BUG=107201 TEST=no visible change Reverted due to bug 152950 Review URL: https://chromiumcodereview.appspot.com/10993064 TBR=avi@chromium.org Review URL: https://codereview.chromium.org/10990113 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159277 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/automation/automation_tab_helper.cc2
-rw-r--r--chrome/browser/automation/automation_tab_helper.h3
-rw-r--r--chrome/browser/captive_portal/captive_portal_tab_helper.cc4
-rw-r--r--chrome/browser/captive_portal/captive_portal_tab_helper.h1
-rw-r--r--chrome/browser/common/web_contents_user_data.h24
-rw-r--r--chrome/browser/common/web_contents_user_data_unittest.cc10
-rw-r--r--chrome/browser/extensions/api/web_navigation/web_navigation_api.cc4
-rw-r--r--chrome/browser/extensions/api/web_navigation/web_navigation_api.h1
-rw-r--r--chrome/browser/extensions/tab_helper.cc4
-rw-r--r--chrome/browser/extensions/tab_helper.h1
-rw-r--r--chrome/browser/external_protocol/external_protocol_observer.cc2
-rw-r--r--chrome/browser/external_protocol/external_protocol_observer.h1
-rw-r--r--chrome/browser/net/load_time_stats.cc4
-rw-r--r--chrome/browser/net/load_time_stats.h1
-rw-r--r--chrome/browser/omnibox_search_hint.cc2
-rw-r--r--chrome/browser/omnibox_search_hint.h1
-rw-r--r--chrome/browser/pepper_broker_observer.cc2
-rw-r--r--chrome/browser/pepper_broker_observer.h1
-rw-r--r--chrome/browser/plugins/plugin_observer.cc2
-rw-r--r--chrome/browser/plugins/plugin_observer.h1
-rw-r--r--chrome/browser/printing/print_preview_message_handler.cc2
-rw-r--r--chrome/browser/printing/print_preview_message_handler.h1
-rw-r--r--chrome/browser/printing/print_view_manager.cc2
-rw-r--r--chrome/browser/printing/print_view_manager.h1
-rw-r--r--chrome/browser/sessions/session_tab_helper.cc2
-rw-r--r--chrome/browser/sessions/session_tab_helper.h1
-rw-r--r--chrome/browser/ssl/ssl_tab_helper.cc2
-rw-r--r--chrome/browser/ssl/ssl_tab_helper.h1
-rw-r--r--chrome/browser/tab_contents/navigation_metrics_recorder.cc2
-rw-r--r--chrome/browser/tab_contents/navigation_metrics_recorder.h3
-rw-r--r--chrome/browser/tab_contents/web_contents_user_data.h8
-rw-r--r--chrome/browser/ui/alternate_error_tab_observer.cc2
-rw-r--r--chrome/browser/ui/alternate_error_tab_observer.h1
-rw-r--r--chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc2
-rw-r--r--chrome/browser/ui/blocked_content/blocked_content_tab_helper.h1
-rw-r--r--chrome/browser/ui/bookmarks/bookmark_tab_helper.cc2
-rw-r--r--chrome/browser/ui/bookmarks/bookmark_tab_helper.h1
-rw-r--r--chrome/browser/ui/hung_plugin_tab_helper.cc2
-rw-r--r--chrome/browser/ui/hung_plugin_tab_helper.h1
-rw-r--r--chrome/browser/ui/intents/web_intent_picker_controller.cc2
-rw-r--r--chrome/browser/ui/intents/web_intent_picker_controller.h1
-rw-r--r--chrome/browser/ui/metro_pin_tab_helper.cc2
-rw-r--r--chrome/browser/ui/metro_pin_tab_helper.h1
-rw-r--r--chrome/browser/ui/pdf/pdf_tab_helper.cc2
-rw-r--r--chrome/browser/ui/pdf/pdf_tab_helper.h1
-rw-r--r--chrome/browser/ui/sad_tab_helper.cc2
-rw-r--r--chrome/browser/ui/sad_tab_helper.h1
-rw-r--r--chrome/browser/ui/search/search_tab_helper.cc2
-rw-r--r--chrome/browser/ui/search/search_tab_helper.h1
-rw-r--r--chrome/browser/ui/search_engines/search_engine_tab_helper.cc2
-rw-r--r--chrome/browser/ui/search_engines/search_engine_tab_helper.h1
-rw-r--r--chrome/browser/ui/snapshot_tab_helper.cc2
-rw-r--r--chrome/browser/ui/snapshot_tab_helper.h1
-rw-r--r--chrome/browser/ui/sync/one_click_signin_helper.cc2
-rw-r--r--chrome/browser/ui/sync/one_click_signin_helper.h1
-rw-r--r--chrome/browser/ui/tab_contents/core_tab_helper.cc2
-rw-r--r--chrome/browser/ui/tab_contents/core_tab_helper.h1
-rw-r--r--chrome/browser/ui/zoom/zoom_controller.cc2
-rw-r--r--chrome/browser/ui/zoom/zoom_controller.h1
59 files changed, 83 insertions, 55 deletions
diff --git a/chrome/browser/automation/automation_tab_helper.cc b/chrome/browser/automation/automation_tab_helper.cc
index 25d2c9b..a77836e 100644
--- a/chrome/browser/automation/automation_tab_helper.cc
+++ b/chrome/browser/automation/automation_tab_helper.cc
@@ -14,7 +14,7 @@
using content::WebContents;
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(AutomationTabHelper)
+int AutomationTabHelper::kUserDataKey;
TabEventObserver::TabEventObserver() { }
diff --git a/chrome/browser/automation/automation_tab_helper.h b/chrome/browser/automation/automation_tab_helper.h
index 8008864..0cfcbbf 100644
--- a/chrome/browser/automation/automation_tab_helper.h
+++ b/chrome/browser/automation/automation_tab_helper.h
@@ -11,7 +11,7 @@
#include "base/basictypes.h"
#include "base/observer_list.h"
#include "base/memory/weak_ptr.h"
-#include "chrome/browser/common/web_contents_user_data.h"
+#include "chrome/browser/tab_contents/web_contents_user_data.h"
#include "content/public/browser/web_contents_observer.h"
class AutomationTabHelper;
@@ -99,6 +99,7 @@ class AutomationTabHelper
private:
explicit AutomationTabHelper(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<AutomationTabHelper>;
friend class AutomationTabHelperTest;
diff --git a/chrome/browser/captive_portal/captive_portal_tab_helper.cc b/chrome/browser/captive_portal/captive_portal_tab_helper.cc
index 797ab24..4108f12b2 100644
--- a/chrome/browser/captive_portal/captive_portal_tab_helper.cc
+++ b/chrome/browser/captive_portal/captive_portal_tab_helper.cc
@@ -25,10 +25,10 @@
#include "net/base/net_errors.h"
#include "net/base/ssl_info.h"
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(captive_portal::CaptivePortalTabHelper)
-
namespace captive_portal {
+int CaptivePortalTabHelper::kUserDataKey;
+
CaptivePortalTabHelper::CaptivePortalTabHelper(
content::WebContents* web_contents)
: content::WebContentsObserver(web_contents),
diff --git a/chrome/browser/captive_portal/captive_portal_tab_helper.h b/chrome/browser/captive_portal/captive_portal_tab_helper.h
index c515874..9ddf554 100644
--- a/chrome/browser/captive_portal/captive_portal_tab_helper.h
+++ b/chrome/browser/captive_portal/captive_portal_tab_helper.h
@@ -104,6 +104,7 @@ class CaptivePortalTabHelper
friend class CaptivePortalTabHelperTest;
friend class WebContentsUserData<CaptivePortalTabHelper>;
+ static int kUserDataKey;
explicit CaptivePortalTabHelper(content::WebContents* web_contents);
// Called by Observe in response to the corresponding event.
diff --git a/chrome/browser/common/web_contents_user_data.h b/chrome/browser/common/web_contents_user_data.h
index 364997e..2cffb58 100644
--- a/chrome/browser/common/web_contents_user_data.h
+++ b/chrome/browser/common/web_contents_user_data.h
@@ -18,11 +18,12 @@
// // ... more public stuff here ...
// private:
// explicit FooTabHelper(content::WebContents* contents);
+// static int kUserDataKey;
// friend class WebContentsUserData<FooTabHelper>;
// // ... more private stuff here ...
// }
// --- in foo_tab_helper.cc ---
-// DEFINE_WEB_CONTENTS_USER_DATA_KEY(FooTabHelper)
+// int FooTabHelper::kUserDataKey;
//
template <typename T>
class WebContentsUserData : public base::SupportsUserData::Data {
@@ -31,33 +32,18 @@ class WebContentsUserData : public base::SupportsUserData::Data {
// If an instance is already attached, does nothing.
static void CreateForWebContents(content::WebContents* contents) {
if (!FromWebContents(contents))
- contents->SetUserData(&kLocatorKey, new T(contents));
+ contents->SetUserData(&T::kUserDataKey, new T(contents));
}
// Retrieves the instance of type T that was attached to the specified
// WebContents (via CreateForWebContents above) and returns it. If no instance
// of the type was attached, returns NULL.
static T* FromWebContents(content::WebContents* contents) {
- return static_cast<T*>(contents->GetUserData(&kLocatorKey));
+ return static_cast<T*>(contents->GetUserData(&T::kUserDataKey));
}
static const T* FromWebContents(const content::WebContents* contents) {
- return static_cast<const T*>(contents->GetUserData(&kLocatorKey));
+ return static_cast<const T*>(contents->GetUserData(&T::kUserDataKey));
}
-
- // The user data key.
- static int kLocatorKey;
};
-// The macro to define the locator key. This key must be defined in the .cc file
-// of the tab helper otherwise different instances for different template types
-// will be collapsed by the Visual Studio linker.
-//
-// The "= 0" is surprising, but is required to effect a definition rather than
-// a declaration. Without it, this would be merely a declaration of a template
-// specialization. (C++98: 14.7.3.15; C++11: 14.7.3.13)
-//
-#define DEFINE_WEB_CONTENTS_USER_DATA_KEY(TYPE) \
-template<> \
-int WebContentsUserData<TYPE>::kLocatorKey = 0;
-
#endif // CHROME_BROWSER_COMMON_WEB_CONTENTS_USER_DATA_H_
diff --git a/chrome/browser/common/web_contents_user_data_unittest.cc b/chrome/browser/common/web_contents_user_data_unittest.cc
index 1ee3a6a..cb35bac 100644
--- a/chrome/browser/common/web_contents_user_data_unittest.cc
+++ b/chrome/browser/common/web_contents_user_data_unittest.cc
@@ -11,12 +11,15 @@
#include "content/public/test/web_contents_tester.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace {
+
class WebContentsAttachedClass1
: public WebContentsUserData<WebContentsAttachedClass1> {
public:
virtual ~WebContentsAttachedClass1() {}
private:
explicit WebContentsAttachedClass1(content::WebContents* contents) {}
+ static int kUserDataKey;
friend class WebContentsUserData<WebContentsAttachedClass1>;
};
@@ -26,11 +29,14 @@ class WebContentsAttachedClass2
virtual ~WebContentsAttachedClass2() {}
private:
explicit WebContentsAttachedClass2(content::WebContents* contents) {}
+ static int kUserDataKey;
friend class WebContentsUserData<WebContentsAttachedClass2>;
};
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(WebContentsAttachedClass1)
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(WebContentsAttachedClass2)
+int WebContentsAttachedClass1::kUserDataKey;
+int WebContentsAttachedClass2::kUserDataKey;
+
+} // namespace
typedef ChromeRenderViewHostTestHarness WebContentsUserDataTest;
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
index 1b1e2f1..ed19fcf 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
@@ -31,8 +31,6 @@
namespace GetFrame = extensions::api::web_navigation::GetFrame;
namespace GetAllFrames = extensions::api::web_navigation::GetAllFrames;
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(extensions::WebNavigationTabObserver)
-
namespace extensions {
namespace helpers = web_navigation_api_helpers;
@@ -255,6 +253,8 @@ void WebNavigationEventRouter::TabDestroyed(content::WebContents* tab) {
// WebNavigationTabObserver ------------------------------------------
+int WebNavigationTabObserver::kUserDataKey;
+
WebNavigationTabObserver::WebNavigationTabObserver(
content::WebContents* web_contents)
: WebContentsObserver(web_contents),
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.h b/chrome/browser/extensions/api/web_navigation/web_navigation_api.h
index 6503a72..196a785 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.h
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.h
@@ -97,6 +97,7 @@ class WebNavigationTabObserver
private:
explicit WebNavigationTabObserver(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<WebNavigationTabObserver>;
// True if the transition and target url correspond to a reference fragment
diff --git a/chrome/browser/extensions/tab_helper.cc b/chrome/browser/extensions/tab_helper.cc
index bd0a74f..4c5521f 100644
--- a/chrome/browser/extensions/tab_helper.cc
+++ b/chrome/browser/extensions/tab_helper.cc
@@ -45,8 +45,6 @@ using content::NavigationEntry;
using content::RenderViewHost;
using content::WebContents;
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(extensions::TabHelper)
-
namespace {
const char kPermissionError[] = "permission_error";
@@ -55,6 +53,8 @@ const char kPermissionError[] = "permission_error";
namespace extensions {
+int TabHelper::kUserDataKey;
+
TabHelper::ContentScriptObserver::ContentScriptObserver(TabHelper* tab_helper)
: tab_helper_(tab_helper) {
tab_helper_->AddContentScriptObserver(this);
diff --git a/chrome/browser/extensions/tab_helper.h b/chrome/browser/extensions/tab_helper.h
index ed5563f..9540029 100644
--- a/chrome/browser/extensions/tab_helper.h
+++ b/chrome/browser/extensions/tab_helper.h
@@ -145,6 +145,7 @@ class TabHelper : public content::WebContentsObserver,
private:
explicit TabHelper(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<TabHelper>;
// content::WebContentsObserver overrides.
diff --git a/chrome/browser/external_protocol/external_protocol_observer.cc b/chrome/browser/external_protocol/external_protocol_observer.cc
index 082dc17..e13e121 100644
--- a/chrome/browser/external_protocol/external_protocol_observer.cc
+++ b/chrome/browser/external_protocol/external_protocol_observer.cc
@@ -8,7 +8,7 @@
using content::WebContents;
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(ExternalProtocolObserver)
+int ExternalProtocolObserver::kUserDataKey;
ExternalProtocolObserver::ExternalProtocolObserver(WebContents* web_contents)
: content::WebContentsObserver(web_contents) {
diff --git a/chrome/browser/external_protocol/external_protocol_observer.h b/chrome/browser/external_protocol/external_protocol_observer.h
index 3cab5ed..b967cb5 100644
--- a/chrome/browser/external_protocol/external_protocol_observer.h
+++ b/chrome/browser/external_protocol/external_protocol_observer.h
@@ -21,6 +21,7 @@ class ExternalProtocolObserver
private:
explicit ExternalProtocolObserver(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<ExternalProtocolObserver>;
DISALLOW_COPY_AND_ASSIGN(ExternalProtocolObserver);
diff --git a/chrome/browser/net/load_time_stats.cc b/chrome/browser/net/load_time_stats.cc
index 4062524..c1b2491 100644
--- a/chrome/browser/net/load_time_stats.cc
+++ b/chrome/browser/net/load_time_stats.cc
@@ -23,8 +23,6 @@ using content::RenderViewHost;
using content::ResourceRequestInfo;
using std::string;
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(chrome_browser_net::LoadTimeStatsTabHelper)
-
namespace {
bool GetRenderView(const net::URLRequest& request,
@@ -256,6 +254,8 @@ class LoadTimeStats::URLRequestStats {
base::TimeDelta status_times_[REQUEST_STATUS_MAX];
};
+int LoadTimeStatsTabHelper::kUserDataKey;
+
LoadTimeStatsTabHelper::LoadTimeStatsTabHelper(
content::WebContents* web_contents)
: content::WebContentsObserver(web_contents) {
diff --git a/chrome/browser/net/load_time_stats.h b/chrome/browser/net/load_time_stats.h
index a1aef07..6d37c41 100644
--- a/chrome/browser/net/load_time_stats.h
+++ b/chrome/browser/net/load_time_stats.h
@@ -137,6 +137,7 @@ class LoadTimeStatsTabHelper
private:
explicit LoadTimeStatsTabHelper(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<LoadTimeStatsTabHelper>;
// Calls into LoadTimeStats to notify that a reportable event has occurred
diff --git a/chrome/browser/omnibox_search_hint.cc b/chrome/browser/omnibox_search_hint.cc
index 60172f2..93b5cf1 100644
--- a/chrome/browser/omnibox_search_hint.cc
+++ b/chrome/browser/omnibox_search_hint.cc
@@ -42,7 +42,7 @@
using content::NavigationController;
using content::NavigationEntry;
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(OmniboxSearchHint)
+int OmniboxSearchHint::kUserDataKey;
// The URLs of search engines for which we want to trigger the infobar.
const char* const kSearchEngineURLs[] = {
diff --git a/chrome/browser/omnibox_search_hint.h b/chrome/browser/omnibox_search_hint.h
index 1fbcac1..cc2b6e17 100644
--- a/chrome/browser/omnibox_search_hint.h
+++ b/chrome/browser/omnibox_search_hint.h
@@ -47,6 +47,7 @@ class OmniboxSearchHint : public content::NotificationObserver,
private:
explicit OmniboxSearchHint(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<OmniboxSearchHint>;
void ShowInfoBar();
diff --git a/chrome/browser/pepper_broker_observer.cc b/chrome/browser/pepper_broker_observer.cc
index c78bf09..614c06b 100644
--- a/chrome/browser/pepper_broker_observer.cc
+++ b/chrome/browser/pepper_broker_observer.cc
@@ -31,7 +31,7 @@ using content::OpenURLParams;
using content::Referrer;
using content::WebContents;
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(PepperBrokerObserver)
+int PepperBrokerObserver::kUserDataKey;
namespace {
diff --git a/chrome/browser/pepper_broker_observer.h b/chrome/browser/pepper_broker_observer.h
index 906215d..027271b 100644
--- a/chrome/browser/pepper_broker_observer.h
+++ b/chrome/browser/pepper_broker_observer.h
@@ -15,6 +15,7 @@ class PepperBrokerObserver : public content::WebContentsObserver,
private:
explicit PepperBrokerObserver(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<PepperBrokerObserver>;
virtual bool RequestPpapiBrokerPermission(
diff --git a/chrome/browser/plugins/plugin_observer.cc b/chrome/browser/plugins/plugin_observer.cc
index 395678d..955735d 100644
--- a/chrome/browser/plugins/plugin_observer.cc
+++ b/chrome/browser/plugins/plugin_observer.cc
@@ -46,7 +46,7 @@ using content::PluginService;
using content::Referrer;
using content::WebContents;
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(PluginObserver)
+int PluginObserver::kUserDataKey;
namespace {
diff --git a/chrome/browser/plugins/plugin_observer.h b/chrome/browser/plugins/plugin_observer.h
index 2f2a2be..a0ae687 100644
--- a/chrome/browser/plugins/plugin_observer.h
+++ b/chrome/browser/plugins/plugin_observer.h
@@ -39,6 +39,7 @@ class PluginObserver : public content::WebContentsObserver,
private:
explicit PluginObserver(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<PluginObserver>;
class PluginPlaceholderHost;
diff --git a/chrome/browser/printing/print_preview_message_handler.cc b/chrome/browser/printing/print_preview_message_handler.cc
index 2dd376d..a861023 100644
--- a/chrome/browser/printing/print_preview_message_handler.cc
+++ b/chrome/browser/printing/print_preview_message_handler.cc
@@ -28,7 +28,7 @@
using content::BrowserThread;
using content::WebContents;
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(printing::PrintPreviewMessageHandler)
+int printing::PrintPreviewMessageHandler::kUserDataKey;
namespace {
diff --git a/chrome/browser/printing/print_preview_message_handler.h b/chrome/browser/printing/print_preview_message_handler.h
index 4b4d305..304437b 100644
--- a/chrome/browser/printing/print_preview_message_handler.h
+++ b/chrome/browser/printing/print_preview_message_handler.h
@@ -35,6 +35,7 @@ class PrintPreviewMessageHandler
private:
explicit PrintPreviewMessageHandler(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<PrintPreviewMessageHandler>;
// Gets the print preview tab associated with the WebContents being observed.
diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc
index ed57b69..42621a3 100644
--- a/chrome/browser/printing/print_view_manager.cc
+++ b/chrome/browser/printing/print_view_manager.cc
@@ -45,7 +45,7 @@
using base::TimeDelta;
using content::BrowserThread;
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(printing::PrintViewManager)
+int printing::PrintViewManager::kUserDataKey;
namespace {
diff --git a/chrome/browser/printing/print_view_manager.h b/chrome/browser/printing/print_view_manager.h
index 1eb4a62..709be49 100644
--- a/chrome/browser/printing/print_view_manager.h
+++ b/chrome/browser/printing/print_view_manager.h
@@ -100,6 +100,7 @@ class PrintViewManager : public content::NotificationObserver,
private:
explicit PrintViewManager(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<PrintViewManager>;
enum PrintPreviewState {
diff --git a/chrome/browser/sessions/session_tab_helper.cc b/chrome/browser/sessions/session_tab_helper.cc
index afa9962..bf6a092 100644
--- a/chrome/browser/sessions/session_tab_helper.cc
+++ b/chrome/browser/sessions/session_tab_helper.cc
@@ -14,7 +14,7 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(SessionTabHelper)
+int SessionTabHelper::kUserDataKey;
SessionTabHelper::SessionTabHelper(content::WebContents* contents)
: content::WebContentsObserver(contents) {
diff --git a/chrome/browser/sessions/session_tab_helper.h b/chrome/browser/sessions/session_tab_helper.h
index 5c2ae22..dbc9bf1 100644
--- a/chrome/browser/sessions/session_tab_helper.h
+++ b/chrome/browser/sessions/session_tab_helper.h
@@ -31,6 +31,7 @@ class SessionTabHelper : public content::WebContentsObserver,
private:
explicit SessionTabHelper(content::WebContents* contents);
+ static int kUserDataKey;
friend class WebContentsUserData<SessionTabHelper>;
// Unique identifier of the tab for session restore. This id is only unique
diff --git a/chrome/browser/ssl/ssl_tab_helper.cc b/chrome/browser/ssl/ssl_tab_helper.cc
index 932be4b..76980c6 100644
--- a/chrome/browser/ssl/ssl_tab_helper.cc
+++ b/chrome/browser/ssl/ssl_tab_helper.cc
@@ -181,7 +181,7 @@ void SSLTabHelper::SSLAddCertData::Observe(
// SSLTabHelper ----------------------------------------------------------------
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(SSLTabHelper)
+int SSLTabHelper::kUserDataKey;
SSLTabHelper::SSLTabHelper(content::WebContents* contents)
: web_contents_(contents) {
diff --git a/chrome/browser/ssl/ssl_tab_helper.h b/chrome/browser/ssl/ssl_tab_helper.h
index 2c654d0b..4a3c5ce 100644
--- a/chrome/browser/ssl/ssl_tab_helper.h
+++ b/chrome/browser/ssl/ssl_tab_helper.h
@@ -59,6 +59,7 @@ class SSLTabHelper : public WebContentsUserData<SSLTabHelper> {
private:
explicit SSLTabHelper(content::WebContents* contents);
+ static int kUserDataKey;
friend class WebContentsUserData<SSLTabHelper>;
content::WebContents* web_contents_;
diff --git a/chrome/browser/tab_contents/navigation_metrics_recorder.cc b/chrome/browser/tab_contents/navigation_metrics_recorder.cc
index dd8139c..f2ec31c 100644
--- a/chrome/browser/tab_contents/navigation_metrics_recorder.cc
+++ b/chrome/browser/tab_contents/navigation_metrics_recorder.cc
@@ -8,7 +8,7 @@
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h"
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(NavigationMetricsRecorder)
+int NavigationMetricsRecorder::kUserDataKey;
namespace {
diff --git a/chrome/browser/tab_contents/navigation_metrics_recorder.h b/chrome/browser/tab_contents/navigation_metrics_recorder.h
index 7401eec..298caaf 100644
--- a/chrome/browser/tab_contents/navigation_metrics_recorder.h
+++ b/chrome/browser/tab_contents/navigation_metrics_recorder.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_METRICS_RECORDER_H_
#define CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_METRICS_RECORDER_H_
-#include "chrome/browser/common/web_contents_user_data.h"
+#include "chrome/browser/tab_contents/web_contents_user_data.h"
#include "content/public/browser/web_contents_observer.h"
class NavigationMetricsRecorder
@@ -16,6 +16,7 @@ class NavigationMetricsRecorder
private:
explicit NavigationMetricsRecorder(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<NavigationMetricsRecorder>;
// content::WebContentsObserver overrides:
diff --git a/chrome/browser/tab_contents/web_contents_user_data.h b/chrome/browser/tab_contents/web_contents_user_data.h
new file mode 100644
index 0000000..c2a0eb0
--- /dev/null
+++ b/chrome/browser/tab_contents/web_contents_user_data.h
@@ -0,0 +1,8 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// TODO(avi): Remove this forwarding header once all the patches straggling
+// through the CQ are committed.
+
+#include "chrome/browser/common/web_contents_user_data.h"
diff --git a/chrome/browser/ui/alternate_error_tab_observer.cc b/chrome/browser/ui/alternate_error_tab_observer.cc
index 73347f4..56ce220 100644
--- a/chrome/browser/ui/alternate_error_tab_observer.cc
+++ b/chrome/browser/ui/alternate_error_tab_observer.cc
@@ -16,7 +16,7 @@
using content::RenderViewHost;
using content::WebContents;
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(AlternateErrorPageTabObserver)
+int AlternateErrorPageTabObserver::kUserDataKey;
AlternateErrorPageTabObserver::AlternateErrorPageTabObserver(
WebContents* web_contents)
diff --git a/chrome/browser/ui/alternate_error_tab_observer.h b/chrome/browser/ui/alternate_error_tab_observer.h
index 9bd116ecdf..e67770f 100644
--- a/chrome/browser/ui/alternate_error_tab_observer.h
+++ b/chrome/browser/ui/alternate_error_tab_observer.h
@@ -26,6 +26,7 @@ class AlternateErrorPageTabObserver
private:
explicit AlternateErrorPageTabObserver(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<AlternateErrorPageTabObserver>;
// content::WebContentsObserver overrides:
diff --git a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc
index b1672ae..e005ba7 100644
--- a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc
+++ b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc
@@ -23,7 +23,7 @@
using content::NavigationEntry;
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(BlockedContentTabHelper)
+int BlockedContentTabHelper::kUserDataKey;
BlockedContentTabHelper::BlockedContentTabHelper(
content::WebContents* web_contents)
diff --git a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.h b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.h
index c07c8ca..88b14a1 100644
--- a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.h
+++ b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.h
@@ -62,6 +62,7 @@ class BlockedContentTabHelper
private:
explicit BlockedContentTabHelper(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<BlockedContentTabHelper>;
// Called when the blocked popup notification is shown or hidden.
diff --git a/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc b/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc
index 0226cfb..e2b08fe 100644
--- a/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc
+++ b/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc
@@ -16,7 +16,7 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/web_contents.h"
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(BookmarkTabHelper)
+int BookmarkTabHelper::kUserDataKey;
namespace {
diff --git a/chrome/browser/ui/bookmarks/bookmark_tab_helper.h b/chrome/browser/ui/bookmarks/bookmark_tab_helper.h
index 4024a82..022a414 100644
--- a/chrome/browser/ui/bookmarks/bookmark_tab_helper.h
+++ b/chrome/browser/ui/bookmarks/bookmark_tab_helper.h
@@ -66,6 +66,7 @@ class BookmarkTabHelper : public content::NotificationObserver,
private:
explicit BookmarkTabHelper(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<BookmarkTabHelper>;
// Updates the starred state from the bookmark bar model. If the state has
diff --git a/chrome/browser/ui/hung_plugin_tab_helper.cc b/chrome/browser/ui/hung_plugin_tab_helper.cc
index 8dd7257..26dc863 100644
--- a/chrome/browser/ui/hung_plugin_tab_helper.cc
+++ b/chrome/browser/ui/hung_plugin_tab_helper.cc
@@ -36,7 +36,7 @@
#include "chrome/browser/hang_monitor/hang_crash_dump_win.h"
#endif
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(HungPluginTabHelper)
+int HungPluginTabHelper::kUserDataKey;
namespace {
diff --git a/chrome/browser/ui/hung_plugin_tab_helper.h b/chrome/browser/ui/hung_plugin_tab_helper.h
index 3518739..bdf6a60 100644
--- a/chrome/browser/ui/hung_plugin_tab_helper.h
+++ b/chrome/browser/ui/hung_plugin_tab_helper.h
@@ -51,6 +51,7 @@ class HungPluginTabHelper : public content::WebContentsObserver,
private:
explicit HungPluginTabHelper(content::WebContents* contents);
+ static int kUserDataKey;
friend class WebContentsUserData<HungPluginTabHelper>;
class InfoBarDelegate;
diff --git a/chrome/browser/ui/intents/web_intent_picker_controller.cc b/chrome/browser/ui/intents/web_intent_picker_controller.cc
index bdba7c8..51f78f0 100644
--- a/chrome/browser/ui/intents/web_intent_picker_controller.cc
+++ b/chrome/browser/ui/intents/web_intent_picker_controller.cc
@@ -57,7 +57,7 @@
using extensions::WebstoreInstaller;
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(WebIntentPickerController)
+int WebIntentPickerController::kUserDataKey;
namespace {
diff --git a/chrome/browser/ui/intents/web_intent_picker_controller.h b/chrome/browser/ui/intents/web_intent_picker_controller.h
index 6f479bb..d5bf823 100644
--- a/chrome/browser/ui/intents/web_intent_picker_controller.h
+++ b/chrome/browser/ui/intents/web_intent_picker_controller.h
@@ -120,6 +120,7 @@ class WebIntentPickerController
private:
explicit WebIntentPickerController(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<WebIntentPickerController>;
friend class WebIntentPickerControllerTest;
diff --git a/chrome/browser/ui/metro_pin_tab_helper.cc b/chrome/browser/ui/metro_pin_tab_helper.cc
index 7644355..187e44d 100644
--- a/chrome/browser/ui/metro_pin_tab_helper.cc
+++ b/chrome/browser/ui/metro_pin_tab_helper.cc
@@ -12,7 +12,7 @@
#include "base/win/metro.h"
#endif
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(MetroPinTabHelper)
+int MetroPinTabHelper::kUserDataKey;
MetroPinTabHelper::MetroPinTabHelper(content::WebContents* web_contents)
: content::WebContentsObserver(web_contents),
diff --git a/chrome/browser/ui/metro_pin_tab_helper.h b/chrome/browser/ui/metro_pin_tab_helper.h
index 450c8e3f..a78af83 100644
--- a/chrome/browser/ui/metro_pin_tab_helper.h
+++ b/chrome/browser/ui/metro_pin_tab_helper.h
@@ -25,6 +25,7 @@ class MetroPinTabHelper : public content::WebContentsObserver,
private:
explicit MetroPinTabHelper(content::WebContents* tab_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<MetroPinTabHelper>;
// Queries the metro driver about the pinned state of the current URL.
diff --git a/chrome/browser/ui/pdf/pdf_tab_helper.cc b/chrome/browser/ui/pdf/pdf_tab_helper.cc
index 161a2e9..5b4ad47 100644
--- a/chrome/browser/ui/pdf/pdf_tab_helper.cc
+++ b/chrome/browser/ui/pdf/pdf_tab_helper.cc
@@ -13,7 +13,7 @@
#include "chrome/common/render_messages.h"
#include "content/public/browser/navigation_details.h"
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(PDFTabHelper)
+int PDFTabHelper::kUserDataKey;
PDFTabHelper::PDFTabHelper(content::WebContents* web_contents)
: content::WebContentsObserver(web_contents) {
diff --git a/chrome/browser/ui/pdf/pdf_tab_helper.h b/chrome/browser/ui/pdf/pdf_tab_helper.h
index 17ad5ef..a7d51c9 100644
--- a/chrome/browser/ui/pdf/pdf_tab_helper.h
+++ b/chrome/browser/ui/pdf/pdf_tab_helper.h
@@ -19,6 +19,7 @@ class WebContents;
class PDFTabHelper : public content::WebContentsObserver,
public WebContentsUserData<PDFTabHelper> {
public:
+ static int kUserDataKey;
explicit PDFTabHelper(content::WebContents* web_contents);
virtual ~PDFTabHelper();
diff --git a/chrome/browser/ui/sad_tab_helper.cc b/chrome/browser/ui/sad_tab_helper.cc
index 07fcacd..a7d5c49 100644
--- a/chrome/browser/ui/sad_tab_helper.cc
+++ b/chrome/browser/ui/sad_tab_helper.cc
@@ -24,7 +24,7 @@
#include "chrome/browser/ui/gtk/tab_contents/chrome_web_contents_view_delegate_gtk.h"
#endif
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(SadTabHelper)
+int SadTabHelper::kUserDataKey;
SadTabHelper::SadTabHelper(content::WebContents* web_contents)
: content::WebContentsObserver(web_contents) {
diff --git a/chrome/browser/ui/sad_tab_helper.h b/chrome/browser/ui/sad_tab_helper.h
index a05adf7..6b9c650 100644
--- a/chrome/browser/ui/sad_tab_helper.h
+++ b/chrome/browser/ui/sad_tab_helper.h
@@ -43,6 +43,7 @@ class SadTabHelper : public content::WebContentsObserver,
private:
explicit SadTabHelper(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<SadTabHelper>;
// Platform specific function to get an instance of the sad tab page.
diff --git a/chrome/browser/ui/search/search_tab_helper.cc b/chrome/browser/ui/search/search_tab_helper.cc
index 7bdaa49..3f59cfc 100644
--- a/chrome/browser/ui/search/search_tab_helper.cc
+++ b/chrome/browser/ui/search/search_tab_helper.cc
@@ -16,7 +16,7 @@
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(chrome::search::SearchTabHelper)
+int chrome::search::SearchTabHelper::kUserDataKey;
namespace {
diff --git a/chrome/browser/ui/search/search_tab_helper.h b/chrome/browser/ui/search/search_tab_helper.h
index f47889c..cae2906 100644
--- a/chrome/browser/ui/search/search_tab_helper.h
+++ b/chrome/browser/ui/search/search_tab_helper.h
@@ -60,6 +60,7 @@ class SearchTabHelper : public content::WebContentsObserver,
private:
explicit SearchTabHelper(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<SearchTabHelper>;
// Enum of the load states for the NTP.
diff --git a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc b/chrome/browser/ui/search_engines/search_engine_tab_helper.cc
index 09e7bcb..4a94756 100644
--- a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc
+++ b/chrome/browser/ui/search_engines/search_engine_tab_helper.cc
@@ -23,7 +23,7 @@ using content::NavigationController;
using content::NavigationEntry;
using content::WebContents;
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(SearchEngineTabHelper)
+int SearchEngineTabHelper::kUserDataKey;
namespace {
diff --git a/chrome/browser/ui/search_engines/search_engine_tab_helper.h b/chrome/browser/ui/search_engines/search_engine_tab_helper.h
index 244616c..fecd7db 100644
--- a/chrome/browser/ui/search_engines/search_engine_tab_helper.h
+++ b/chrome/browser/ui/search_engines/search_engine_tab_helper.h
@@ -32,6 +32,7 @@ class SearchEngineTabHelper
private:
explicit SearchEngineTabHelper(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<SearchEngineTabHelper>;
// Handles when a page specifies an OSDD (OpenSearch Description Document).
diff --git a/chrome/browser/ui/snapshot_tab_helper.cc b/chrome/browser/ui/snapshot_tab_helper.cc
index b6848f9..891c3d5 100644
--- a/chrome/browser/ui/snapshot_tab_helper.cc
+++ b/chrome/browser/ui/snapshot_tab_helper.cc
@@ -11,7 +11,7 @@
using content::WebContents;
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(SnapshotTabHelper)
+int SnapshotTabHelper::kUserDataKey;
SnapshotTabHelper::SnapshotTabHelper(WebContents* web_contents)
: content::WebContentsObserver(web_contents) {
diff --git a/chrome/browser/ui/snapshot_tab_helper.h b/chrome/browser/ui/snapshot_tab_helper.h
index a9d9eb1..6d943bc 100644
--- a/chrome/browser/ui/snapshot_tab_helper.h
+++ b/chrome/browser/ui/snapshot_tab_helper.h
@@ -21,6 +21,7 @@ class SnapshotTabHelper : public content::WebContentsObserver,
private:
explicit SnapshotTabHelper(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<SnapshotTabHelper>;
// content::WebContentsObserver overrides:
diff --git a/chrome/browser/ui/sync/one_click_signin_helper.cc b/chrome/browser/ui/sync/one_click_signin_helper.cc
index bf9472b..b63d7c5 100644
--- a/chrome/browser/ui/sync/one_click_signin_helper.cc
+++ b/chrome/browser/ui/sync/one_click_signin_helper.cc
@@ -48,7 +48,7 @@
#include "webkit/forms/password_form.h"
#include "webkit/forms/password_form_dom_manager.h"
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(OneClickSigninHelper)
+int OneClickSigninHelper::kUserDataKey;
namespace {
diff --git a/chrome/browser/ui/sync/one_click_signin_helper.h b/chrome/browser/ui/sync/one_click_signin_helper.h
index 295eca0..225b679 100644
--- a/chrome/browser/ui/sync/one_click_signin_helper.h
+++ b/chrome/browser/ui/sync/one_click_signin_helper.h
@@ -50,6 +50,7 @@ class OneClickSigninHelper : public content::WebContentsObserver,
private:
explicit OneClickSigninHelper(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<OneClickSigninHelper>;
// The portion of ShowInfoBarIfPossible() that needs to run on the UI thread.
diff --git a/chrome/browser/ui/tab_contents/core_tab_helper.cc b/chrome/browser/ui/tab_contents/core_tab_helper.cc
index 8894328d..1cfa992 100644
--- a/chrome/browser/ui/tab_contents/core_tab_helper.cc
+++ b/chrome/browser/ui/tab_contents/core_tab_helper.cc
@@ -15,7 +15,7 @@
using content::WebContents;
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(CoreTabHelper)
+int CoreTabHelper::kUserDataKey;
CoreTabHelper::CoreTabHelper(WebContents* web_contents)
: content::WebContentsObserver(web_contents),
diff --git a/chrome/browser/ui/tab_contents/core_tab_helper.h b/chrome/browser/ui/tab_contents/core_tab_helper.h
index 53389f8..ea3f048 100644
--- a/chrome/browser/ui/tab_contents/core_tab_helper.h
+++ b/chrome/browser/ui/tab_contents/core_tab_helper.h
@@ -27,6 +27,7 @@ class CoreTabHelper : public content::WebContentsObserver,
private:
explicit CoreTabHelper(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<CoreTabHelper>;
// content::WebContentsObserver overrides:
diff --git a/chrome/browser/ui/zoom/zoom_controller.cc b/chrome/browser/ui/zoom/zoom_controller.cc
index 66ba5ee..8bb8494 100644
--- a/chrome/browser/ui/zoom/zoom_controller.cc
+++ b/chrome/browser/ui/zoom/zoom_controller.cc
@@ -19,7 +19,7 @@
#include "grit/theme_resources.h"
#include "net/base/net_util.h"
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(ZoomController)
+int ZoomController::kUserDataKey;
ZoomController::ZoomController(content::WebContents* web_contents)
: content::WebContentsObserver(web_contents),
diff --git a/chrome/browser/ui/zoom/zoom_controller.h b/chrome/browser/ui/zoom/zoom_controller.h
index 02b10bb..b37c114 100644
--- a/chrome/browser/ui/zoom/zoom_controller.h
+++ b/chrome/browser/ui/zoom/zoom_controller.h
@@ -38,6 +38,7 @@ class ZoomController : public content::NotificationObserver,
private:
explicit ZoomController(content::WebContents* web_contents);
+ static int kUserDataKey;
friend class WebContentsUserData<ZoomController>;
// content::WebContentsObserver overrides: