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

Unified Diff: chrome/browser/plugins/plugin_observer.h

Issue 10961051: Switch PluginObserver to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: commentary 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
« no previous file with comments | « chrome/browser/plugins/plugin_infobar_delegates.cc ('k') | chrome/browser/plugins/plugin_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/plugins/plugin_observer.h
diff --git a/chrome/browser/plugins/plugin_observer.h b/chrome/browser/plugins/plugin_observer.h
index d2d6e114ba517cd2b5cc629f5847a545b9272727..ccc609e118c50d17a2f50b23e8d55417d87e48d7 100644
--- a/chrome/browser/plugins/plugin_observer.h
+++ b/chrome/browser/plugins/plugin_observer.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_PLUGINS_PLUGIN_OBSERVER_H_
#include "base/memory/weak_ptr.h"
+#include "chrome/browser/tab_contents/web_contents_user_data.h"
#include "content/public/browser/web_contents_observer.h"
#if defined(ENABLE_PLUGIN_INSTALLATION)
@@ -15,16 +16,19 @@
class GURL;
class InfoBarDelegate;
class PluginFinder;
-class TabContents;
#if defined(ENABLE_PLUGIN_INSTALLATION)
class PluginInstaller;
class PluginPlaceholderHost;
#endif
-class PluginObserver : public content::WebContentsObserver {
+namespace content {
+class WebContents;
+}
+
+class PluginObserver : public content::WebContentsObserver,
+ public WebContentsUserData<PluginObserver> {
public:
- explicit PluginObserver(TabContents* tab_contents);
virtual ~PluginObserver();
// content::WebContentsObserver implementation.
@@ -35,9 +39,14 @@ class PluginObserver : public content::WebContentsObserver {
void InstallMissingPlugin(PluginInstaller* installer);
#endif
- TabContents* tab_contents() { return tab_contents_; }
+ // Make public the web_contents() accessor that is protected in the parent.
+ using content::WebContentsObserver::web_contents;
private:
+ explicit PluginObserver(content::WebContents* web_contents);
+ static int kUserDataKey;
+ friend class WebContentsUserData<PluginObserver>;
+
class PluginPlaceholderHost;
void OnBlockedUnauthorizedPlugin(const string16& name,
@@ -60,8 +69,6 @@ class PluginObserver : public content::WebContentsObserver {
base::WeakPtrFactory<PluginObserver> weak_ptr_factory_;
- TabContents* tab_contents_;
-
#if defined(ENABLE_PLUGIN_INSTALLATION)
// Stores all PluginPlaceholderHosts, keyed by their routing ID.
std::map<int, PluginPlaceholderHost*> plugin_placeholders_;
« no previous file with comments | « chrome/browser/plugins/plugin_infobar_delegates.cc ('k') | chrome/browser/plugins/plugin_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698