| 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 <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 10 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 11 #include "chrome/browser/infobars/infobar_service.h" | 13 #include "chrome/browser/infobars/infobar_service.h" |
| 12 #include "chrome/browser/lifetime/application_lifetime.h" | 14 #include "chrome/browser/lifetime/application_lifetime.h" |
| 13 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 15 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
| 14 #include "chrome/browser/plugins/plugin_metadata.h" | 16 #include "chrome/browser/plugins/plugin_metadata.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/shell_integration.h" | 18 #include "chrome/browser/shell_integration.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 55 |
| 54 void OutdatedPluginInfoBarDelegate::Create( | 56 void OutdatedPluginInfoBarDelegate::Create( |
| 55 InfoBarService* infobar_service, | 57 InfoBarService* infobar_service, |
| 56 PluginInstaller* installer, | 58 PluginInstaller* installer, |
| 57 scoped_ptr<PluginMetadata> plugin_metadata) { | 59 scoped_ptr<PluginMetadata> plugin_metadata) { |
| 58 // Copy the name out of |plugin_metadata| now, since the Pass() call below | 60 // Copy the name out of |plugin_metadata| now, since the Pass() call below |
| 59 // will make it impossible to get at. | 61 // will make it impossible to get at. |
| 60 base::string16 name(plugin_metadata->name()); | 62 base::string16 name(plugin_metadata->name()); |
| 61 infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( | 63 infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( |
| 62 scoped_ptr<ConfirmInfoBarDelegate>(new OutdatedPluginInfoBarDelegate( | 64 scoped_ptr<ConfirmInfoBarDelegate>(new OutdatedPluginInfoBarDelegate( |
| 63 installer, plugin_metadata.Pass(), | 65 installer, std::move(plugin_metadata), |
| 64 l10n_util::GetStringFUTF16( | 66 l10n_util::GetStringFUTF16( |
| 65 (installer->state() == PluginInstaller::INSTALLER_STATE_IDLE) ? | 67 (installer->state() == PluginInstaller::INSTALLER_STATE_IDLE) |
| 66 IDS_PLUGIN_OUTDATED_PROMPT : IDS_PLUGIN_DOWNLOADING, | 68 ? IDS_PLUGIN_OUTDATED_PROMPT |
| 69 : IDS_PLUGIN_DOWNLOADING, |
| 67 name))))); | 70 name))))); |
| 68 } | 71 } |
| 69 | 72 |
| 70 OutdatedPluginInfoBarDelegate::OutdatedPluginInfoBarDelegate( | 73 OutdatedPluginInfoBarDelegate::OutdatedPluginInfoBarDelegate( |
| 71 PluginInstaller* installer, | 74 PluginInstaller* installer, |
| 72 scoped_ptr<PluginMetadata> plugin_metadata, | 75 scoped_ptr<PluginMetadata> plugin_metadata, |
| 73 const base::string16& message) | 76 const base::string16& message) |
| 74 : ConfirmInfoBarDelegate(), | 77 : ConfirmInfoBarDelegate(), |
| 75 WeakPluginInstallerObserver(installer), | 78 WeakPluginInstallerObserver(installer), |
| 76 identifier_(plugin_metadata->identifier()), | 79 identifier_(plugin_metadata->identifier()), |
| 77 plugin_metadata_(plugin_metadata.Pass()), | 80 plugin_metadata_(std::move(plugin_metadata)), |
| 78 message_(message) { | 81 message_(message) { |
| 79 content::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Shown")); | 82 content::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Shown")); |
| 80 std::string name = base::UTF16ToUTF8(plugin_metadata_->name()); | 83 std::string name = base::UTF16ToUTF8(plugin_metadata_->name()); |
| 81 if (name == PluginMetadata::kJavaGroupName) { | 84 if (name == PluginMetadata::kJavaGroupName) { |
| 82 content::RecordAction( | 85 content::RecordAction( |
| 83 UserMetricsAction("OutdatedPluginInfobar.Shown.Java")); | 86 UserMetricsAction("OutdatedPluginInfobar.Shown.Java")); |
| 84 } else if (name == PluginMetadata::kQuickTimeGroupName) { | 87 } else if (name == PluginMetadata::kQuickTimeGroupName) { |
| 85 content::RecordAction( | 88 content::RecordAction( |
| 86 UserMetricsAction("OutdatedPluginInfobar.Shown.QuickTime")); | 89 UserMetricsAction("OutdatedPluginInfobar.Shown.QuickTime")); |
| 87 } else if (name == PluginMetadata::kShockwaveGroupName) { | 90 } else if (name == PluginMetadata::kShockwaveGroupName) { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 void OutdatedPluginInfoBarDelegate::Replace( | 207 void OutdatedPluginInfoBarDelegate::Replace( |
| 205 infobars::InfoBar* infobar, | 208 infobars::InfoBar* infobar, |
| 206 PluginInstaller* installer, | 209 PluginInstaller* installer, |
| 207 scoped_ptr<PluginMetadata> plugin_metadata, | 210 scoped_ptr<PluginMetadata> plugin_metadata, |
| 208 const base::string16& message) { | 211 const base::string16& message) { |
| 209 DCHECK(infobar->owner()); | 212 DCHECK(infobar->owner()); |
| 210 infobar->owner()->ReplaceInfoBar( | 213 infobar->owner()->ReplaceInfoBar( |
| 211 infobar, | 214 infobar, |
| 212 infobar->owner()->CreateConfirmInfoBar( | 215 infobar->owner()->CreateConfirmInfoBar( |
| 213 scoped_ptr<ConfirmInfoBarDelegate>(new OutdatedPluginInfoBarDelegate( | 216 scoped_ptr<ConfirmInfoBarDelegate>(new OutdatedPluginInfoBarDelegate( |
| 214 installer, plugin_metadata.Pass(), message)))); | 217 installer, std::move(plugin_metadata), message)))); |
| 215 } | 218 } |
| 216 | 219 |
| 217 #if defined(OS_WIN) | 220 #if defined(OS_WIN) |
| 218 | 221 |
| 219 // PluginMetroModeInfoBarDelegate --------------------------------------------- | 222 // PluginMetroModeInfoBarDelegate --------------------------------------------- |
| 220 | 223 |
| 221 // static | 224 // static |
| 222 void PluginMetroModeInfoBarDelegate::Create( | 225 void PluginMetroModeInfoBarDelegate::Create( |
| 223 InfoBarService* infobar_service, | 226 InfoBarService* infobar_service, |
| 224 PluginMetroModeInfoBarDelegate::Mode mode, | 227 PluginMetroModeInfoBarDelegate::Mode mode, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 GURL PluginMetroModeInfoBarDelegate::GetLinkURL() const { | 291 GURL PluginMetroModeInfoBarDelegate::GetLinkURL() const { |
| 289 return GURL( | 292 return GURL( |
| 290 (mode_ == MISSING_PLUGIN) | 293 (mode_ == MISSING_PLUGIN) |
| 291 ? "https://support.google.com/chrome/?p=ib_display_in_desktop" | 294 ? "https://support.google.com/chrome/?p=ib_display_in_desktop" |
| 292 : "https://support.google.com/chrome/?p=ib_redirect_to_desktop"); | 295 : "https://support.google.com/chrome/?p=ib_redirect_to_desktop"); |
| 293 } | 296 } |
| 294 | 297 |
| 295 #endif // defined(OS_WIN) | 298 #endif // defined(OS_WIN) |
| 296 | 299 |
| 297 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 300 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
| OLD | NEW |