Chromium Code Reviews| 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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/debug/crash_logging.h" | 9 #include "base/debug/crash_logging.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/content_settings/host_content_settings_map.h" | 14 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 15 #include "chrome/browser/infobars/infobar_service.h" | 15 #include "chrome/browser/infobars/infobar_service.h" |
| 16 #include "chrome/browser/infobars/simple_alert_infobar_delegate.h" | 16 #include "chrome/browser/infobars/simple_alert_infobar_delegate.h" |
| 17 #include "chrome/browser/lifetime/application_lifetime.h" | 17 #include "chrome/browser/lifetime/application_lifetime.h" |
| 18 #include "chrome/browser/metrics/metrics_service.h" | 18 #include "chrome/browser/metrics/plugin_metrics_provider.h" |
| 19 #include "chrome/browser/plugins/plugin_finder.h" | 19 #include "chrome/browser/plugins/plugin_finder.h" |
| 20 #include "chrome/browser/plugins/plugin_infobar_delegates.h" | 20 #include "chrome/browser/plugins/plugin_infobar_delegates.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" | 22 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" |
| 23 #include "chrome/common/render_messages.h" | 23 #include "chrome/common/render_messages.h" |
| 24 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
| 25 #include "components/infobars/core/confirm_infobar_delegate.h" | 25 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 26 #include "components/infobars/core/infobar.h" | 26 #include "components/infobars/core/infobar.h" |
| 27 #include "content/public/browser/plugin_service.h" | 27 #include "content/public/browser/plugin_service.h" |
| 28 #include "content/public/browser/render_frame_host.h" | 28 #include "content/public/browser/render_frame_host.h" |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 449 | 449 |
| 450 void PluginObserver::OnOpenAboutPlugins() { | 450 void PluginObserver::OnOpenAboutPlugins() { |
| 451 web_contents()->OpenURL(OpenURLParams( | 451 web_contents()->OpenURL(OpenURLParams( |
| 452 GURL(chrome::kChromeUIPluginsURL), | 452 GURL(chrome::kChromeUIPluginsURL), |
| 453 content::Referrer(web_contents()->GetURL(), | 453 content::Referrer(web_contents()->GetURL(), |
| 454 blink::WebReferrerPolicyDefault), | 454 blink::WebReferrerPolicyDefault), |
| 455 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_AUTO_BOOKMARK, false)); | 455 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_AUTO_BOOKMARK, false)); |
| 456 } | 456 } |
| 457 | 457 |
| 458 void PluginObserver::OnCouldNotLoadPlugin(const base::FilePath& plugin_path) { | 458 void PluginObserver::OnCouldNotLoadPlugin(const base::FilePath& plugin_path) { |
| 459 g_browser_process->metrics_service()->LogPluginLoadingError(plugin_path); | 459 g_browser_process->plugin_metrics_provider()->LogPluginLoadingError( |
|
blundell
2014/05/27 15:55:49
I assume that plugins are guaranteed to be enabled
| |
| 460 plugin_path); | |
| 460 base::string16 plugin_name = | 461 base::string16 plugin_name = |
| 461 PluginService::GetInstance()->GetPluginDisplayNameByPath(plugin_path); | 462 PluginService::GetInstance()->GetPluginDisplayNameByPath(plugin_path); |
| 462 SimpleAlertInfoBarDelegate::Create( | 463 SimpleAlertInfoBarDelegate::Create( |
| 463 InfoBarService::FromWebContents(web_contents()), | 464 InfoBarService::FromWebContents(web_contents()), |
| 464 IDR_INFOBAR_PLUGIN_CRASHED, | 465 IDR_INFOBAR_PLUGIN_CRASHED, |
| 465 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT, | 466 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT, |
| 466 plugin_name), | 467 plugin_name), |
| 467 true); | 468 true); |
| 468 } | 469 } |
| 469 | 470 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 489 scoped_ptr<PluginMetadata> plugin; | 490 scoped_ptr<PluginMetadata> plugin; |
| 490 bool ret = PluginFinder::GetInstance()->FindPluginWithIdentifier( | 491 bool ret = PluginFinder::GetInstance()->FindPluginWithIdentifier( |
| 491 identifier, NULL, &plugin); | 492 identifier, NULL, &plugin); |
| 492 DCHECK(ret); | 493 DCHECK(ret); |
| 493 | 494 |
| 494 PluginMetroModeInfoBarDelegate::Create( | 495 PluginMetroModeInfoBarDelegate::Create( |
| 495 InfoBarService::FromWebContents(web_contents()), | 496 InfoBarService::FromWebContents(web_contents()), |
| 496 PluginMetroModeInfoBarDelegate::DESKTOP_MODE_REQUIRED, plugin->name()); | 497 PluginMetroModeInfoBarDelegate::DESKTOP_MODE_REQUIRED, plugin->name()); |
| 497 #endif | 498 #endif |
| 498 } | 499 } |
| OLD | NEW |