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

Side by Side Diff: chrome/browser/ui/tab_contents/core_tab_helper.h

Issue 10993064: Make using WebContentsUserData simpler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_
6 #define CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_ 6 #define CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_
7 7
8 #include "chrome/browser/common/web_contents_user_data.h" 8 #include "chrome/browser/common/web_contents_user_data.h"
9 #include "content/public/browser/web_contents_observer.h" 9 #include "content/public/browser/web_contents_observer.h"
10 10
11 class CoreTabHelperDelegate; 11 class CoreTabHelperDelegate;
12 12
13 // Per-tab class to handle functionality that is core to the operation of tabs. 13 // Per-tab class to handle functionality that is core to the operation of tabs.
14 class CoreTabHelper : public content::WebContentsObserver, 14 class CoreTabHelper : public content::WebContentsObserver,
15 public WebContentsUserData<CoreTabHelper> { 15 public WebContentsUserData<CoreTabHelper> {
16 public: 16 public:
17 virtual ~CoreTabHelper(); 17 virtual ~CoreTabHelper();
18 18
19 CoreTabHelperDelegate* delegate() const { return delegate_; } 19 CoreTabHelperDelegate* delegate() const { return delegate_; }
20 void set_delegate(CoreTabHelperDelegate* d) { delegate_ = d; } 20 void set_delegate(CoreTabHelperDelegate* d) { delegate_ = d; }
21 21
22 // Initial title assigned to NavigationEntries from Navigate. 22 // Initial title assigned to NavigationEntries from Navigate.
23 static string16 GetDefaultTitle(); 23 static string16 GetDefaultTitle();
24 24
25 // Returns a human-readable description the tab's loading state. 25 // Returns a human-readable description the tab's loading state.
26 string16 GetStatusText() const; 26 string16 GetStatusText() const;
27 27
28 private: 28 private:
29 explicit CoreTabHelper(content::WebContents* web_contents); 29 explicit CoreTabHelper(content::WebContents* web_contents);
30 static int kUserDataKey;
31 friend class WebContentsUserData<CoreTabHelper>; 30 friend class WebContentsUserData<CoreTabHelper>;
32 31
33 // content::WebContentsObserver overrides: 32 // content::WebContentsObserver overrides:
34 virtual void WasShown() OVERRIDE; 33 virtual void WasShown() OVERRIDE;
35 34
36 // Delegate for notifying our owner about stuff. Not owned by us. 35 // Delegate for notifying our owner about stuff. Not owned by us.
37 CoreTabHelperDelegate* delegate_; 36 CoreTabHelperDelegate* delegate_;
38 37
39 DISALLOW_COPY_AND_ASSIGN(CoreTabHelper); 38 DISALLOW_COPY_AND_ASSIGN(CoreTabHelper);
40 }; 39 };
41 40
42 #endif // CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_ 41 #endif // CHROME_BROWSER_UI_TAB_CONTENTS_CORE_TAB_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698