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

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

Issue 1025303007: Remove PluginInstallerInfoBarDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
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"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // Infobar that's shown when a plugin is out of date. 48 // Infobar that's shown when a plugin is out of date.
49 class OutdatedPluginInfoBarDelegate : public PluginInfoBarDelegate, 49 class OutdatedPluginInfoBarDelegate : public PluginInfoBarDelegate,
50 public WeakPluginInstallerObserver { 50 public WeakPluginInstallerObserver {
51 public: 51 public:
52 // Creates an outdated plugin infobar and delegate and adds the infobar to 52 // Creates an outdated plugin infobar and delegate and adds the infobar to
53 // |infobar_service|. 53 // |infobar_service|.
54 static void Create(InfoBarService* infobar_service, 54 static void Create(InfoBarService* infobar_service,
55 PluginInstaller* installer, 55 PluginInstaller* installer,
56 scoped_ptr<PluginMetadata> metadata); 56 scoped_ptr<PluginMetadata> metadata);
57 57
58 // Replaces |infobar|, which must currently be owned, with an infobar asking
59 // the user to update a particular plugin.
60 static void Replace(infobars::InfoBar* infobar,
61 PluginInstaller* installer,
62 scoped_ptr<PluginMetadata> plugin_metadata,
63 const base::string16& message);
64
58 private: 65 private:
59 OutdatedPluginInfoBarDelegate(PluginInstaller* installer, 66 OutdatedPluginInfoBarDelegate(PluginInstaller* installer,
60 scoped_ptr<PluginMetadata> metadata, 67 scoped_ptr<PluginMetadata> metadata,
61 const base::string16& message); 68 const base::string16& message);
62 ~OutdatedPluginInfoBarDelegate() override; 69 ~OutdatedPluginInfoBarDelegate() override;
63 70
64 // PluginInfoBarDelegate: 71 // PluginInfoBarDelegate:
65 void InfoBarDismissed() override; 72 void InfoBarDismissed() override;
66 base::string16 GetMessageText() const override; 73 base::string16 GetMessageText() const override;
67 base::string16 GetButtonLabel(InfoBarButton button) const override; 74 base::string16 GetButtonLabel(InfoBarButton button) const override;
(...skipping 14 matching lines...) Expand all
82 // Replaces this infobar with one showing |message|. The new infobar will 89 // Replaces this infobar with one showing |message|. The new infobar will
83 // not have any buttons (and not call the callback). 90 // not have any buttons (and not call the callback).
84 void ReplaceWithInfoBar(const base::string16& message); 91 void ReplaceWithInfoBar(const base::string16& message);
85 92
86 scoped_ptr<PluginMetadata> plugin_metadata_; 93 scoped_ptr<PluginMetadata> plugin_metadata_;
87 94
88 base::string16 message_; 95 base::string16 message_;
89 96
90 DISALLOW_COPY_AND_ASSIGN(OutdatedPluginInfoBarDelegate); 97 DISALLOW_COPY_AND_ASSIGN(OutdatedPluginInfoBarDelegate);
91 }; 98 };
92
93 // The main purpose for this class is to popup/close the infobar when there is
94 // a missing plugin.
95 class PluginInstallerInfoBarDelegate : public ConfirmInfoBarDelegate,
96 public WeakPluginInstallerObserver {
97 public:
98 typedef base::Callback<void(const PluginMetadata*)> InstallCallback;
99
100 // Shows an infobar asking whether to install the plugin represented by
101 // |installer|. When the user accepts, |callback| is called.
102 // During installation of the plugin, the infobar will change to reflect the
103 // installation state.
104 static void Create(InfoBarService* infobar_service,
105 PluginInstaller* installer,
106 scoped_ptr<PluginMetadata> plugin_metadata,
107 const InstallCallback& callback);
108
109 // Replaces |infobar|, which must currently be owned, with an infobar asking
110 // the user to install or update a particular plugin.
111 static void Replace(infobars::InfoBar* infobar,
112 PluginInstaller* installer,
113 scoped_ptr<PluginMetadata> plugin_metadata,
114 bool new_install,
115 const base::string16& message);
116
117 private:
118 PluginInstallerInfoBarDelegate(PluginInstaller* installer,
119 scoped_ptr<PluginMetadata> metadata,
120 const InstallCallback& callback,
121 bool new_install,
122 const base::string16& message);
123 ~PluginInstallerInfoBarDelegate() override;
124
125 // ConfirmInfoBarDelegate:
126 int GetIconID() const override;
127 base::string16 GetMessageText() const override;
128 int GetButtons() const override;
129 base::string16 GetButtonLabel(InfoBarButton button) const override;
130 bool Accept() override;
131 base::string16 GetLinkText() const override;
132 bool LinkClicked(WindowOpenDisposition disposition) override;
133
134 // PluginInstallerObserver:
135 void DownloadStarted() override;
136 void DownloadError(const std::string& message) override;
137 void DownloadCancelled() override;
138 void DownloadFinished() override;
139
140 // WeakPluginInstallerObserver:
141 void OnlyWeakObserversLeft() override;
142
143 // Replaces this infobar with one showing |message|. The new infobar will
144 // not have any buttons (and not call the callback).
145 void ReplaceWithInfoBar(const base::string16& message);
146
147 scoped_ptr<PluginMetadata> plugin_metadata_;
148
149 InstallCallback callback_;
150
151 // True iff the plugin isn't installed yet.
152 bool new_install_;
153
154 base::string16 message_;
155
156 DISALLOW_COPY_AND_ASSIGN(PluginInstallerInfoBarDelegate);
157 };
158 #endif // defined(ENABLE_PLUGIN_INSTALLATION) 99 #endif // defined(ENABLE_PLUGIN_INSTALLATION)
159 100
160 #if defined(OS_WIN) 101 #if defined(OS_WIN)
161 class PluginMetroModeInfoBarDelegate : public ConfirmInfoBarDelegate { 102 class PluginMetroModeInfoBarDelegate : public ConfirmInfoBarDelegate {
162 public: 103 public:
163 // The infobar can be used for two purposes: to inform the user about a 104 // The infobar can be used for two purposes: to inform the user about a
164 // missing plugin or to note that a plugin only works in desktop mode. These 105 // missing plugin or to note that a plugin only works in desktop mode. These
165 // purposes require different messages, buttons, etc. 106 // purposes require different messages, buttons, etc.
166 enum Mode { 107 enum Mode {
167 MISSING_PLUGIN, 108 MISSING_PLUGIN,
(...skipping 20 matching lines...) Expand all
188 virtual bool LinkClicked(WindowOpenDisposition disposition) override; 129 virtual bool LinkClicked(WindowOpenDisposition disposition) override;
189 130
190 const Mode mode_; 131 const Mode mode_;
191 const base::string16 name_; 132 const base::string16 name_;
192 133
193 DISALLOW_COPY_AND_ASSIGN(PluginMetroModeInfoBarDelegate); 134 DISALLOW_COPY_AND_ASSIGN(PluginMetroModeInfoBarDelegate);
194 }; 135 };
195 #endif // defined(OS_WIN) 136 #endif // defined(OS_WIN)
196 137
197 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_INFOBAR_DELEGATES_H_ 138 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_INFOBAR_DELEGATES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698