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/plugin_infobar_delegates.h" | 5 #include "chrome/browser/plugin_infobar_delegates.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/content_settings/host_content_settings_map.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map.h" |
9 #include "chrome/browser/google/google_util.h" | 9 #include "chrome/browser/google/google_util.h" |
10 #include "chrome/browser/infobars/infobar_tab_helper.h" | 10 #include "chrome/browser/infobars/infobar_tab_helper.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 } | 143 } |
144 | 144 |
145 #if defined(ENABLE_PLUGIN_INSTALLATION) | 145 #if defined(ENABLE_PLUGIN_INSTALLATION) |
146 // OutdatedPluginInfoBarDelegate ---------------------------------------------- | 146 // OutdatedPluginInfoBarDelegate ---------------------------------------------- |
147 | 147 |
148 InfoBarDelegate* OutdatedPluginInfoBarDelegate::Create( | 148 InfoBarDelegate* OutdatedPluginInfoBarDelegate::Create( |
149 PluginObserver* observer, | 149 PluginObserver* observer, |
150 PluginInstaller* installer) { | 150 PluginInstaller* installer) { |
151 string16 message; | 151 string16 message; |
152 switch (installer->state()) { | 152 switch (installer->state()) { |
153 case PluginInstaller::kStateIdle: | 153 case PluginInstaller::INSTALLER_STATE_IDLE: |
jochen (gone - plz use gerrit)
2012/05/18 18:48:18
any reason you change this instead of making the s
Bernhard Bauer
2012/05/21 10:52:27
The Chromium style (http://dev.chromium.org/develo
| |
154 message = l10n_util::GetStringFUTF16(IDS_PLUGIN_OUTDATED_PROMPT, | 154 message = l10n_util::GetStringFUTF16(IDS_PLUGIN_OUTDATED_PROMPT, |
155 installer->name()); | 155 installer->name()); |
156 break; | 156 break; |
157 case PluginInstaller::kStateDownloading: | 157 case PluginInstaller::INSTALLER_STATE_DOWNLOADING: |
158 message = l10n_util::GetStringFUTF16(IDS_PLUGIN_DOWNLOADING, | 158 message = l10n_util::GetStringFUTF16(IDS_PLUGIN_DOWNLOADING, |
159 installer->name()); | 159 installer->name()); |
160 break; | 160 break; |
161 } | 161 } |
162 return new OutdatedPluginInfoBarDelegate( | 162 return new OutdatedPluginInfoBarDelegate( |
163 observer, installer, message); | 163 observer, installer, message); |
164 } | 164 } |
165 | 165 |
166 OutdatedPluginInfoBarDelegate::OutdatedPluginInfoBarDelegate( | 166 OutdatedPluginInfoBarDelegate::OutdatedPluginInfoBarDelegate( |
167 PluginObserver* observer, | 167 PluginObserver* observer, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 } | 209 } |
210 | 210 |
211 string16 OutdatedPluginInfoBarDelegate::GetButtonLabel( | 211 string16 OutdatedPluginInfoBarDelegate::GetButtonLabel( |
212 InfoBarButton button) const { | 212 InfoBarButton button) const { |
213 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? | 213 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? |
214 IDS_PLUGIN_UPDATE : IDS_PLUGIN_ENABLE_TEMPORARILY); | 214 IDS_PLUGIN_UPDATE : IDS_PLUGIN_ENABLE_TEMPORARILY); |
215 } | 215 } |
216 | 216 |
217 bool OutdatedPluginInfoBarDelegate::Accept() { | 217 bool OutdatedPluginInfoBarDelegate::Accept() { |
218 content::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Update")); | 218 content::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Update")); |
219 if (installer()->state() != PluginInstaller::kStateIdle) { | 219 if (installer()->state() != PluginInstaller::INSTALLER_STATE_IDLE) { |
220 NOTREACHED(); | 220 NOTREACHED(); |
221 return false; | 221 return false; |
222 } | 222 } |
223 | 223 |
224 content::WebContents* web_contents = owner()->web_contents(); | 224 content::WebContents* web_contents = owner()->web_contents(); |
225 if (installer()->url_for_display()) { | 225 if (installer()->url_for_display()) { |
226 installer()->OpenDownloadURL(web_contents); | 226 installer()->OpenDownloadURL(web_contents); |
227 } else { | 227 } else { |
228 installer()->StartInstalling(observer_->tab_contents_wrapper()); | 228 installer()->StartInstalling(observer_->tab_contents_wrapper()); |
229 } | 229 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
307 PluginInstallerInfoBarDelegate::~PluginInstallerInfoBarDelegate() { | 307 PluginInstallerInfoBarDelegate::~PluginInstallerInfoBarDelegate() { |
308 } | 308 } |
309 | 309 |
310 InfoBarDelegate* PluginInstallerInfoBarDelegate::Create( | 310 InfoBarDelegate* PluginInstallerInfoBarDelegate::Create( |
311 InfoBarTabHelper* infobar_helper, | 311 InfoBarTabHelper* infobar_helper, |
312 PluginInstaller* installer, | 312 PluginInstaller* installer, |
313 const base::Closure& callback) { | 313 const base::Closure& callback) { |
314 string16 message; | 314 string16 message; |
315 const string16& plugin_name = installer->name(); | 315 const string16& plugin_name = installer->name(); |
316 switch (installer->state()) { | 316 switch (installer->state()) { |
317 case PluginInstaller::kStateIdle: | 317 case PluginInstaller::INSTALLER_STATE_IDLE: |
318 message = l10n_util::GetStringFUTF16( | 318 message = l10n_util::GetStringFUTF16( |
319 IDS_PLUGININSTALLER_INSTALLPLUGIN_PROMPT, plugin_name); | 319 IDS_PLUGININSTALLER_INSTALLPLUGIN_PROMPT, plugin_name); |
320 break; | 320 break; |
321 case PluginInstaller::kStateDownloading: | 321 case PluginInstaller::INSTALLER_STATE_DOWNLOADING: |
322 message = l10n_util::GetStringFUTF16(IDS_PLUGIN_DOWNLOADING, plugin_name); | 322 message = l10n_util::GetStringFUTF16(IDS_PLUGIN_DOWNLOADING, plugin_name); |
323 break; | 323 break; |
324 } | 324 } |
325 return new PluginInstallerInfoBarDelegate( | 325 return new PluginInstallerInfoBarDelegate( |
326 infobar_helper, installer, callback, true, message); | 326 infobar_helper, installer, callback, true, message); |
327 } | 327 } |
328 | 328 |
329 gfx::Image* PluginInstallerInfoBarDelegate::GetIcon() const { | 329 gfx::Image* PluginInstallerInfoBarDelegate::GetIcon() const { |
330 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 330 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
331 IDR_INFOBAR_PLUGIN_INSTALL); | 331 IDR_INFOBAR_PLUGIN_INSTALL); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
406 // keep replacing infobar delegates infinitely). | 406 // keep replacing infobar delegates infinitely). |
407 if (message_ == message) | 407 if (message_ == message) |
408 return; | 408 return; |
409 if (!owner()) | 409 if (!owner()) |
410 return; | 410 return; |
411 InfoBarDelegate* delegate = new PluginInstallerInfoBarDelegate( | 411 InfoBarDelegate* delegate = new PluginInstallerInfoBarDelegate( |
412 owner(), installer(), base::Closure(), new_install_, message); | 412 owner(), installer(), base::Closure(), new_install_, message); |
413 owner()->ReplaceInfoBar(this, delegate); | 413 owner()->ReplaceInfoBar(this, delegate); |
414 } | 414 } |
415 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 415 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
OLD | NEW |