diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-03 03:16:26 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-03 03:16:26 +0000 |
commit | 42b0ecedf7eb4beea125ac17ffc0cd373f4b420c (patch) | |
tree | 8c2026442208c18ec14613f0f6132b24acd1e7de /chrome/browser/plugins/plugin_infobar_delegates.h | |
parent | 37a241c6f22e761a07d9ff70aff1b15674eb8bf6 (diff) | |
download | chromium_src-42b0ecedf7eb4beea125ac17ffc0cd373f4b420c.zip chromium_src-42b0ecedf7eb4beea125ac17ffc0cd373f4b420c.tar.gz chromium_src-42b0ecedf7eb4beea125ac17ffc0cd373f4b420c.tar.bz2 |
Infobar system refactor.
This changes the ownership model of infobars so that InfoBars are long-lived and
own their InfoBarDelegates directly. The InfoBarService pseudo-owns the
InfoBars (instead of deleting them directly, it tells them when they're unowned
and expects them to delete themselves).
This fixes leaks when infobars are closed while not visible (e.g. in a
background tab) and in general makes the system clearer and easier to reason
about.
BUG=62154
TEST=none
R=erg@chromium.org, sail@chromium.org, sky@chromium.org
Review URL: https://codereview.chromium.org/22694006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238283 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/plugins/plugin_infobar_delegates.h')
-rw-r--r-- | chrome/browser/plugins/plugin_infobar_delegates.h | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/chrome/browser/plugins/plugin_infobar_delegates.h b/chrome/browser/plugins/plugin_infobar_delegates.h index d03e5af..3f8ffea 100644 --- a/chrome/browser/plugins/plugin_infobar_delegates.h +++ b/chrome/browser/plugins/plugin_infobar_delegates.h @@ -24,8 +24,7 @@ class WebContents; // Base class for blocked plug-in infobars. class PluginInfoBarDelegate : public ConfirmInfoBarDelegate { protected: - PluginInfoBarDelegate(InfoBarService* infobar_service, - const std::string& identifier); + explicit PluginInfoBarDelegate(const std::string& identifier); virtual ~PluginInfoBarDelegate(); // ConfirmInfoBarDelegate: @@ -48,7 +47,7 @@ class PluginInfoBarDelegate : public ConfirmInfoBarDelegate { // Infobar that's shown when a plug-in requires user authorization to run. class UnauthorizedPluginInfoBarDelegate : public PluginInfoBarDelegate { public: - // Creates an unauthorized plugin infobar delegate and adds it to + // Creates an unauthorized plugin infobar and delegate and adds the infobar to // |infobar_service|. static void Create(InfoBarService* infobar_service, HostContentSettingsMap* content_settings, @@ -56,8 +55,7 @@ class UnauthorizedPluginInfoBarDelegate : public PluginInfoBarDelegate { const std::string& identifier); private: - UnauthorizedPluginInfoBarDelegate(InfoBarService* infobar_service, - HostContentSettingsMap* content_settings, + UnauthorizedPluginInfoBarDelegate(HostContentSettingsMap* content_settings, const string16& name, const std::string& identifier); virtual ~UnauthorizedPluginInfoBarDelegate(); @@ -82,15 +80,14 @@ class UnauthorizedPluginInfoBarDelegate : public PluginInfoBarDelegate { class OutdatedPluginInfoBarDelegate : public PluginInfoBarDelegate, public WeakPluginInstallerObserver { public: - // Creates an outdated plugin infobar delegate and adds it to + // Creates an outdated plugin infobar and delegate and adds the infobar to // |infobar_service|. static void Create(InfoBarService* infobar_service, PluginInstaller* installer, scoped_ptr<PluginMetadata> metadata); private: - OutdatedPluginInfoBarDelegate(InfoBarService* infobar_service, - PluginInstaller* installer, + OutdatedPluginInfoBarDelegate(PluginInstaller* installer, scoped_ptr<PluginMetadata> metadata, const string16& message); virtual ~OutdatedPluginInfoBarDelegate(); @@ -142,16 +139,15 @@ class PluginInstallerInfoBarDelegate : public ConfirmInfoBarDelegate, // Replaces |infobar|, which must currently be owned, with an infobar asking // the user to install or update a particular plugin. - static void Replace(InfoBarDelegate* infobar, + static void Replace(InfoBar* infobar, PluginInstaller* installer, scoped_ptr<PluginMetadata> plugin_metadata, bool new_install, const string16& message); private: - PluginInstallerInfoBarDelegate(InfoBarService* infobar_service, - PluginInstaller* installer, - scoped_ptr<PluginMetadata> plugin_metadata, + PluginInstallerInfoBarDelegate(PluginInstaller* installer, + scoped_ptr<PluginMetadata> metadata, const InstallCallback& callback, bool new_install, const string16& message); @@ -210,9 +206,7 @@ class PluginMetroModeInfoBarDelegate : public ConfirmInfoBarDelegate { const string16& name); private: - PluginMetroModeInfoBarDelegate(InfoBarService* infobar_service, - Mode mode, - const string16& name); + PluginMetroModeInfoBarDelegate(Mode mode, const string16& name); virtual ~PluginMetroModeInfoBarDelegate(); // ConfirmInfoBarDelegate: |