| OLD | NEW |
| 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_PLUGINS_PLUGIN_INFOBAR_DELEGATES_H_ | 5 #ifndef CHROME_BROWSER_PLUGINS_PLUGIN_INFOBAR_DELEGATES_H_ |
| 6 #define CHROME_BROWSER_PLUGINS_PLUGIN_INFOBAR_DELEGATES_H_ | 6 #define CHROME_BROWSER_PLUGINS_PLUGIN_INFOBAR_DELEGATES_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" | 9 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| 11 | 11 |
| 12 #if defined(ENABLE_PLUGIN_INSTALLATION) | 12 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 13 #include "chrome/browser/plugins/plugin_installer_observer.h" | 13 #include "chrome/browser/plugins/plugin_installer_observer.h" |
| 14 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 14 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
| 15 | 15 |
| 16 class InfoBarService; | 16 class InfoBarService; |
| 17 class HostContentSettingsMap; | 17 class HostContentSettingsMap; |
| 18 class PluginObserver; | 18 |
| 19 namespace content { |
| 20 class WebContents; |
| 21 } |
| 19 | 22 |
| 20 // Base class for blocked plug-in infobars. | 23 // Base class for blocked plug-in infobars. |
| 21 class PluginInfoBarDelegate : public ConfirmInfoBarDelegate { | 24 class PluginInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 22 public: | 25 public: |
| 23 PluginInfoBarDelegate(InfoBarService* infobar_service, | 26 PluginInfoBarDelegate(InfoBarService* infobar_service, |
| 24 const string16& name, | 27 const string16& name, |
| 25 const std::string& identifier); | 28 const std::string& identifier); |
| 26 | 29 |
| 27 protected: | 30 protected: |
| 28 virtual ~PluginInfoBarDelegate(); | 31 virtual ~PluginInfoBarDelegate(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 HostContentSettingsMap* content_settings_; | 72 HostContentSettingsMap* content_settings_; |
| 70 | 73 |
| 71 DISALLOW_COPY_AND_ASSIGN(UnauthorizedPluginInfoBarDelegate); | 74 DISALLOW_COPY_AND_ASSIGN(UnauthorizedPluginInfoBarDelegate); |
| 72 }; | 75 }; |
| 73 | 76 |
| 74 #if defined(ENABLE_PLUGIN_INSTALLATION) | 77 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 75 // Infobar that's shown when a plug-in is out of date. | 78 // Infobar that's shown when a plug-in is out of date. |
| 76 class OutdatedPluginInfoBarDelegate : public PluginInfoBarDelegate, | 79 class OutdatedPluginInfoBarDelegate : public PluginInfoBarDelegate, |
| 77 public WeakPluginInstallerObserver { | 80 public WeakPluginInstallerObserver { |
| 78 public: | 81 public: |
| 79 static InfoBarDelegate* Create(PluginObserver* observer, | 82 static InfoBarDelegate* Create(content::WebContents* web_contents, |
| 80 PluginInstaller* installer); | 83 PluginInstaller* installer); |
| 81 | 84 |
| 82 private: | 85 private: |
| 83 OutdatedPluginInfoBarDelegate(PluginObserver* observer, | 86 OutdatedPluginInfoBarDelegate(content::WebContents* web_contents, |
| 84 PluginInstaller* installer, | 87 PluginInstaller* installer, |
| 85 const string16& message); | 88 const string16& message); |
| 86 virtual ~OutdatedPluginInfoBarDelegate(); | 89 virtual ~OutdatedPluginInfoBarDelegate(); |
| 87 | 90 |
| 88 // PluginInfoBarDelegate: | 91 // PluginInfoBarDelegate: |
| 89 virtual string16 GetMessageText() const OVERRIDE; | 92 virtual string16 GetMessageText() const OVERRIDE; |
| 90 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 93 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
| 91 virtual bool Accept() OVERRIDE; | 94 virtual bool Accept() OVERRIDE; |
| 92 virtual bool Cancel() OVERRIDE; | 95 virtual bool Cancel() OVERRIDE; |
| 93 virtual void InfoBarDismissed() OVERRIDE; | 96 virtual void InfoBarDismissed() OVERRIDE; |
| 94 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; | 97 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; |
| 95 virtual std::string GetLearnMoreURL() const OVERRIDE; | 98 virtual std::string GetLearnMoreURL() const OVERRIDE; |
| 96 | 99 |
| 97 // PluginInstallerObserver: | 100 // PluginInstallerObserver: |
| 98 virtual void DownloadStarted() OVERRIDE; | 101 virtual void DownloadStarted() OVERRIDE; |
| 99 virtual void DownloadError(const std::string& message) OVERRIDE; | 102 virtual void DownloadError(const std::string& message) OVERRIDE; |
| 100 virtual void DownloadCancelled() OVERRIDE; | 103 virtual void DownloadCancelled() OVERRIDE; |
| 101 virtual void DownloadFinished() OVERRIDE; | 104 virtual void DownloadFinished() OVERRIDE; |
| 102 | 105 |
| 103 // WeakPluginInstallerObserver: | 106 // WeakPluginInstallerObserver: |
| 104 virtual void OnlyWeakObserversLeft() OVERRIDE; | 107 virtual void OnlyWeakObserversLeft() OVERRIDE; |
| 105 | 108 |
| 106 // Replaces this infobar with one showing |message|. The new infobar will | 109 // Replaces this infobar with one showing |message|. The new infobar will |
| 107 // not have any buttons (and not call the callback). | 110 // not have any buttons (and not call the callback). |
| 108 void ReplaceWithInfoBar(const string16& message); | 111 void ReplaceWithInfoBar(const string16& message); |
| 109 | 112 |
| 110 // Has the same lifetime as TabContents, which owns us | |
| 111 // (transitively via InfoBarService). | |
| 112 PluginObserver* observer_; | |
| 113 | |
| 114 string16 message_; | 113 string16 message_; |
| 115 | 114 |
| 116 DISALLOW_COPY_AND_ASSIGN(OutdatedPluginInfoBarDelegate); | 115 DISALLOW_COPY_AND_ASSIGN(OutdatedPluginInfoBarDelegate); |
| 117 }; | 116 }; |
| 118 | 117 |
| 119 // The main purpose for this class is to popup/close the infobar when there is | 118 // The main purpose for this class is to popup/close the infobar when there is |
| 120 // a missing plugin. | 119 // a missing plugin. |
| 121 class PluginInstallerInfoBarDelegate : public ConfirmInfoBarDelegate, | 120 class PluginInstallerInfoBarDelegate : public ConfirmInfoBarDelegate, |
| 122 public WeakPluginInstallerObserver { | 121 public WeakPluginInstallerObserver { |
| 123 public: | 122 public: |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 virtual string16 GetLinkText() const OVERRIDE; | 192 virtual string16 GetLinkText() const OVERRIDE; |
| 194 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; | 193 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; |
| 195 | 194 |
| 196 string16 message_; | 195 string16 message_; |
| 197 | 196 |
| 198 DISALLOW_COPY_AND_ASSIGN(PluginMetroModeInfoBarDelegate); | 197 DISALLOW_COPY_AND_ASSIGN(PluginMetroModeInfoBarDelegate); |
| 199 }; | 198 }; |
| 200 #endif // defined(OS_WIN) | 199 #endif // defined(OS_WIN) |
| 201 | 200 |
| 202 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_INFOBAR_DELEGATES_H_ | 201 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_INFOBAR_DELEGATES_H_ |
| OLD | NEW |