| 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/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 #else | 218 #else |
| 219 // Calling the POSIX version of base::GetTerminationStatus() may affect other | 219 // Calling the POSIX version of base::GetTerminationStatus() may affect other |
| 220 // code which is interested in the process termination status. (Please see the | 220 // code which is interested in the process termination status. (Please see the |
| 221 // comment of the function.) Therefore, a better way is needed to distinguish | 221 // comment of the function.) Therefore, a better way is needed to distinguish |
| 222 // disconnections from crashes. | 222 // disconnections from crashes. |
| 223 infobar_text = l10n_util::GetStringFUTF16(IDS_PLUGIN_CRASHED_PROMPT, | 223 infobar_text = l10n_util::GetStringFUTF16(IDS_PLUGIN_CRASHED_PROMPT, |
| 224 plugin_name); | 224 plugin_name); |
| 225 UMA_HISTOGRAM_COUNTS("Plugin.ShowCrashedInfobar", 1); | 225 UMA_HISTOGRAM_COUNTS("Plugin.ShowCrashedInfobar", 1); |
| 226 #endif | 226 #endif |
| 227 | 227 |
| 228 gfx::Image* icon = &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | |
| 229 IDR_INFOBAR_PLUGIN_CRASHED); | |
| 230 SimpleAlertInfoBarDelegate::Create( | 228 SimpleAlertInfoBarDelegate::Create( |
| 231 InfoBarService::FromWebContents(web_contents()), icon, infobar_text, | 229 InfoBarService::FromWebContents(web_contents()), |
| 232 true); | 230 IDR_INFOBAR_PLUGIN_CRASHED, infobar_text, true); |
| 233 } | 231 } |
| 234 | 232 |
| 235 bool PluginObserver::OnMessageReceived(const IPC::Message& message) { | 233 bool PluginObserver::OnMessageReceived(const IPC::Message& message) { |
| 236 IPC_BEGIN_MESSAGE_MAP(PluginObserver, message) | 234 IPC_BEGIN_MESSAGE_MAP(PluginObserver, message) |
| 237 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedOutdatedPlugin, | 235 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedOutdatedPlugin, |
| 238 OnBlockedOutdatedPlugin) | 236 OnBlockedOutdatedPlugin) |
| 239 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedUnauthorizedPlugin, | 237 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedUnauthorizedPlugin, |
| 240 OnBlockedUnauthorizedPlugin) | 238 OnBlockedUnauthorizedPlugin) |
| 241 #if defined(ENABLE_PLUGIN_INSTALLATION) | 239 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 242 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FindMissingPlugin, | 240 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FindMissingPlugin, |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 WebKit::WebReferrerPolicyDefault), | 373 WebKit::WebReferrerPolicyDefault), |
| 376 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_AUTO_BOOKMARK, false)); | 374 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_AUTO_BOOKMARK, false)); |
| 377 } | 375 } |
| 378 | 376 |
| 379 void PluginObserver::OnCouldNotLoadPlugin(const base::FilePath& plugin_path) { | 377 void PluginObserver::OnCouldNotLoadPlugin(const base::FilePath& plugin_path) { |
| 380 g_browser_process->metrics_service()->LogPluginLoadingError(plugin_path); | 378 g_browser_process->metrics_service()->LogPluginLoadingError(plugin_path); |
| 381 string16 plugin_name = | 379 string16 plugin_name = |
| 382 PluginService::GetInstance()->GetPluginDisplayNameByPath(plugin_path); | 380 PluginService::GetInstance()->GetPluginDisplayNameByPath(plugin_path); |
| 383 SimpleAlertInfoBarDelegate::Create( | 381 SimpleAlertInfoBarDelegate::Create( |
| 384 InfoBarService::FromWebContents(web_contents()), | 382 InfoBarService::FromWebContents(web_contents()), |
| 385 &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 383 IDR_INFOBAR_PLUGIN_CRASHED, |
| 386 IDR_INFOBAR_PLUGIN_CRASHED), | |
| 387 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT, | 384 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT, |
| 388 plugin_name), | 385 plugin_name), |
| 389 true /* auto_expire */); | 386 true /* auto_expire */); |
| 390 } | 387 } |
| 391 | 388 |
| 392 void PluginObserver::OnNPAPINotSupported(const std::string& identifier) { | 389 void PluginObserver::OnNPAPINotSupported(const std::string& identifier) { |
| 393 #if defined(OS_WIN) && defined(ENABLE_PLUGIN_INSTALLATION) | 390 #if defined(OS_WIN) && defined(ENABLE_PLUGIN_INSTALLATION) |
| 394 #if !defined(USE_AURA) | 391 #if !defined(USE_AURA) |
| 395 DCHECK(base::win::IsMetroProcess()); | 392 DCHECK(base::win::IsMetroProcess()); |
| 396 #endif | 393 #endif |
| (...skipping 16 matching lines...) Expand all Loading... |
| 413 identifier, NULL, &plugin)) { | 410 identifier, NULL, &plugin)) { |
| 414 NOTREACHED(); | 411 NOTREACHED(); |
| 415 return; | 412 return; |
| 416 } | 413 } |
| 417 | 414 |
| 418 PluginMetroModeInfoBarDelegate::Create( | 415 PluginMetroModeInfoBarDelegate::Create( |
| 419 InfoBarService::FromWebContents(web_contents()), | 416 InfoBarService::FromWebContents(web_contents()), |
| 420 PluginMetroModeInfoBarDelegate::DESKTOP_MODE_REQUIRED, plugin->name()); | 417 PluginMetroModeInfoBarDelegate::DESKTOP_MODE_REQUIRED, plugin->name()); |
| 421 #endif | 418 #endif |
| 422 } | 419 } |
| OLD | NEW |