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

Unified Diff: chrome/browser/ui/bookmarks/bookmark_tab_helper.h

Issue 10945010: Switch BookmarkTabHelper to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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/bookmarks/bookmark_tab_helper.h
diff --git a/chrome/browser/ui/bookmarks/bookmark_tab_helper.h b/chrome/browser/ui/bookmarks/bookmark_tab_helper.h
index e2a9b2bdd6209fecd2cdbf93c1f0a65597a2bf5f..b4321b724509c0f5c372ce248bf9dc0b0f7d7300 100644
--- a/chrome/browser/ui/bookmarks/bookmark_tab_helper.h
+++ b/chrome/browser/ui/bookmarks/bookmark_tab_helper.h
@@ -5,17 +5,22 @@
#ifndef CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_TAB_HELPER_H_
#define CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_TAB_HELPER_H_
+#include "chrome/browser/tab_contents/web_contents_user_data.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_observer.h"
-class BookmarkTabHelperDelegate;
-class TabContents;
struct BookmarkNodeData;
+class BookmarkTabHelperDelegate;
+
+namespace content {
+class WebContents;
+}
// Per-tab class to manage bookmarks.
class BookmarkTabHelper : public content::NotificationObserver,
- public content::WebContentsObserver {
+ public content::WebContentsObserver,
+ public WebContentsUserData<BookmarkTabHelper> {
public:
// BookmarkDrag --------------------------------------------------------------
// Interface for forwarding bookmark drag and drop to extenstions.
@@ -30,7 +35,6 @@ class BookmarkTabHelper : public content::NotificationObserver,
virtual ~BookmarkDrag() {}
};
- explicit BookmarkTabHelper(TabContents* tab_contents);
virtual ~BookmarkTabHelper();
bool is_starred() const { return is_starred_; }
@@ -61,6 +65,10 @@ class BookmarkTabHelper : public content::NotificationObserver,
BookmarkTabHelper::BookmarkDrag* GetBookmarkDragDelegate();
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
// changed, the delegate is notified.
void UpdateStarredStateForCurrentURL();
@@ -71,9 +79,6 @@ class BookmarkTabHelper : public content::NotificationObserver,
// Registers and unregisters us for notifications.
content::NotificationRegistrar registrar_;
- // Owning TabContents.
- TabContents* tab_contents_;
-
// Delegate for notifying our owner (usually Browser) about stuff. Not owned
// by us.
BookmarkTabHelperDelegate* delegate_;
« no previous file with comments | « chrome/browser/tab_contents/web_drag_bookmark_handler_win.cc ('k') | chrome/browser/ui/bookmarks/bookmark_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698