| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <windows.h> | 5 #include <windows.h> |
| 6 | 6 |
| 7 #include "chrome/browser/hang_monitor/hung_plugin_action.h" | 7 #include "chrome/browser/hang_monitor/hung_plugin_action.h" |
| 8 | 8 |
| 9 #include "chrome/browser/platform_util.h" | 9 #include "chrome/browser/simple_message_box.h" |
| 10 #include "chrome/common/logging_chrome.h" | 10 #include "chrome/common/logging_chrome.h" |
| 11 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
| 12 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
| 13 #include "ui/base/win/hwnd_util.h" | 13 #include "ui/base/win/hwnd_util.h" |
| 14 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 14 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
| 15 | 15 |
| 16 HungPluginAction::HungPluginAction() : current_hung_plugin_window_(NULL) { | 16 HungPluginAction::HungPluginAction() : current_hung_plugin_window_(NULL) { |
| 17 } | 17 } |
| 18 | 18 |
| 19 HungPluginAction::~HungPluginAction() { | 19 HungPluginAction::~HungPluginAction() { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // Before displaying the message box, invoke SendMessageCallback on the | 55 // Before displaying the message box, invoke SendMessageCallback on the |
| 56 // hung window. If the callback ever hits, the window is not hung anymore | 56 // hung window. If the callback ever hits, the window is not hung anymore |
| 57 // and we can dismiss the message box. | 57 // and we can dismiss the message box. |
| 58 SendMessageCallback(hung_window, | 58 SendMessageCallback(hung_window, |
| 59 WM_NULL, | 59 WM_NULL, |
| 60 0, | 60 0, |
| 61 0, | 61 0, |
| 62 HungWindowResponseCallback, | 62 HungWindowResponseCallback, |
| 63 reinterpret_cast<ULONG_PTR>(this)); | 63 reinterpret_cast<ULONG_PTR>(this)); |
| 64 current_hung_plugin_window_ = hung_window; | 64 current_hung_plugin_window_ = hung_window; |
| 65 if (platform_util::SimpleYesNoBox(NULL, title, msg)) { | 65 if (browser::ShowYesNoBox(NULL, title, msg)) { |
| 66 *action = HungWindowNotification::HUNG_WINDOW_TERMINATE_PROCESS; | 66 *action = HungWindowNotification::HUNG_WINDOW_TERMINATE_PROCESS; |
| 67 } else { | 67 } else { |
| 68 // If the user choses to ignore the hung window warning, the | 68 // If the user choses to ignore the hung window warning, the |
| 69 // message timeout for this window should be doubled. We only | 69 // message timeout for this window should be doubled. We only |
| 70 // double the timeout property on the window if the property | 70 // double the timeout property on the window if the property |
| 71 // exists. The property is deleted if the window becomes | 71 // exists. The property is deleted if the window becomes |
| 72 // responsive. | 72 // responsive. |
| 73 continue_hang_detection = false; | 73 continue_hang_detection = false; |
| 74 #pragma warning(disable:4311) | 74 #pragma warning(disable:4311) |
| 75 int child_window_message_timeout = | 75 int child_window_message_timeout = |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 void CALLBACK HungPluginAction::HungWindowResponseCallback(HWND target_window, | 145 void CALLBACK HungPluginAction::HungWindowResponseCallback(HWND target_window, |
| 146 UINT message, | 146 UINT message, |
| 147 ULONG_PTR data, | 147 ULONG_PTR data, |
| 148 LRESULT result) { | 148 LRESULT result) { |
| 149 HungPluginAction* instance = reinterpret_cast<HungPluginAction*>(data); | 149 HungPluginAction* instance = reinterpret_cast<HungPluginAction*>(data); |
| 150 DCHECK(NULL != instance); | 150 DCHECK(NULL != instance); |
| 151 if (NULL != instance) { | 151 if (NULL != instance) { |
| 152 instance->OnWindowResponsive(target_window); | 152 instance->OnWindowResponsive(target_window); |
| 153 } | 153 } |
| 154 } | 154 } |
| OLD | NEW |