| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(ConfirmInfoBarDelegate::CreateInfoBar( |
| 95 infobar_service, |
| 95 scoped_ptr<ConfirmInfoBarDelegate>(new OutdatedPluginInfoBarDelegate( | 96 scoped_ptr<ConfirmInfoBarDelegate>(new OutdatedPluginInfoBarDelegate( |
| 96 installer, plugin_metadata.Pass(), l10n_util::GetStringFUTF16( | 97 installer, plugin_metadata.Pass(), 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, |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(ConfirmInfoBarDelegate::CreateInfoBar( |
| 237 infobar_service, |
| 236 scoped_ptr<ConfirmInfoBarDelegate>(new PluginInstallerInfoBarDelegate( | 238 scoped_ptr<ConfirmInfoBarDelegate>(new PluginInstallerInfoBarDelegate( |
| 237 installer, plugin_metadata.Pass(), callback, true, | 239 installer, plugin_metadata.Pass(), callback, true, |
| 238 l10n_util::GetStringFUTF16( | 240 l10n_util::GetStringFUTF16( |
| 239 (installer->state() == PluginInstaller::INSTALLER_STATE_IDLE) ? | 241 (installer->state() == PluginInstaller::INSTALLER_STATE_IDLE) ? |
| 240 IDS_PLUGININSTALLER_INSTALLPLUGIN_PROMPT : | 242 IDS_PLUGININSTALLER_INSTALLPLUGIN_PROMPT : |
| 241 IDS_PLUGIN_DOWNLOADING, | 243 IDS_PLUGIN_DOWNLOADING, |
| 242 name))))); | 244 name))))); |
| 243 } | 245 } |
| 244 | 246 |
| 245 void PluginInstallerInfoBarDelegate::Replace( | 247 void PluginInstallerInfoBarDelegate::Replace( |
| 246 infobars::InfoBar* infobar, | 248 infobars::InfoBar* infobar, |
| 247 PluginInstaller* installer, | 249 PluginInstaller* installer, |
| 248 scoped_ptr<PluginMetadata> plugin_metadata, | 250 scoped_ptr<PluginMetadata> plugin_metadata, |
| 249 bool new_install, | 251 bool new_install, |
| 250 const base::string16& message) { | 252 const base::string16& message) { |
| 251 DCHECK(infobar->owner()); | 253 DCHECK(infobar->owner()); |
| 252 infobar->owner()->ReplaceInfoBar(infobar, | 254 infobar->owner()->ReplaceInfoBar( |
| 253 ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( | 255 infobar, |
| 254 new PluginInstallerInfoBarDelegate( | 256 ConfirmInfoBarDelegate::CreateInfoBar( |
| 257 infobar->owner(), |
| 258 scoped_ptr<ConfirmInfoBarDelegate>(new PluginInstallerInfoBarDelegate( |
| 255 installer, plugin_metadata.Pass(), | 259 installer, plugin_metadata.Pass(), |
| 256 PluginInstallerInfoBarDelegate::InstallCallback(), new_install, | 260 PluginInstallerInfoBarDelegate::InstallCallback(), new_install, |
| 257 message)))); | 261 message)))); |
| 258 } | 262 } |
| 259 | 263 |
| 260 PluginInstallerInfoBarDelegate::PluginInstallerInfoBarDelegate( | 264 PluginInstallerInfoBarDelegate::PluginInstallerInfoBarDelegate( |
| 261 PluginInstaller* installer, | 265 PluginInstaller* installer, |
| 262 scoped_ptr<PluginMetadata> plugin_metadata, | 266 scoped_ptr<PluginMetadata> plugin_metadata, |
| 263 const InstallCallback& callback, | 267 const InstallCallback& callback, |
| 264 bool new_install, | 268 bool new_install, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 #if defined(OS_WIN) | 363 #if defined(OS_WIN) |
| 360 | 364 |
| 361 // PluginMetroModeInfoBarDelegate --------------------------------------------- | 365 // PluginMetroModeInfoBarDelegate --------------------------------------------- |
| 362 | 366 |
| 363 // static | 367 // static |
| 364 void PluginMetroModeInfoBarDelegate::Create( | 368 void PluginMetroModeInfoBarDelegate::Create( |
| 365 InfoBarService* infobar_service, | 369 InfoBarService* infobar_service, |
| 366 PluginMetroModeInfoBarDelegate::Mode mode, | 370 PluginMetroModeInfoBarDelegate::Mode mode, |
| 367 const base::string16& name) { | 371 const base::string16& name) { |
| 368 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 372 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( |
| 369 scoped_ptr<ConfirmInfoBarDelegate>( | 373 infobar_service, scoped_ptr<ConfirmInfoBarDelegate>( |
| 370 new PluginMetroModeInfoBarDelegate(mode, name)))); | 374 new PluginMetroModeInfoBarDelegate(mode, name)))); |
| 371 } | 375 } |
| 372 | 376 |
| 373 PluginMetroModeInfoBarDelegate::PluginMetroModeInfoBarDelegate( | 377 PluginMetroModeInfoBarDelegate::PluginMetroModeInfoBarDelegate( |
| 374 PluginMetroModeInfoBarDelegate::Mode mode, | 378 PluginMetroModeInfoBarDelegate::Mode mode, |
| 375 const base::string16& name) | 379 const base::string16& name) |
| 376 : ConfirmInfoBarDelegate(), | 380 : ConfirmInfoBarDelegate(), |
| 377 mode_(mode), | 381 mode_(mode), |
| 378 name_(name) { | 382 name_(name) { |
| 379 } | 383 } |
| 380 | 384 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 "https://support.google.com/chrome/?p=ib_redirect_to_desktop"), | 438 "https://support.google.com/chrome/?p=ib_redirect_to_desktop"), |
| 435 content::Referrer(), | 439 content::Referrer(), |
| 436 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 440 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 437 ui::PAGE_TRANSITION_LINK, false)); | 441 ui::PAGE_TRANSITION_LINK, false)); |
| 438 return false; | 442 return false; |
| 439 } | 443 } |
| 440 | 444 |
| 441 #endif // defined(OS_WIN) | 445 #endif // defined(OS_WIN) |
| 442 | 446 |
| 443 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 447 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
| OLD | NEW |