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> | 7 #include <utility> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/debug/crash_logging.h" | 11 #include "base/debug/crash_logging.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/infobars/infobar_service.h" | 18 #include "chrome/browser/infobars/infobar_service.h" |
19 #include "chrome/browser/lifetime/application_lifetime.h" | 19 #include "chrome/browser/lifetime/application_lifetime.h" |
| 20 #include "chrome/browser/plugins/flash_download_interception.h" |
20 #include "chrome/browser/plugins/plugin_finder.h" | 21 #include "chrome/browser/plugins/plugin_finder.h" |
21 #include "chrome/browser/plugins/plugin_infobar_delegates.h" | 22 #include "chrome/browser/plugins/plugin_infobar_delegates.h" |
22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" | 24 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" |
24 #include "chrome/common/render_messages.h" | 25 #include "chrome/common/render_messages.h" |
25 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
26 #include "chrome/grit/generated_resources.h" | 27 #include "chrome/grit/generated_resources.h" |
27 #include "chrome/grit/theme_resources.h" | 28 #include "chrome/grit/theme_resources.h" |
28 #include "components/component_updater/component_updater_service.h" | 29 #include "components/component_updater/component_updater_service.h" |
29 #include "components/content_settings/content/common/content_settings_messages.h
" | 30 #include "components/content_settings/content/common/content_settings_messages.h
" |
30 #include "components/content_settings/core/browser/host_content_settings_map.h" | 31 #include "components/content_settings/core/browser/host_content_settings_map.h" |
31 #include "components/infobars/core/confirm_infobar_delegate.h" | 32 #include "components/infobars/core/confirm_infobar_delegate.h" |
32 #include "components/infobars/core/infobar.h" | 33 #include "components/infobars/core/infobar.h" |
33 #include "components/infobars/core/infobar_delegate.h" | 34 #include "components/infobars/core/infobar_delegate.h" |
34 #include "components/infobars/core/simple_alert_infobar_delegate.h" | 35 #include "components/infobars/core/simple_alert_infobar_delegate.h" |
35 #include "components/metrics_services_manager/metrics_services_manager.h" | 36 #include "components/metrics_services_manager/metrics_services_manager.h" |
| 37 #include "content/public/browser/browser_thread.h" |
36 #include "content/public/browser/plugin_service.h" | 38 #include "content/public/browser/plugin_service.h" |
37 #include "content/public/browser/render_frame_host.h" | 39 #include "content/public/browser/render_frame_host.h" |
38 #include "content/public/browser/render_view_host.h" | 40 #include "content/public/browser/render_view_host.h" |
39 #include "content/public/browser/web_contents.h" | 41 #include "content/public/browser/web_contents.h" |
40 #include "content/public/browser/web_contents_delegate.h" | 42 #include "content/public/browser/web_contents_delegate.h" |
41 #include "content/public/common/webplugininfo.h" | 43 #include "content/public/common/webplugininfo.h" |
42 #include "ui/base/l10n/l10n_util.h" | 44 #include "ui/base/l10n/l10n_util.h" |
43 #include "ui/gfx/vector_icons_public.h" | 45 #include "ui/gfx/vector_icons_public.h" |
44 | 46 |
45 #if defined(ENABLE_PLUGIN_INSTALLATION) | 47 #if defined(ENABLE_PLUGIN_INSTALLATION) |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 OpenURLParams(GURL(chrome::kChromeUIPluginsURL), | 449 OpenURLParams(GURL(chrome::kChromeUIPluginsURL), |
448 content::Referrer::SanitizeForRequest( | 450 content::Referrer::SanitizeForRequest( |
449 GURL(chrome::kChromeUIPluginsURL), | 451 GURL(chrome::kChromeUIPluginsURL), |
450 content::Referrer(web_contents()->GetURL(), | 452 content::Referrer(web_contents()->GetURL(), |
451 blink::WebReferrerPolicyDefault)), | 453 blink::WebReferrerPolicyDefault)), |
452 WindowOpenDisposition::NEW_FOREGROUND_TAB, | 454 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
453 ui::PAGE_TRANSITION_AUTO_BOOKMARK, false)); | 455 ui::PAGE_TRANSITION_AUTO_BOOKMARK, false)); |
454 } | 456 } |
455 | 457 |
456 void PluginObserver::OnShowFlashPermissionBubble() { | 458 void PluginObserver::OnShowFlashPermissionBubble() { |
457 // TODO(tommycli): Show a permission bubble for the associated tab. | 459 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 460 |
| 461 FlashDownloadInterception::ShowRunFlashPrompt(web_contents()); |
458 } | 462 } |
459 | 463 |
460 void PluginObserver::OnCouldNotLoadPlugin(const base::FilePath& plugin_path) { | 464 void PluginObserver::OnCouldNotLoadPlugin(const base::FilePath& plugin_path) { |
461 g_browser_process->GetMetricsServicesManager()->OnPluginLoadingError( | 465 g_browser_process->GetMetricsServicesManager()->OnPluginLoadingError( |
462 plugin_path); | 466 plugin_path); |
463 base::string16 plugin_name = | 467 base::string16 plugin_name = |
464 PluginService::GetInstance()->GetPluginDisplayNameByPath(plugin_path); | 468 PluginService::GetInstance()->GetPluginDisplayNameByPath(plugin_path); |
465 SimpleAlertInfoBarDelegate::Create( | 469 SimpleAlertInfoBarDelegate::Create( |
466 InfoBarService::FromWebContents(web_contents()), | 470 InfoBarService::FromWebContents(web_contents()), |
467 infobars::InfoBarDelegate::PLUGIN_OBSERVER, | 471 infobars::InfoBarDelegate::PLUGIN_OBSERVER, |
468 IDR_INFOBAR_PLUGIN_CRASHED, | 472 IDR_INFOBAR_PLUGIN_CRASHED, |
469 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 473 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
470 gfx::VectorIconId::EXTENSION_CRASHED, | 474 gfx::VectorIconId::EXTENSION_CRASHED, |
471 #else | 475 #else |
472 gfx::VectorIconId::VECTOR_ICON_NONE, | 476 gfx::VectorIconId::VECTOR_ICON_NONE, |
473 #endif | 477 #endif |
474 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT, | 478 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT, |
475 plugin_name), | 479 plugin_name), |
476 true); | 480 true); |
477 } | 481 } |
OLD | NEW |