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

Side by Side Diff: chrome/browser/plugin_infobar_delegates.h

Issue 10933044: Move chrome/browser/plugin_* to chrome/browser/plugins/ (Closed) Base URL: http://git.chromium.org/chromium/src.git@remove_plugin_group
Patch Set: . 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/plugin_finder_unittest.cc ('k') | chrome/browser/plugin_infobar_delegates.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_PLUGIN_INFOBAR_DELEGATES_H_
6 #define CHROME_BROWSER_PLUGIN_INFOBAR_DELEGATES_H_
7
8 #include "base/callback.h"
9 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h"
10 #include "googleurl/src/gurl.h"
11
12 #if defined(ENABLE_PLUGIN_INSTALLATION)
13 #include "chrome/browser/plugin_installer_observer.h"
14 #endif // defined(ENABLE_PLUGIN_INSTALLATION)
15
16 class InfoBarService;
17 class HostContentSettingsMap;
18 class PluginObserver;
19
20 // Base class for blocked plug-in infobars.
21 class PluginInfoBarDelegate : public ConfirmInfoBarDelegate {
22 public:
23 PluginInfoBarDelegate(InfoBarService* infobar_service,
24 const string16& name,
25 const std::string& identifier);
26
27 protected:
28 virtual ~PluginInfoBarDelegate();
29
30 // ConfirmInfoBarDelegate:
31 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE;
32
33 virtual std::string GetLearnMoreURL() const = 0;
34
35 void LoadBlockedPlugins();
36
37 string16 name_;
38
39 private:
40 // ConfirmInfoBarDelegate:
41 virtual gfx::Image* GetIcon() const OVERRIDE;
42 virtual string16 GetLinkText() const OVERRIDE;
43
44 std::string identifier_;
45
46 DISALLOW_COPY_AND_ASSIGN(PluginInfoBarDelegate);
47 };
48
49 // Infobar that's shown when a plug-in requires user authorization to run.
50 class UnauthorizedPluginInfoBarDelegate : public PluginInfoBarDelegate {
51 public:
52 UnauthorizedPluginInfoBarDelegate(InfoBarService* infobar_service,
53 HostContentSettingsMap* content_settings,
54 const string16& name,
55 const std::string& identifier);
56
57 private:
58 virtual ~UnauthorizedPluginInfoBarDelegate();
59
60 // PluginInfoBarDelegate:
61 virtual string16 GetMessageText() const OVERRIDE;
62 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
63 virtual bool Accept() OVERRIDE;
64 virtual bool Cancel() OVERRIDE;
65 virtual void InfoBarDismissed() OVERRIDE;
66 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE;
67 virtual std::string GetLearnMoreURL() const OVERRIDE;
68
69 HostContentSettingsMap* content_settings_;
70
71 DISALLOW_COPY_AND_ASSIGN(UnauthorizedPluginInfoBarDelegate);
72 };
73
74 #if defined(ENABLE_PLUGIN_INSTALLATION)
75 // Infobar that's shown when a plug-in is out of date.
76 class OutdatedPluginInfoBarDelegate : public PluginInfoBarDelegate,
77 public WeakPluginInstallerObserver {
78 public:
79 static InfoBarDelegate* Create(PluginObserver* observer,
80 PluginInstaller* installer);
81
82 private:
83 OutdatedPluginInfoBarDelegate(PluginObserver* observer,
84 PluginInstaller* installer,
85 const string16& message);
86 virtual ~OutdatedPluginInfoBarDelegate();
87
88 // PluginInfoBarDelegate:
89 virtual string16 GetMessageText() const OVERRIDE;
90 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
91 virtual bool Accept() OVERRIDE;
92 virtual bool Cancel() OVERRIDE;
93 virtual void InfoBarDismissed() OVERRIDE;
94 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE;
95 virtual std::string GetLearnMoreURL() const OVERRIDE;
96
97 // PluginInstallerObserver:
98 virtual void DownloadStarted() OVERRIDE;
99 virtual void DownloadError(const std::string& message) OVERRIDE;
100 virtual void DownloadCancelled() OVERRIDE;
101 virtual void DownloadFinished() OVERRIDE;
102
103 // WeakPluginInstallerObserver:
104 virtual void OnlyWeakObserversLeft() OVERRIDE;
105
106 // Replaces this infobar with one showing |message|. The new infobar will
107 // not have any buttons (and not call the callback).
108 void ReplaceWithInfoBar(const string16& message);
109
110 // Has the same lifetime as TabContents, which owns us
111 // (transitively via InfoBarService).
112 PluginObserver* observer_;
113
114 string16 message_;
115
116 DISALLOW_COPY_AND_ASSIGN(OutdatedPluginInfoBarDelegate);
117 };
118
119 // The main purpose for this class is to popup/close the infobar when there is
120 // a missing plugin.
121 class PluginInstallerInfoBarDelegate : public ConfirmInfoBarDelegate,
122 public WeakPluginInstallerObserver {
123 public:
124 // Shows an infobar asking whether to install the plugin represented by
125 // |installer|. When the user accepts, |callback| is called.
126 // During installation of the plug-in, the infobar will change to reflect the
127 // installation state.
128 static InfoBarDelegate* Create(InfoBarService* infobar_service,
129 PluginInstaller* installer,
130 const base::Closure& callback);
131
132 private:
133 friend class OutdatedPluginInfoBarDelegate;
134
135 PluginInstallerInfoBarDelegate(InfoBarService* infobar_service,
136 PluginInstaller* installer,
137 const base::Closure& callback,
138 bool new_install,
139 const string16& message);
140 virtual ~PluginInstallerInfoBarDelegate();
141
142 // ConfirmInfoBarDelegate:
143 virtual gfx::Image* GetIcon() const OVERRIDE;
144 virtual string16 GetMessageText() const OVERRIDE;
145 virtual int GetButtons() const OVERRIDE;
146 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
147 virtual bool Accept() OVERRIDE;
148 virtual string16 GetLinkText() const OVERRIDE;
149 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE;
150
151 // PluginInstallerObserver:
152 virtual void DownloadStarted() OVERRIDE;
153 virtual void DownloadError(const std::string& message) OVERRIDE;
154 virtual void DownloadCancelled() OVERRIDE;
155 virtual void DownloadFinished() OVERRIDE;
156
157 // WeakPluginInstallerObserver:
158 virtual void OnlyWeakObserversLeft() OVERRIDE;
159
160 // Replaces this infobar with one showing |message|. The new infobar will
161 // not have any buttons (and not call the callback).
162 void ReplaceWithInfoBar(const string16& message);
163
164 base::Closure callback_;
165
166 // True iff the plug-in isn't installed yet.
167 bool new_install_;
168
169 string16 message_;
170
171 DISALLOW_COPY_AND_ASSIGN(PluginInstallerInfoBarDelegate);
172 };
173 #endif // defined(ENABLE_PLUGIN_INSTALLATION)
174
175 #if defined(OS_WIN)
176 class PluginMetroModeInfoBarDelegate : public ConfirmInfoBarDelegate {
177 public:
178 // Shows an infobar asking the user to switch to desktop chrome if they
179 // want to use the plugin.
180 static InfoBarDelegate* Create(InfoBarService* infobar_service,
181 const string16& plugin_name);
182 private:
183 PluginMetroModeInfoBarDelegate(InfoBarService* infobar_service,
184 const string16& message);
185 virtual ~PluginMetroModeInfoBarDelegate();
186
187 // ConfirmInfoBarDelegate:
188 virtual gfx::Image* GetIcon() const OVERRIDE;
189 virtual string16 GetMessageText() const OVERRIDE;
190 virtual int GetButtons() const OVERRIDE;
191 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
192 virtual bool Accept() OVERRIDE;
193 virtual string16 GetLinkText() const OVERRIDE;
194 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE;
195
196 string16 message_;
197
198 DISALLOW_COPY_AND_ASSIGN(PluginMetroModeInfoBarDelegate);
199 };
200 #endif // defined(OS_WIN)
201
202 #endif // CHROME_BROWSER_PLUGIN_INFOBAR_DELEGATES_H_
OLDNEW
« no previous file with comments | « chrome/browser/plugin_finder_unittest.cc ('k') | chrome/browser/plugin_infobar_delegates.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698