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

Unified Diff: chrome/browser/tab_contents/web_contents_user_data.h

Issue 10873101: Revert 153571 - Create base class for TabHelpers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | « no previous file | chrome/browser/tab_contents/web_contents_user_data_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/web_contents_user_data.h
===================================================================
--- chrome/browser/tab_contents/web_contents_user_data.h (revision 153590)
+++ chrome/browser/tab_contents/web_contents_user_data.h (working copy)
@@ -1,37 +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.
-
-#ifndef CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_USER_DATA_H_
-#define CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_USER_DATA_H_
-
-#include "base/supports_user_data.h"
-#include "content/public/browser/web_contents.h"
-
-// A base class for classes attached to, and scoped to, the lifetime of a
-// WebContents. For example:
-//
-// class FooTabHelper : public WebContentsUserData<FooTabHelper> {
-// public:
-// explicit FooTabHelper(content::WebContents* contents);
-// virtual ~FooTabHelper();
-//
-template <typename T>
-class WebContentsUserData : public base::SupportsUserData::Data {
- public:
- // Creates an object of type T, and attaches it to the specified WebContents.
- static void CreateForWebContents(content::WebContents* contents) {
- void* key = reinterpret_cast<void*>(&CreateForWebContents);
- contents->SetUserData(key, 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) {
- void* key = reinterpret_cast<void*>(&CreateForWebContents);
- return static_cast<T*>(contents->GetUserData(key));
- }
-};
-
-#endif // CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_USER_DATA_H_
« no previous file with comments | « no previous file | chrome/browser/tab_contents/web_contents_user_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698