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 #include "chrome/browser/plugins/plugin_observer.h" | 5 #include "chrome/browser/plugins/plugin_observer.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/debug/crash_logging.h" | 9 #include "base/debug/crash_logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // ConfirmInstallDialogDelegate ------------------------------------------------ | 57 // ConfirmInstallDialogDelegate ------------------------------------------------ |
58 | 58 |
59 class ConfirmInstallDialogDelegate : public TabModalConfirmDialogDelegate, | 59 class ConfirmInstallDialogDelegate : public TabModalConfirmDialogDelegate, |
60 public WeakPluginInstallerObserver { | 60 public WeakPluginInstallerObserver { |
61 public: | 61 public: |
62 ConfirmInstallDialogDelegate(content::WebContents* web_contents, | 62 ConfirmInstallDialogDelegate(content::WebContents* web_contents, |
63 PluginInstaller* installer, | 63 PluginInstaller* installer, |
64 scoped_ptr<PluginMetadata> plugin_metadata); | 64 scoped_ptr<PluginMetadata> plugin_metadata); |
65 | 65 |
66 // TabModalConfirmDialogDelegate methods: | 66 // TabModalConfirmDialogDelegate methods: |
67 virtual base::string16 GetTitle() OVERRIDE; | 67 virtual base::string16 GetTitle() override; |
68 virtual base::string16 GetDialogMessage() OVERRIDE; | 68 virtual base::string16 GetDialogMessage() override; |
69 virtual base::string16 GetAcceptButtonTitle() OVERRIDE; | 69 virtual base::string16 GetAcceptButtonTitle() override; |
70 virtual void OnAccepted() OVERRIDE; | 70 virtual void OnAccepted() override; |
71 virtual void OnCanceled() OVERRIDE; | 71 virtual void OnCanceled() override; |
72 | 72 |
73 // WeakPluginInstallerObserver methods: | 73 // WeakPluginInstallerObserver methods: |
74 virtual void DownloadStarted() OVERRIDE; | 74 virtual void DownloadStarted() override; |
75 virtual void OnlyWeakObserversLeft() OVERRIDE; | 75 virtual void OnlyWeakObserversLeft() override; |
76 | 76 |
77 private: | 77 private: |
78 content::WebContents* web_contents_; | 78 content::WebContents* web_contents_; |
79 scoped_ptr<PluginMetadata> plugin_metadata_; | 79 scoped_ptr<PluginMetadata> plugin_metadata_; |
80 }; | 80 }; |
81 | 81 |
82 ConfirmInstallDialogDelegate::ConfirmInstallDialogDelegate( | 82 ConfirmInstallDialogDelegate::ConfirmInstallDialogDelegate( |
83 content::WebContents* web_contents, | 83 content::WebContents* web_contents, |
84 PluginInstaller* installer, | 84 PluginInstaller* installer, |
85 scoped_ptr<PluginMetadata> plugin_metadata) | 85 scoped_ptr<PluginMetadata> plugin_metadata) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 static void Create(InfoBarService* infobar_service, | 127 static void Create(InfoBarService* infobar_service, |
128 content::NavigationController* controller, | 128 content::NavigationController* controller, |
129 const base::string16& message); | 129 const base::string16& message); |
130 | 130 |
131 private: | 131 private: |
132 ReloadPluginInfoBarDelegate(content::NavigationController* controller, | 132 ReloadPluginInfoBarDelegate(content::NavigationController* controller, |
133 const base::string16& message); | 133 const base::string16& message); |
134 virtual ~ReloadPluginInfoBarDelegate(); | 134 virtual ~ReloadPluginInfoBarDelegate(); |
135 | 135 |
136 // ConfirmInfobarDelegate: | 136 // ConfirmInfobarDelegate: |
137 virtual int GetIconID() const OVERRIDE; | 137 virtual int GetIconID() const override; |
138 virtual base::string16 GetMessageText() const OVERRIDE; | 138 virtual base::string16 GetMessageText() const override; |
139 virtual int GetButtons() const OVERRIDE; | 139 virtual int GetButtons() const override; |
140 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 140 virtual base::string16 GetButtonLabel(InfoBarButton button) const override; |
141 virtual bool Accept() OVERRIDE; | 141 virtual bool Accept() override; |
142 | 142 |
143 content::NavigationController* controller_; | 143 content::NavigationController* controller_; |
144 base::string16 message_; | 144 base::string16 message_; |
145 }; | 145 }; |
146 | 146 |
147 // static | 147 // static |
148 void ReloadPluginInfoBarDelegate::Create( | 148 void ReloadPluginInfoBarDelegate::Create( |
149 InfoBarService* infobar_service, | 149 InfoBarService* infobar_service, |
150 content::NavigationController* controller, | 150 content::NavigationController* controller, |
151 const base::string16& message) { | 151 const base::string16& message) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 break; | 207 break; |
208 } | 208 } |
209 case PluginInstaller::INSTALLER_STATE_DOWNLOADING: { | 209 case PluginInstaller::INSTALLER_STATE_DOWNLOADING: { |
210 DownloadStarted(); | 210 DownloadStarted(); |
211 break; | 211 break; |
212 } | 212 } |
213 } | 213 } |
214 } | 214 } |
215 | 215 |
216 // PluginInstallerObserver methods: | 216 // PluginInstallerObserver methods: |
217 virtual void DownloadStarted() OVERRIDE { | 217 virtual void DownloadStarted() override { |
218 observer_->Send(new ChromeViewMsg_StartedDownloadingPlugin(routing_id_)); | 218 observer_->Send(new ChromeViewMsg_StartedDownloadingPlugin(routing_id_)); |
219 } | 219 } |
220 | 220 |
221 virtual void DownloadError(const std::string& msg) OVERRIDE { | 221 virtual void DownloadError(const std::string& msg) override { |
222 observer_->Send(new ChromeViewMsg_ErrorDownloadingPlugin(routing_id_, msg)); | 222 observer_->Send(new ChromeViewMsg_ErrorDownloadingPlugin(routing_id_, msg)); |
223 } | 223 } |
224 | 224 |
225 virtual void DownloadCancelled() OVERRIDE { | 225 virtual void DownloadCancelled() override { |
226 observer_->Send(new ChromeViewMsg_CancelledDownloadingPlugin(routing_id_)); | 226 observer_->Send(new ChromeViewMsg_CancelledDownloadingPlugin(routing_id_)); |
227 } | 227 } |
228 | 228 |
229 virtual void DownloadFinished() OVERRIDE { | 229 virtual void DownloadFinished() override { |
230 observer_->Send(new ChromeViewMsg_FinishedDownloadingPlugin(routing_id_)); | 230 observer_->Send(new ChromeViewMsg_FinishedDownloadingPlugin(routing_id_)); |
231 } | 231 } |
232 | 232 |
233 private: | 233 private: |
234 // Weak pointer; owns us. | 234 // Weak pointer; owns us. |
235 PluginObserver* observer_; | 235 PluginObserver* observer_; |
236 | 236 |
237 int routing_id_; | 237 int routing_id_; |
238 }; | 238 }; |
239 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 239 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 scoped_ptr<PluginMetadata> plugin; | 492 scoped_ptr<PluginMetadata> plugin; |
493 bool ret = PluginFinder::GetInstance()->FindPluginWithIdentifier( | 493 bool ret = PluginFinder::GetInstance()->FindPluginWithIdentifier( |
494 identifier, NULL, &plugin); | 494 identifier, NULL, &plugin); |
495 DCHECK(ret); | 495 DCHECK(ret); |
496 | 496 |
497 PluginMetroModeInfoBarDelegate::Create( | 497 PluginMetroModeInfoBarDelegate::Create( |
498 InfoBarService::FromWebContents(web_contents()), | 498 InfoBarService::FromWebContents(web_contents()), |
499 PluginMetroModeInfoBarDelegate::DESKTOP_MODE_REQUIRED, plugin->name()); | 499 PluginMetroModeInfoBarDelegate::DESKTOP_MODE_REQUIRED, plugin->name()); |
500 #endif | 500 #endif |
501 } | 501 } |
OLD | NEW |