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" |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
287 | 287 |
288 base::string16 plugin_name = | 288 base::string16 plugin_name = |
289 PluginService::GetInstance()->GetPluginDisplayNameByPath(plugin_path); | 289 PluginService::GetInstance()->GetPluginDisplayNameByPath(plugin_path); |
290 base::string16 infobar_text; | 290 base::string16 infobar_text; |
291 #if defined(OS_WIN) | 291 #if defined(OS_WIN) |
292 // Find out whether the plugin process is still alive. | 292 // Find out whether the plugin process is still alive. |
293 // Note: Although the chances are slim, it is possible that after the plugin | 293 // Note: Although the chances are slim, it is possible that after the plugin |
294 // process died, |plugin_pid| has been reused by a new process. The | 294 // process died, |plugin_pid| has been reused by a new process. The |
295 // consequence is that we will display |IDS_PLUGIN_DISCONNECTED_PROMPT| rather | 295 // consequence is that we will display |IDS_PLUGIN_DISCONNECTED_PROMPT| rather |
296 // than |IDS_PLUGIN_CRASHED_PROMPT| to the user, which seems acceptable. | 296 // than |IDS_PLUGIN_CRASHED_PROMPT| to the user, which seems acceptable. |
297 base::ProcessHandle plugin_handle = base::kNullProcessHandle; | 297 base::Process plugin = |
cpu_(ooo_6.6-7.5)
2015/01/22 01:09:09
plugin_process rather than plugin
rvargas (doing something else)
2015/01/22 01:51:17
Done.
| |
298 bool open_result = base::OpenProcessHandleWithAccess( | 298 base::Process::OpenWithAccess(plugin_pid, |
299 plugin_pid, PROCESS_QUERY_INFORMATION | SYNCHRONIZE, &plugin_handle); | 299 PROCESS_QUERY_INFORMATION | SYNCHRONIZE); |
300 bool is_running = false; | 300 bool is_running = false; |
301 if (open_result) { | 301 if (plugin.IsValid()) { |
302 is_running = base::GetTerminationStatus(plugin_handle, NULL) == | 302 is_running = |
303 base::TERMINATION_STATUS_STILL_RUNNING; | 303 base::GetTerminationStatus(plugin.Handle(), NULL) == |
304 base::CloseProcessHandle(plugin_handle); | 304 base::TERMINATION_STATUS_STILL_RUNNING; |
305 plugin.Close(); | |
305 } | 306 } |
306 | 307 |
307 if (is_running) { | 308 if (is_running) { |
308 infobar_text = l10n_util::GetStringFUTF16(IDS_PLUGIN_DISCONNECTED_PROMPT, | 309 infobar_text = l10n_util::GetStringFUTF16(IDS_PLUGIN_DISCONNECTED_PROMPT, |
309 plugin_name); | 310 plugin_name); |
310 UMA_HISTOGRAM_COUNTS("Plugin.ShowDisconnectedInfobar", 1); | 311 UMA_HISTOGRAM_COUNTS("Plugin.ShowDisconnectedInfobar", 1); |
311 } else { | 312 } else { |
312 infobar_text = l10n_util::GetStringFUTF16(IDS_PLUGIN_CRASHED_PROMPT, | 313 infobar_text = l10n_util::GetStringFUTF16(IDS_PLUGIN_CRASHED_PROMPT, |
313 plugin_name); | 314 plugin_name); |
314 UMA_HISTOGRAM_COUNTS("Plugin.ShowCrashedInfobar", 1); | 315 UMA_HISTOGRAM_COUNTS("Plugin.ShowCrashedInfobar", 1); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
480 scoped_ptr<PluginMetadata> plugin; | 481 scoped_ptr<PluginMetadata> plugin; |
481 bool ret = PluginFinder::GetInstance()->FindPluginWithIdentifier( | 482 bool ret = PluginFinder::GetInstance()->FindPluginWithIdentifier( |
482 identifier, NULL, &plugin); | 483 identifier, NULL, &plugin); |
483 DCHECK(ret); | 484 DCHECK(ret); |
484 | 485 |
485 PluginMetroModeInfoBarDelegate::Create( | 486 PluginMetroModeInfoBarDelegate::Create( |
486 InfoBarService::FromWebContents(web_contents()), | 487 InfoBarService::FromWebContents(web_contents()), |
487 PluginMetroModeInfoBarDelegate::DESKTOP_MODE_REQUIRED, plugin->name()); | 488 PluginMetroModeInfoBarDelegate::DESKTOP_MODE_REQUIRED, plugin->name()); |
488 #endif | 489 #endif |
489 } | 490 } |
OLD | NEW |