| 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" |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedOutdatedPlugin, | 372 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedOutdatedPlugin, |
| 373 OnBlockedOutdatedPlugin) | 373 OnBlockedOutdatedPlugin) |
| 374 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedComponentUpdatedPlugin, | 374 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedComponentUpdatedPlugin, |
| 375 OnBlockedComponentUpdatedPlugin) | 375 OnBlockedComponentUpdatedPlugin) |
| 376 #if defined(ENABLE_PLUGIN_INSTALLATION) | 376 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 377 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_RemovePluginPlaceholderHost, | 377 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_RemovePluginPlaceholderHost, |
| 378 OnRemovePluginPlaceholderHost) | 378 OnRemovePluginPlaceholderHost) |
| 379 #endif | 379 #endif |
| 380 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_OpenAboutPlugins, | 380 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_OpenAboutPlugins, |
| 381 OnOpenAboutPlugins) | 381 OnOpenAboutPlugins) |
| 382 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ShowFlashPermissionBubble, |
| 383 OnShowFlashPermissionBubble) |
| 382 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_CouldNotLoadPlugin, | 384 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_CouldNotLoadPlugin, |
| 383 OnCouldNotLoadPlugin) | 385 OnCouldNotLoadPlugin) |
| 384 | 386 |
| 385 IPC_MESSAGE_UNHANDLED(return false) | 387 IPC_MESSAGE_UNHANDLED(return false) |
| 386 IPC_END_MESSAGE_MAP() | 388 IPC_END_MESSAGE_MAP() |
| 387 | 389 |
| 388 return true; | 390 return true; |
| 389 } | 391 } |
| 390 | 392 |
| 391 void PluginObserver::OnBlockedOutdatedPlugin(int placeholder_id, | 393 void PluginObserver::OnBlockedOutdatedPlugin(int placeholder_id, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 web_contents()->OpenURL( | 446 web_contents()->OpenURL( |
| 445 OpenURLParams(GURL(chrome::kChromeUIPluginsURL), | 447 OpenURLParams(GURL(chrome::kChromeUIPluginsURL), |
| 446 content::Referrer::SanitizeForRequest( | 448 content::Referrer::SanitizeForRequest( |
| 447 GURL(chrome::kChromeUIPluginsURL), | 449 GURL(chrome::kChromeUIPluginsURL), |
| 448 content::Referrer(web_contents()->GetURL(), | 450 content::Referrer(web_contents()->GetURL(), |
| 449 blink::WebReferrerPolicyDefault)), | 451 blink::WebReferrerPolicyDefault)), |
| 450 WindowOpenDisposition::NEW_FOREGROUND_TAB, | 452 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 451 ui::PAGE_TRANSITION_AUTO_BOOKMARK, false)); | 453 ui::PAGE_TRANSITION_AUTO_BOOKMARK, false)); |
| 452 } | 454 } |
| 453 | 455 |
| 456 void PluginObserver::OnShowFlashPermissionBubble() { |
| 457 // TODO(tommycli): Show a permission bubble for the associated tab. |
| 458 } |
| 459 |
| 454 void PluginObserver::OnCouldNotLoadPlugin(const base::FilePath& plugin_path) { | 460 void PluginObserver::OnCouldNotLoadPlugin(const base::FilePath& plugin_path) { |
| 455 g_browser_process->GetMetricsServicesManager()->OnPluginLoadingError( | 461 g_browser_process->GetMetricsServicesManager()->OnPluginLoadingError( |
| 456 plugin_path); | 462 plugin_path); |
| 457 base::string16 plugin_name = | 463 base::string16 plugin_name = |
| 458 PluginService::GetInstance()->GetPluginDisplayNameByPath(plugin_path); | 464 PluginService::GetInstance()->GetPluginDisplayNameByPath(plugin_path); |
| 459 SimpleAlertInfoBarDelegate::Create( | 465 SimpleAlertInfoBarDelegate::Create( |
| 460 InfoBarService::FromWebContents(web_contents()), | 466 InfoBarService::FromWebContents(web_contents()), |
| 461 infobars::InfoBarDelegate::PLUGIN_OBSERVER, | 467 infobars::InfoBarDelegate::PLUGIN_OBSERVER, |
| 462 IDR_INFOBAR_PLUGIN_CRASHED, | 468 IDR_INFOBAR_PLUGIN_CRASHED, |
| 463 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 469 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 464 gfx::VectorIconId::EXTENSION_CRASHED, | 470 gfx::VectorIconId::EXTENSION_CRASHED, |
| 465 #else | 471 #else |
| 466 gfx::VectorIconId::VECTOR_ICON_NONE, | 472 gfx::VectorIconId::VECTOR_ICON_NONE, |
| 467 #endif | 473 #endif |
| 468 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT, | 474 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT, |
| 469 plugin_name), | 475 plugin_name), |
| 470 true); | 476 true); |
| 471 } | 477 } |
| OLD | NEW |