| 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_infobar_delegates.h" | 5 #include "chrome/browser/plugins/plugin_infobar_delegates.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 // OutdatedPluginInfoBarDelegate ---------------------------------------------- | 85 // OutdatedPluginInfoBarDelegate ---------------------------------------------- |
| 86 | 86 |
| 87 void OutdatedPluginInfoBarDelegate::Create( | 87 void OutdatedPluginInfoBarDelegate::Create( |
| 88 InfoBarService* infobar_service, | 88 InfoBarService* infobar_service, |
| 89 PluginInstaller* installer, | 89 PluginInstaller* installer, |
| 90 scoped_ptr<PluginMetadata> plugin_metadata) { | 90 scoped_ptr<PluginMetadata> plugin_metadata) { |
| 91 // Copy the name out of |plugin_metadata| now, since the Pass() call below | 91 // Copy the name out of |plugin_metadata| now, since the Pass() call below |
| 92 // will make it impossible to get at. | 92 // will make it impossible to get at. |
| 93 base::string16 name(plugin_metadata->name()); | 93 base::string16 name(plugin_metadata->name()); |
| 94 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 94 infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( |
| 95 scoped_ptr<ConfirmInfoBarDelegate>(new OutdatedPluginInfoBarDelegate( | 95 scoped_ptr<ConfirmInfoBarDelegate>(new OutdatedPluginInfoBarDelegate( |
| 96 installer, plugin_metadata.Pass(), l10n_util::GetStringFUTF16( | 96 installer, plugin_metadata.Pass(), |
| 97 l10n_util::GetStringFUTF16( |
| 97 (installer->state() == PluginInstaller::INSTALLER_STATE_IDLE) ? | 98 (installer->state() == PluginInstaller::INSTALLER_STATE_IDLE) ? |
| 98 IDS_PLUGIN_OUTDATED_PROMPT : IDS_PLUGIN_DOWNLOADING, | 99 IDS_PLUGIN_OUTDATED_PROMPT : IDS_PLUGIN_DOWNLOADING, |
| 99 name))))); | 100 name))))); |
| 100 } | 101 } |
| 101 | 102 |
| 102 OutdatedPluginInfoBarDelegate::OutdatedPluginInfoBarDelegate( | 103 OutdatedPluginInfoBarDelegate::OutdatedPluginInfoBarDelegate( |
| 103 PluginInstaller* installer, | 104 PluginInstaller* installer, |
| 104 scoped_ptr<PluginMetadata> plugin_metadata, | 105 scoped_ptr<PluginMetadata> plugin_metadata, |
| 105 const base::string16& message) | 106 const base::string16& message) |
| 106 : PluginInfoBarDelegate(plugin_metadata->identifier()), | 107 : PluginInfoBarDelegate(plugin_metadata->identifier()), |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 scoped_ptr<PluginMetadata> plugin_metadata, | 226 scoped_ptr<PluginMetadata> plugin_metadata, |
| 226 const InstallCallback& callback) { | 227 const InstallCallback& callback) { |
| 227 base::string16 name(plugin_metadata->name()); | 228 base::string16 name(plugin_metadata->name()); |
| 228 #if defined(OS_WIN) | 229 #if defined(OS_WIN) |
| 229 if (base::win::IsMetroProcess()) { | 230 if (base::win::IsMetroProcess()) { |
| 230 PluginMetroModeInfoBarDelegate::Create( | 231 PluginMetroModeInfoBarDelegate::Create( |
| 231 infobar_service, PluginMetroModeInfoBarDelegate::MISSING_PLUGIN, name); | 232 infobar_service, PluginMetroModeInfoBarDelegate::MISSING_PLUGIN, name); |
| 232 return; | 233 return; |
| 233 } | 234 } |
| 234 #endif | 235 #endif |
| 235 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 236 infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( |
| 236 scoped_ptr<ConfirmInfoBarDelegate>(new PluginInstallerInfoBarDelegate( | 237 scoped_ptr<ConfirmInfoBarDelegate>(new PluginInstallerInfoBarDelegate( |
| 237 installer, plugin_metadata.Pass(), callback, true, | 238 installer, plugin_metadata.Pass(), callback, true, |
| 238 l10n_util::GetStringFUTF16( | 239 l10n_util::GetStringFUTF16( |
| 239 (installer->state() == PluginInstaller::INSTALLER_STATE_IDLE) ? | 240 (installer->state() == PluginInstaller::INSTALLER_STATE_IDLE) |
| 240 IDS_PLUGININSTALLER_INSTALLPLUGIN_PROMPT : | 241 ? IDS_PLUGININSTALLER_INSTALLPLUGIN_PROMPT |
| 241 IDS_PLUGIN_DOWNLOADING, | 242 : IDS_PLUGIN_DOWNLOADING, |
| 242 name))))); | 243 name))))); |
| 243 } | 244 } |
| 244 | 245 |
| 245 void PluginInstallerInfoBarDelegate::Replace( | 246 void PluginInstallerInfoBarDelegate::Replace( |
| 246 infobars::InfoBar* infobar, | 247 infobars::InfoBar* infobar, |
| 247 PluginInstaller* installer, | 248 PluginInstaller* installer, |
| 248 scoped_ptr<PluginMetadata> plugin_metadata, | 249 scoped_ptr<PluginMetadata> plugin_metadata, |
| 249 bool new_install, | 250 bool new_install, |
| 250 const base::string16& message) { | 251 const base::string16& message) { |
| 251 DCHECK(infobar->owner()); | 252 DCHECK(infobar->owner()); |
| 252 infobar->owner()->ReplaceInfoBar(infobar, | 253 infobar->owner()->ReplaceInfoBar( |
| 253 ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( | 254 infobar, |
| 254 new PluginInstallerInfoBarDelegate( | 255 infobar->owner()->CreateConfirmInfoBar( |
| 256 scoped_ptr<ConfirmInfoBarDelegate>(new PluginInstallerInfoBarDelegate( |
| 255 installer, plugin_metadata.Pass(), | 257 installer, plugin_metadata.Pass(), |
| 256 PluginInstallerInfoBarDelegate::InstallCallback(), new_install, | 258 PluginInstallerInfoBarDelegate::InstallCallback(), new_install, |
| 257 message)))); | 259 message)))); |
| 258 } | 260 } |
| 259 | 261 |
| 260 PluginInstallerInfoBarDelegate::PluginInstallerInfoBarDelegate( | 262 PluginInstallerInfoBarDelegate::PluginInstallerInfoBarDelegate( |
| 261 PluginInstaller* installer, | 263 PluginInstaller* installer, |
| 262 scoped_ptr<PluginMetadata> plugin_metadata, | 264 scoped_ptr<PluginMetadata> plugin_metadata, |
| 263 const InstallCallback& callback, | 265 const InstallCallback& callback, |
| 264 bool new_install, | 266 bool new_install, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 360 |
| 359 #if defined(OS_WIN) | 361 #if defined(OS_WIN) |
| 360 | 362 |
| 361 // PluginMetroModeInfoBarDelegate --------------------------------------------- | 363 // PluginMetroModeInfoBarDelegate --------------------------------------------- |
| 362 | 364 |
| 363 // static | 365 // static |
| 364 void PluginMetroModeInfoBarDelegate::Create( | 366 void PluginMetroModeInfoBarDelegate::Create( |
| 365 InfoBarService* infobar_service, | 367 InfoBarService* infobar_service, |
| 366 PluginMetroModeInfoBarDelegate::Mode mode, | 368 PluginMetroModeInfoBarDelegate::Mode mode, |
| 367 const base::string16& name) { | 369 const base::string16& name) { |
| 368 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 370 infobar_service->AddInfoBar( |
| 369 scoped_ptr<ConfirmInfoBarDelegate>( | 371 infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( |
| 370 new PluginMetroModeInfoBarDelegate(mode, name)))); | 372 new PluginMetroModeInfoBarDelegate(mode, name)))); |
| 371 } | 373 } |
| 372 | 374 |
| 373 PluginMetroModeInfoBarDelegate::PluginMetroModeInfoBarDelegate( | 375 PluginMetroModeInfoBarDelegate::PluginMetroModeInfoBarDelegate( |
| 374 PluginMetroModeInfoBarDelegate::Mode mode, | 376 PluginMetroModeInfoBarDelegate::Mode mode, |
| 375 const base::string16& name) | 377 const base::string16& name) |
| 376 : ConfirmInfoBarDelegate(), | 378 : ConfirmInfoBarDelegate(), |
| 377 mode_(mode), | 379 mode_(mode), |
| 378 name_(name) { | 380 name_(name) { |
| 379 } | 381 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 "https://support.google.com/chrome/?p=ib_redirect_to_desktop"), | 436 "https://support.google.com/chrome/?p=ib_redirect_to_desktop"), |
| 435 content::Referrer(), | 437 content::Referrer(), |
| 436 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 438 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 437 ui::PAGE_TRANSITION_LINK, false)); | 439 ui::PAGE_TRANSITION_LINK, false)); |
| 438 return false; | 440 return false; |
| 439 } | 441 } |
| 440 | 442 |
| 441 #endif // defined(OS_WIN) | 443 #endif // defined(OS_WIN) |
| 442 | 444 |
| 443 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 445 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
| OLD | NEW |