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 <utility> |
| 8 |
7 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 10 #include "base/bind.h" |
9 #include "base/debug/crash_logging.h" | 11 #include "base/debug/crash_logging.h" |
10 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
11 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
12 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
13 #include "build/build_config.h" | 15 #include "build/build_config.h" |
14 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/infobars/infobar_service.h" | 17 #include "chrome/browser/infobars/infobar_service.h" |
16 #include "chrome/browser/lifetime/application_lifetime.h" | 18 #include "chrome/browser/lifetime/application_lifetime.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 scoped_ptr<PluginMetadata> plugin_metadata_; | 85 scoped_ptr<PluginMetadata> plugin_metadata_; |
84 }; | 86 }; |
85 | 87 |
86 ConfirmInstallDialogDelegate::ConfirmInstallDialogDelegate( | 88 ConfirmInstallDialogDelegate::ConfirmInstallDialogDelegate( |
87 content::WebContents* web_contents, | 89 content::WebContents* web_contents, |
88 PluginInstaller* installer, | 90 PluginInstaller* installer, |
89 scoped_ptr<PluginMetadata> plugin_metadata) | 91 scoped_ptr<PluginMetadata> plugin_metadata) |
90 : TabModalConfirmDialogDelegate(web_contents), | 92 : TabModalConfirmDialogDelegate(web_contents), |
91 WeakPluginInstallerObserver(installer), | 93 WeakPluginInstallerObserver(installer), |
92 web_contents_(web_contents), | 94 web_contents_(web_contents), |
93 plugin_metadata_(plugin_metadata.Pass()) { | 95 plugin_metadata_(std::move(plugin_metadata)) {} |
94 } | |
95 | 96 |
96 base::string16 ConfirmInstallDialogDelegate::GetTitle() { | 97 base::string16 ConfirmInstallDialogDelegate::GetTitle() { |
97 return l10n_util::GetStringFUTF16( | 98 return l10n_util::GetStringFUTF16( |
98 IDS_PLUGIN_CONFIRM_INSTALL_DIALOG_TITLE, plugin_metadata_->name()); | 99 IDS_PLUGIN_CONFIRM_INSTALL_DIALOG_TITLE, plugin_metadata_->name()); |
99 } | 100 } |
100 | 101 |
101 base::string16 ConfirmInstallDialogDelegate::GetDialogMessage() { | 102 base::string16 ConfirmInstallDialogDelegate::GetDialogMessage() { |
102 return l10n_util::GetStringFUTF16(IDS_PLUGIN_CONFIRM_INSTALL_DIALOG_MSG, | 103 return l10n_util::GetStringFUTF16(IDS_PLUGIN_CONFIRM_INSTALL_DIALOG_MSG, |
103 plugin_metadata_->name()); | 104 plugin_metadata_->name()); |
104 } | 105 } |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 void PluginObserver::OnBlockedOutdatedPlugin(int placeholder_id, | 376 void PluginObserver::OnBlockedOutdatedPlugin(int placeholder_id, |
376 const std::string& identifier) { | 377 const std::string& identifier) { |
377 #if defined(ENABLE_PLUGIN_INSTALLATION) | 378 #if defined(ENABLE_PLUGIN_INSTALLATION) |
378 PluginFinder* finder = PluginFinder::GetInstance(); | 379 PluginFinder* finder = PluginFinder::GetInstance(); |
379 // Find plugin to update. | 380 // Find plugin to update. |
380 PluginInstaller* installer = NULL; | 381 PluginInstaller* installer = NULL; |
381 scoped_ptr<PluginMetadata> plugin; | 382 scoped_ptr<PluginMetadata> plugin; |
382 if (finder->FindPluginWithIdentifier(identifier, &installer, &plugin)) { | 383 if (finder->FindPluginWithIdentifier(identifier, &installer, &plugin)) { |
383 plugin_placeholders_[placeholder_id] = new PluginPlaceholderHost( | 384 plugin_placeholders_[placeholder_id] = new PluginPlaceholderHost( |
384 this, placeholder_id, plugin->name(), installer); | 385 this, placeholder_id, plugin->name(), installer); |
385 OutdatedPluginInfoBarDelegate::Create(InfoBarService::FromWebContents( | 386 OutdatedPluginInfoBarDelegate::Create( |
386 web_contents()), installer, plugin.Pass()); | 387 InfoBarService::FromWebContents(web_contents()), installer, |
| 388 std::move(plugin)); |
387 } else { | 389 } else { |
388 NOTREACHED(); | 390 NOTREACHED(); |
389 } | 391 } |
390 #else | 392 #else |
391 // If we don't support third-party plugin installation, we shouldn't have | 393 // If we don't support third-party plugin installation, we shouldn't have |
392 // outdated plugins. | 394 // outdated plugins. |
393 NOTREACHED(); | 395 NOTREACHED(); |
394 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 396 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
395 } | 397 } |
396 | 398 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 scoped_ptr<PluginMetadata> plugin; | 447 scoped_ptr<PluginMetadata> plugin; |
446 bool ret = PluginFinder::GetInstance()->FindPluginWithIdentifier( | 448 bool ret = PluginFinder::GetInstance()->FindPluginWithIdentifier( |
447 identifier, NULL, &plugin); | 449 identifier, NULL, &plugin); |
448 DCHECK(ret); | 450 DCHECK(ret); |
449 | 451 |
450 PluginMetroModeInfoBarDelegate::Create( | 452 PluginMetroModeInfoBarDelegate::Create( |
451 InfoBarService::FromWebContents(web_contents()), | 453 InfoBarService::FromWebContents(web_contents()), |
452 PluginMetroModeInfoBarDelegate::DESKTOP_MODE_REQUIRED, plugin->name()); | 454 PluginMetroModeInfoBarDelegate::DESKTOP_MODE_REQUIRED, plugin->name()); |
453 #endif | 455 #endif |
454 } | 456 } |
OLD | NEW |