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 <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 "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/version.h" | 10 #include "base/version.h" |
| 11 #include "base/win/win_util.h" |
11 #include "chrome/browser/ui/simple_message_box.h" | 12 #include "chrome/browser/ui/simple_message_box.h" |
12 #include "chrome/common/logging_chrome.h" | 13 #include "chrome/common/logging_chrome.h" |
13 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
14 #include "content/public/browser/plugin_service.h" | 15 #include "content/public/browser/plugin_service.h" |
15 #include "content/public/common/webplugininfo.h" | 16 #include "content/public/common/webplugininfo.h" |
16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
17 #include "ui/gfx/win/hwnd_util.h" | 18 #include "ui/gfx/win/hwnd_util.h" |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 NULL, title, message, chrome::MESSAGE_BOX_TYPE_QUESTION) == | 117 NULL, title, message, chrome::MESSAGE_BOX_TYPE_QUESTION) == |
117 chrome::MESSAGE_BOX_RESULT_YES) { | 118 chrome::MESSAGE_BOX_RESULT_YES) { |
118 *action = HungWindowNotification::HUNG_WINDOW_TERMINATE_PROCESS; | 119 *action = HungWindowNotification::HUNG_WINDOW_TERMINATE_PROCESS; |
119 } else { | 120 } else { |
120 // If the user choses to ignore the hung window warning, the | 121 // If the user choses to ignore the hung window warning, the |
121 // message timeout for this window should be doubled. We only | 122 // message timeout for this window should be doubled. We only |
122 // double the timeout property on the window if the property | 123 // double the timeout property on the window if the property |
123 // exists. The property is deleted if the window becomes | 124 // exists. The property is deleted if the window becomes |
124 // responsive. | 125 // responsive. |
125 continue_hang_detection = false; | 126 continue_hang_detection = false; |
126 #pragma warning(disable:4311) | 127 int child_window_message_timeout = base::win::HandleToUint32( |
127 int child_window_message_timeout = | 128 GetProp(hung_window, HungWindowDetector::kHungChildWindowTimeout)); |
128 reinterpret_cast<int>(GetProp( | |
129 hung_window, HungWindowDetector::kHungChildWindowTimeout)); | |
130 #pragma warning(default:4311) | |
131 if (child_window_message_timeout) { | 129 if (child_window_message_timeout) { |
132 child_window_message_timeout *= 2; | 130 child_window_message_timeout *= 2; |
133 #pragma warning(disable:4312) | 131 #pragma warning(disable:4312) |
134 SetProp(hung_window, HungWindowDetector::kHungChildWindowTimeout, | 132 SetProp(hung_window, HungWindowDetector::kHungChildWindowTimeout, |
135 reinterpret_cast<HANDLE>(child_window_message_timeout)); | 133 reinterpret_cast<HANDLE>(child_window_message_timeout)); |
136 #pragma warning(default:4312) | 134 #pragma warning(default:4312) |
137 } | 135 } |
138 } | 136 } |
139 current_hung_plugin_window_ = NULL; | 137 current_hung_plugin_window_ = NULL; |
140 } | 138 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 void CALLBACK HungPluginAction::HungWindowResponseCallback(HWND target_window, | 173 void CALLBACK HungPluginAction::HungWindowResponseCallback(HWND target_window, |
176 UINT message, | 174 UINT message, |
177 ULONG_PTR data, | 175 ULONG_PTR data, |
178 LRESULT result) { | 176 LRESULT result) { |
179 HungPluginAction* instance = reinterpret_cast<HungPluginAction*>(data); | 177 HungPluginAction* instance = reinterpret_cast<HungPluginAction*>(data); |
180 DCHECK(NULL != instance); | 178 DCHECK(NULL != instance); |
181 if (NULL != instance) { | 179 if (NULL != instance) { |
182 instance->OnWindowResponsive(target_window); | 180 instance->OnWindowResponsive(target_window); |
183 } | 181 } |
184 } | 182 } |
OLD | NEW |