summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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, 55 insertions, 83 deletions
diff --git a/chrome/browser/automation/automation_tab_helper.cc b/chrome/browser/automation/automation_tab_helper.cc
index a77836e..25d2c9b 100644
--- a/chrome/browser/automation/automation_tab_helper.cc
+++ b/chrome/browser/automation/automation_tab_helper.cc
@@ -14,7 +14,7 @@
using content::WebContents;
-int AutomationTabHelper::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(AutomationTabHelper)
TabEventObserver::TabEventObserver() { }
diff --git a/chrome/browser/automation/automation_tab_helper.h b/chrome/browser/automation/automation_tab_helper.h
index 0cfcbbf..8008864 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/tab_contents/web_contents_user_data.h"
+#include "chrome/browser/common/web_contents_user_data.h"
#include "content/public/browser/web_contents_observer.h"
class AutomationTabHelper;
@@ -99,7 +99,6 @@ 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 4108f12b2..797ab24 100644
--- a/chrome/browser/captive_portal/captive_portal_tab_helper.cc
+++ b/chrome/browser/captive_portal/captive_portal_tab_helper.cc
@@ -25,9 +25,9 @@
#include "net/base/net_errors.h"
#include "net/base/ssl_info.h"
-namespace captive_portal {
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(captive_portal::CaptivePortalTabHelper)
-int CaptivePortalTabHelper::kUserDataKey;
+namespace captive_portal {
CaptivePortalTabHelper::CaptivePortalTabHelper(
content::WebContents* 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 9ddf554..c515874 100644
--- a/chrome/browser/captive_portal/captive_portal_tab_helper.h
+++ b/chrome/browser/captive_portal/captive_portal_tab_helper.h
@@ -104,7 +104,6 @@ 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 2cffb58..364997e 100644
--- a/chrome/browser/common/web_contents_user_data.h
+++ b/chrome/browser/common/web_contents_user_data.h
@@ -18,12 +18,11 @@
// // ... 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 ---
-// int FooTabHelper::kUserDataKey;
+// DEFINE_WEB_CONTENTS_USER_DATA_KEY(FooTabHelper)
//
template <typename T>
class WebContentsUserData : public base::SupportsUserData::Data {
@@ -32,18 +31,33 @@ 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(&T::kUserDataKey, new T(contents));
+ contents->SetUserData(&kLocatorKey, 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(&T::kUserDataKey));
+ return static_cast<T*>(contents->GetUserData(&kLocatorKey));
}
static const T* FromWebContents(const content::WebContents* contents) {
- return static_cast<const T*>(contents->GetUserData(&T::kUserDataKey));
+ return static_cast<const T*>(contents->GetUserData(&kLocatorKey));
}
+
+ // 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 cb35bac..1ee3a6a 100644
--- a/chrome/browser/common/web_contents_user_data_unittest.cc
+++ b/chrome/browser/common/web_contents_user_data_unittest.cc
@@ -11,15 +11,12 @@
#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>;
};
@@ -29,14 +26,11 @@ class WebContentsAttachedClass2
virtual ~WebContentsAttachedClass2() {}
private:
explicit WebContentsAttachedClass2(content::WebContents* contents) {}
- static int kUserDataKey;
friend class WebContentsUserData<WebContentsAttachedClass2>;
};
-int WebContentsAttachedClass1::kUserDataKey;
-int WebContentsAttachedClass2::kUserDataKey;
-
-} // namespace
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(WebContentsAttachedClass1)
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(WebContentsAttachedClass2)
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 ed19fcf..1b1e2f1 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
@@ -31,6 +31,8 @@
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;
@@ -253,8 +255,6 @@ 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 196a785..6503a72 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.h
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.h
@@ -97,7 +97,6 @@ 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 4c5521f..bd0a74f 100644
--- a/chrome/browser/extensions/tab_helper.cc
+++ b/chrome/browser/extensions/tab_helper.cc
@@ -45,6 +45,8 @@ using content::NavigationEntry;
using content::RenderViewHost;
using content::WebContents;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(extensions::TabHelper)
+
namespace {
const char kPermissionError[] = "permission_error";
@@ -53,8 +55,6 @@ 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 9540029..ed5563f 100644
--- a/chrome/browser/extensions/tab_helper.h
+++ b/chrome/browser/extensions/tab_helper.h
@@ -145,7 +145,6 @@ 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 e13e121..082dc17 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;
-int ExternalProtocolObserver::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(ExternalProtocolObserver)
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 b967cb5..3cab5ed 100644
--- a/chrome/browser/external_protocol/external_protocol_observer.h
+++ b/chrome/browser/external_protocol/external_protocol_observer.h
@@ -21,7 +21,6 @@ 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 c1b2491..4062524 100644
--- a/chrome/browser/net/load_time_stats.cc
+++ b/chrome/browser/net/load_time_stats.cc
@@ -23,6 +23,8 @@ 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,
@@ -254,8 +256,6 @@ 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 6d37c41..a1aef07 100644
--- a/chrome/browser/net/load_time_stats.h
+++ b/chrome/browser/net/load_time_stats.h
@@ -137,7 +137,6 @@ 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 93b5cf1..60172f2 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;
-int OmniboxSearchHint::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(OmniboxSearchHint)
// 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 cc2b6e17..1fbcac1 100644
--- a/chrome/browser/omnibox_search_hint.h
+++ b/chrome/browser/omnibox_search_hint.h
@@ -47,7 +47,6 @@ 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 614c06b..c78bf09 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;
-int PepperBrokerObserver::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(PepperBrokerObserver)
namespace {
diff --git a/chrome/browser/pepper_broker_observer.h b/chrome/browser/pepper_broker_observer.h
index 027271b..906215d 100644
--- a/chrome/browser/pepper_broker_observer.h
+++ b/chrome/browser/pepper_broker_observer.h
@@ -15,7 +15,6 @@ 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 955735d..395678d 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;
-int PluginObserver::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(PluginObserver)
namespace {
diff --git a/chrome/browser/plugins/plugin_observer.h b/chrome/browser/plugins/plugin_observer.h
index a0ae687..2f2a2be 100644
--- a/chrome/browser/plugins/plugin_observer.h
+++ b/chrome/browser/plugins/plugin_observer.h
@@ -39,7 +39,6 @@ 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 a861023..2dd376d 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;
-int printing::PrintPreviewMessageHandler::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(printing::PrintPreviewMessageHandler)
namespace {
diff --git a/chrome/browser/printing/print_preview_message_handler.h b/chrome/browser/printing/print_preview_message_handler.h
index 304437b..4b4d305 100644
--- a/chrome/browser/printing/print_preview_message_handler.h
+++ b/chrome/browser/printing/print_preview_message_handler.h
@@ -35,7 +35,6 @@ 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 42621a3..ed57b69 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;
-int printing::PrintViewManager::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(printing::PrintViewManager)
namespace {
diff --git a/chrome/browser/printing/print_view_manager.h b/chrome/browser/printing/print_view_manager.h
index 709be49..1eb4a62 100644
--- a/chrome/browser/printing/print_view_manager.h
+++ b/chrome/browser/printing/print_view_manager.h
@@ -100,7 +100,6 @@ 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 bf6a092..afa9962 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"
-int SessionTabHelper::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(SessionTabHelper)
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 dbc9bf1..5c2ae22 100644
--- a/chrome/browser/sessions/session_tab_helper.h
+++ b/chrome/browser/sessions/session_tab_helper.h
@@ -31,7 +31,6 @@ 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 76980c6..932be4b 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 ----------------------------------------------------------------
-int SSLTabHelper::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(SSLTabHelper)
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 4a3c5ce..2c654d0b 100644
--- a/chrome/browser/ssl/ssl_tab_helper.h
+++ b/chrome/browser/ssl/ssl_tab_helper.h
@@ -59,7 +59,6 @@ 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 f2ec31c..dd8139c 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"
-int NavigationMetricsRecorder::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(NavigationMetricsRecorder)
namespace {
diff --git a/chrome/browser/tab_contents/navigation_metrics_recorder.h b/chrome/browser/tab_contents/navigation_metrics_recorder.h
index 298caaf..7401eec 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/tab_contents/web_contents_user_data.h"
+#include "chrome/browser/common/web_contents_user_data.h"
#include "content/public/browser/web_contents_observer.h"
class NavigationMetricsRecorder
@@ -16,7 +16,6 @@ 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
deleted file mode 100644
index c2a0eb0..0000000
--- a/chrome/browser/tab_contents/web_contents_user_data.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// 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 56ce220..73347f4 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;
-int AlternateErrorPageTabObserver::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(AlternateErrorPageTabObserver)
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 e67770f..9bd116ecdf 100644
--- a/chrome/browser/ui/alternate_error_tab_observer.h
+++ b/chrome/browser/ui/alternate_error_tab_observer.h
@@ -26,7 +26,6 @@ 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 0ffce7a..7aec2b9 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;
-int BlockedContentTabHelper::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(BlockedContentTabHelper)
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 88b14a1..c07c8ca 100644
--- a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.h
+++ b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.h
@@ -62,7 +62,6 @@ 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 e2b08fe..0226cfb 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"
-int BookmarkTabHelper::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(BookmarkTabHelper)
namespace {
diff --git a/chrome/browser/ui/bookmarks/bookmark_tab_helper.h b/chrome/browser/ui/bookmarks/bookmark_tab_helper.h
index 022a414..4024a82 100644
--- a/chrome/browser/ui/bookmarks/bookmark_tab_helper.h
+++ b/chrome/browser/ui/bookmarks/bookmark_tab_helper.h
@@ -66,7 +66,6 @@ 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 26dc863..8dd7257 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
-int HungPluginTabHelper::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(HungPluginTabHelper)
namespace {
diff --git a/chrome/browser/ui/hung_plugin_tab_helper.h b/chrome/browser/ui/hung_plugin_tab_helper.h
index bdf6a60..3518739 100644
--- a/chrome/browser/ui/hung_plugin_tab_helper.h
+++ b/chrome/browser/ui/hung_plugin_tab_helper.h
@@ -51,7 +51,6 @@ 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 411ecf3..0cc101c 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;
-int WebIntentPickerController::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(WebIntentPickerController)
namespace {
diff --git a/chrome/browser/ui/intents/web_intent_picker_controller.h b/chrome/browser/ui/intents/web_intent_picker_controller.h
index d5bf823..6f479bb 100644
--- a/chrome/browser/ui/intents/web_intent_picker_controller.h
+++ b/chrome/browser/ui/intents/web_intent_picker_controller.h
@@ -120,7 +120,6 @@ 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 187e44d..7644355 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
-int MetroPinTabHelper::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(MetroPinTabHelper)
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 a78af83..450c8e3f 100644
--- a/chrome/browser/ui/metro_pin_tab_helper.h
+++ b/chrome/browser/ui/metro_pin_tab_helper.h
@@ -25,7 +25,6 @@ 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 5b4ad47..161a2e9 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"
-int PDFTabHelper::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(PDFTabHelper)
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 a7d51c9..17ad5ef 100644
--- a/chrome/browser/ui/pdf/pdf_tab_helper.h
+++ b/chrome/browser/ui/pdf/pdf_tab_helper.h
@@ -19,7 +19,6 @@ 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 a7d5c49..07fcacd 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
-int SadTabHelper::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(SadTabHelper)
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 6b9c650..a05adf7 100644
--- a/chrome/browser/ui/sad_tab_helper.h
+++ b/chrome/browser/ui/sad_tab_helper.h
@@ -43,7 +43,6 @@ 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 3f59cfc..7bdaa49 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"
-int chrome::search::SearchTabHelper::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(chrome::search::SearchTabHelper)
namespace {
diff --git a/chrome/browser/ui/search/search_tab_helper.h b/chrome/browser/ui/search/search_tab_helper.h
index cae2906..f47889c 100644
--- a/chrome/browser/ui/search/search_tab_helper.h
+++ b/chrome/browser/ui/search/search_tab_helper.h
@@ -60,7 +60,6 @@ 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 4a94756..09e7bcb 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;
-int SearchEngineTabHelper::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(SearchEngineTabHelper)
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 fecd7db..244616c 100644
--- a/chrome/browser/ui/search_engines/search_engine_tab_helper.h
+++ b/chrome/browser/ui/search_engines/search_engine_tab_helper.h
@@ -32,7 +32,6 @@ 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 891c3d5..b6848f9 100644
--- a/chrome/browser/ui/snapshot_tab_helper.cc
+++ b/chrome/browser/ui/snapshot_tab_helper.cc
@@ -11,7 +11,7 @@
using content::WebContents;
-int SnapshotTabHelper::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(SnapshotTabHelper)
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 6d943bc..a9d9eb1 100644
--- a/chrome/browser/ui/snapshot_tab_helper.h
+++ b/chrome/browser/ui/snapshot_tab_helper.h
@@ -21,7 +21,6 @@ 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 b63d7c5..bf9472b 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"
-int OneClickSigninHelper::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(OneClickSigninHelper)
namespace {
diff --git a/chrome/browser/ui/sync/one_click_signin_helper.h b/chrome/browser/ui/sync/one_click_signin_helper.h
index 225b679..295eca0 100644
--- a/chrome/browser/ui/sync/one_click_signin_helper.h
+++ b/chrome/browser/ui/sync/one_click_signin_helper.h
@@ -50,7 +50,6 @@ 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 1cfa992..8894328d 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;
-int CoreTabHelper::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(CoreTabHelper)
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 ea3f048..53389f8 100644
--- a/chrome/browser/ui/tab_contents/core_tab_helper.h
+++ b/chrome/browser/ui/tab_contents/core_tab_helper.h
@@ -27,7 +27,6 @@ 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 8bb8494..66ba5ee 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"
-int ZoomController::kUserDataKey;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(ZoomController)
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 b37c114..02b10bb 100644
--- a/chrome/browser/ui/zoom/zoom_controller.h
+++ b/chrome/browser/ui/zoom/zoom_controller.h
@@ -38,7 +38,6 @@ class ZoomController : public content::NotificationObserver,
private:
explicit ZoomController(content::WebContents* web_contents);
- static int kUserDataKey;
friend class WebContentsUserData<ZoomController>;
// content::WebContentsObserver overrides: