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 "components/infobars/core/confirm_infobar_delegate.h" | 9 #include "components/infobars/core/confirm_infobar_delegate.h" |
10 #include "url/gurl.h" | 10 #include "url/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 | 14 #endif |
15 | 15 |
16 class InfoBarService; | 16 class InfoBarService; |
17 class HostContentSettingsMap; | 17 class HostContentSettingsMap; |
18 class PluginMetadata; | 18 class PluginMetadata; |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 class WebContents; | 21 class WebContents; |
22 } | 22 } |
23 | 23 |
24 // Base class for blocked plug-in infobars. | 24 // Base class for blocked plug-in infobars. |
25 class PluginInfoBarDelegate : public ConfirmInfoBarDelegate { | 25 class PluginInfoBarDelegate : public ConfirmInfoBarDelegate { |
26 protected: | 26 protected: |
27 explicit PluginInfoBarDelegate(const std::string& identifier); | 27 explicit PluginInfoBarDelegate(const std::string& identifier); |
28 virtual ~PluginInfoBarDelegate(); | 28 ~PluginInfoBarDelegate() override; |
29 | 29 |
30 // ConfirmInfoBarDelegate: | 30 // ConfirmInfoBarDelegate: |
31 virtual bool LinkClicked(WindowOpenDisposition disposition) override; | 31 bool LinkClicked(WindowOpenDisposition disposition) override; |
32 | 32 |
33 virtual std::string GetLearnMoreURL() const = 0; | 33 virtual std::string GetLearnMoreURL() const = 0; |
34 | 34 |
35 void LoadBlockedPlugins(); | 35 void LoadBlockedPlugins(); |
36 | 36 |
37 private: | 37 private: |
38 // ConfirmInfoBarDelegate: | 38 // ConfirmInfoBarDelegate: |
39 virtual int GetIconID() const override; | 39 int GetIconID() const override; |
40 virtual base::string16 GetLinkText() const override; | 40 base::string16 GetLinkText() const override; |
41 | 41 |
42 std::string identifier_; | 42 std::string identifier_; |
43 | 43 |
44 DISALLOW_COPY_AND_ASSIGN(PluginInfoBarDelegate); | 44 DISALLOW_COPY_AND_ASSIGN(PluginInfoBarDelegate); |
45 }; | 45 }; |
46 | 46 |
47 // Infobar that's shown when a plug-in requires user authorization to run. | 47 // Infobar that's shown when a plug-in requires user authorization to run. |
48 class UnauthorizedPluginInfoBarDelegate : public PluginInfoBarDelegate { | 48 class UnauthorizedPluginInfoBarDelegate : public PluginInfoBarDelegate { |
49 public: | 49 public: |
50 // Creates an unauthorized plugin infobar and delegate and adds the infobar to | 50 // Creates an unauthorized plugin infobar and delegate and adds the infobar to |
51 // |infobar_service|. | 51 // |infobar_service|. |
52 static void Create(InfoBarService* infobar_service, | 52 static void Create(InfoBarService* infobar_service, |
53 HostContentSettingsMap* content_settings, | 53 HostContentSettingsMap* content_settings, |
54 const base::string16& name, | 54 const base::string16& name, |
55 const std::string& identifier); | 55 const std::string& identifier); |
56 | 56 |
57 private: | 57 private: |
58 UnauthorizedPluginInfoBarDelegate(HostContentSettingsMap* content_settings, | 58 UnauthorizedPluginInfoBarDelegate(HostContentSettingsMap* content_settings, |
59 const base::string16& name, | 59 const base::string16& name, |
60 const std::string& identifier); | 60 const std::string& identifier); |
61 virtual ~UnauthorizedPluginInfoBarDelegate(); | 61 ~UnauthorizedPluginInfoBarDelegate() override; |
62 | 62 |
63 // PluginInfoBarDelegate: | 63 // PluginInfoBarDelegate: |
64 virtual base::string16 GetMessageText() const override; | 64 base::string16 GetMessageText() const override; |
65 virtual base::string16 GetButtonLabel(InfoBarButton button) const override; | 65 base::string16 GetButtonLabel(InfoBarButton button) const override; |
66 virtual bool Accept() override; | 66 bool Accept() override; |
67 virtual bool Cancel() override; | 67 bool Cancel() override; |
68 virtual void InfoBarDismissed() override; | 68 void InfoBarDismissed() override; |
69 virtual bool LinkClicked(WindowOpenDisposition disposition) override; | 69 bool LinkClicked(WindowOpenDisposition disposition) override; |
70 virtual std::string GetLearnMoreURL() const override; | 70 std::string GetLearnMoreURL() const override; |
71 | 71 |
72 HostContentSettingsMap* content_settings_; | 72 HostContentSettingsMap* content_settings_; |
73 base::string16 name_; | 73 base::string16 name_; |
74 | 74 |
75 DISALLOW_COPY_AND_ASSIGN(UnauthorizedPluginInfoBarDelegate); | 75 DISALLOW_COPY_AND_ASSIGN(UnauthorizedPluginInfoBarDelegate); |
76 }; | 76 }; |
77 | 77 |
78 #if defined(ENABLE_PLUGIN_INSTALLATION) | 78 #if defined(ENABLE_PLUGIN_INSTALLATION) |
79 // Infobar that's shown when a plug-in is out of date. | 79 // Infobar that's shown when a plug-in is out of date. |
80 class OutdatedPluginInfoBarDelegate : public PluginInfoBarDelegate, | 80 class OutdatedPluginInfoBarDelegate : public PluginInfoBarDelegate, |
81 public WeakPluginInstallerObserver { | 81 public WeakPluginInstallerObserver { |
82 public: | 82 public: |
83 // Creates an outdated plugin infobar and delegate and adds the infobar to | 83 // Creates an outdated plugin infobar and delegate and adds the infobar to |
84 // |infobar_service|. | 84 // |infobar_service|. |
85 static void Create(InfoBarService* infobar_service, | 85 static void Create(InfoBarService* infobar_service, |
86 PluginInstaller* installer, | 86 PluginInstaller* installer, |
87 scoped_ptr<PluginMetadata> metadata); | 87 scoped_ptr<PluginMetadata> metadata); |
88 | 88 |
89 private: | 89 private: |
90 OutdatedPluginInfoBarDelegate(PluginInstaller* installer, | 90 OutdatedPluginInfoBarDelegate(PluginInstaller* installer, |
91 scoped_ptr<PluginMetadata> metadata, | 91 scoped_ptr<PluginMetadata> metadata, |
92 const base::string16& message); | 92 const base::string16& message); |
93 virtual ~OutdatedPluginInfoBarDelegate(); | 93 ~OutdatedPluginInfoBarDelegate() override; |
94 | 94 |
95 // PluginInfoBarDelegate: | 95 // PluginInfoBarDelegate: |
96 virtual base::string16 GetMessageText() const override; | 96 base::string16 GetMessageText() const override; |
97 virtual base::string16 GetButtonLabel(InfoBarButton button) const override; | 97 base::string16 GetButtonLabel(InfoBarButton button) const override; |
98 virtual bool Accept() override; | 98 bool Accept() override; |
99 virtual bool Cancel() override; | 99 bool Cancel() override; |
100 virtual void InfoBarDismissed() override; | 100 void InfoBarDismissed() override; |
101 virtual bool LinkClicked(WindowOpenDisposition disposition) override; | 101 bool LinkClicked(WindowOpenDisposition disposition) override; |
102 virtual std::string GetLearnMoreURL() const override; | 102 std::string GetLearnMoreURL() const override; |
103 | 103 |
104 // PluginInstallerObserver: | 104 // PluginInstallerObserver: |
105 virtual void DownloadStarted() override; | 105 void DownloadStarted() override; |
106 virtual void DownloadError(const std::string& message) override; | 106 void DownloadError(const std::string& message) override; |
107 virtual void DownloadCancelled() override; | 107 void DownloadCancelled() override; |
108 virtual void DownloadFinished() override; | 108 void DownloadFinished() override; |
109 | 109 |
110 // WeakPluginInstallerObserver: | 110 // WeakPluginInstallerObserver: |
111 virtual void OnlyWeakObserversLeft() override; | 111 void OnlyWeakObserversLeft() override; |
112 | 112 |
113 // Replaces this infobar with one showing |message|. The new infobar will | 113 // Replaces this infobar with one showing |message|. The new infobar will |
114 // not have any buttons (and not call the callback). | 114 // not have any buttons (and not call the callback). |
115 void ReplaceWithInfoBar(const base::string16& message); | 115 void ReplaceWithInfoBar(const base::string16& message); |
116 | 116 |
117 scoped_ptr<PluginMetadata> plugin_metadata_; | 117 scoped_ptr<PluginMetadata> plugin_metadata_; |
118 | 118 |
119 base::string16 message_; | 119 base::string16 message_; |
120 | 120 |
121 DISALLOW_COPY_AND_ASSIGN(OutdatedPluginInfoBarDelegate); | 121 DISALLOW_COPY_AND_ASSIGN(OutdatedPluginInfoBarDelegate); |
(...skipping 22 matching lines...) Expand all Loading... |
144 scoped_ptr<PluginMetadata> plugin_metadata, | 144 scoped_ptr<PluginMetadata> plugin_metadata, |
145 bool new_install, | 145 bool new_install, |
146 const base::string16& message); | 146 const base::string16& message); |
147 | 147 |
148 private: | 148 private: |
149 PluginInstallerInfoBarDelegate(PluginInstaller* installer, | 149 PluginInstallerInfoBarDelegate(PluginInstaller* installer, |
150 scoped_ptr<PluginMetadata> metadata, | 150 scoped_ptr<PluginMetadata> metadata, |
151 const InstallCallback& callback, | 151 const InstallCallback& callback, |
152 bool new_install, | 152 bool new_install, |
153 const base::string16& message); | 153 const base::string16& message); |
154 virtual ~PluginInstallerInfoBarDelegate(); | 154 ~PluginInstallerInfoBarDelegate() override; |
155 | 155 |
156 // ConfirmInfoBarDelegate: | 156 // ConfirmInfoBarDelegate: |
157 virtual int GetIconID() const override; | 157 int GetIconID() const override; |
158 virtual base::string16 GetMessageText() const override; | 158 base::string16 GetMessageText() const override; |
159 virtual int GetButtons() const override; | 159 int GetButtons() const override; |
160 virtual base::string16 GetButtonLabel(InfoBarButton button) const override; | 160 base::string16 GetButtonLabel(InfoBarButton button) const override; |
161 virtual bool Accept() override; | 161 bool Accept() override; |
162 virtual base::string16 GetLinkText() const override; | 162 base::string16 GetLinkText() const override; |
163 virtual bool LinkClicked(WindowOpenDisposition disposition) override; | 163 bool LinkClicked(WindowOpenDisposition disposition) override; |
164 | 164 |
165 // PluginInstallerObserver: | 165 // PluginInstallerObserver: |
166 virtual void DownloadStarted() override; | 166 void DownloadStarted() override; |
167 virtual void DownloadError(const std::string& message) override; | 167 void DownloadError(const std::string& message) override; |
168 virtual void DownloadCancelled() override; | 168 void DownloadCancelled() override; |
169 virtual void DownloadFinished() override; | 169 void DownloadFinished() override; |
170 | 170 |
171 // WeakPluginInstallerObserver: | 171 // WeakPluginInstallerObserver: |
172 virtual void OnlyWeakObserversLeft() override; | 172 void OnlyWeakObserversLeft() override; |
173 | 173 |
174 // Replaces this infobar with one showing |message|. The new infobar will | 174 // Replaces this infobar with one showing |message|. The new infobar will |
175 // not have any buttons (and not call the callback). | 175 // not have any buttons (and not call the callback). |
176 void ReplaceWithInfoBar(const base::string16& message); | 176 void ReplaceWithInfoBar(const base::string16& message); |
177 | 177 |
178 scoped_ptr<PluginMetadata> plugin_metadata_; | 178 scoped_ptr<PluginMetadata> plugin_metadata_; |
179 | 179 |
180 InstallCallback callback_; | 180 InstallCallback callback_; |
181 | 181 |
182 // True iff the plug-in isn't installed yet. | 182 // True iff the plug-in isn't installed yet. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 virtual bool LinkClicked(WindowOpenDisposition disposition) override; | 219 virtual bool LinkClicked(WindowOpenDisposition disposition) override; |
220 | 220 |
221 const Mode mode_; | 221 const Mode mode_; |
222 const base::string16 name_; | 222 const base::string16 name_; |
223 | 223 |
224 DISALLOW_COPY_AND_ASSIGN(PluginMetroModeInfoBarDelegate); | 224 DISALLOW_COPY_AND_ASSIGN(PluginMetroModeInfoBarDelegate); |
225 }; | 225 }; |
226 #endif // defined(OS_WIN) | 226 #endif // defined(OS_WIN) |
227 | 227 |
228 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_INFOBAR_DELEGATES_H_ | 228 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_INFOBAR_DELEGATES_H_ |
OLD | NEW |