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 "chrome/browser/ui/simple_message_box.h" | 11 #include "chrome/browser/ui/simple_message_box.h" |
12 #include "chrome/common/logging_chrome.h" | 12 #include "chrome/common/logging_chrome.h" |
13 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
14 #include "content/public/browser/plugin_service.h" | 14 #include "content/public/browser/plugin_service.h" |
15 #include "content/public/common/webplugininfo.h" | 15 #include "content/public/common/webplugininfo.h" |
16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
17 #include "ui/gfx/win/hwnd_util.h" | 17 #include "ui/gfx/win/hwnd_util.h" |
18 | 18 |
ananta
2015/11/18 19:13:42
The OS_WIN ifdef is not needed. This file is windo
| |
19 #if defined(OS_WIN) | |
20 #include "base/win/win_util.h" | |
21 #endif | |
22 | |
19 namespace { | 23 namespace { |
20 | 24 |
21 const wchar_t kGTalkPluginName[] = L"Google Talk Plugin"; | 25 const wchar_t kGTalkPluginName[] = L"Google Talk Plugin"; |
22 const int kGTalkPluginLogMinVersion = 26; // For version 2.6 and below. | 26 const int kGTalkPluginLogMinVersion = 26; // For version 2.6 and below. |
23 | 27 |
24 enum GTalkPluginLogVersion { | 28 enum GTalkPluginLogVersion { |
25 GTALK_PLUGIN_VERSION_MIN = 0, | 29 GTALK_PLUGIN_VERSION_MIN = 0, |
26 GTALK_PLUGIN_VERSION_27, | 30 GTALK_PLUGIN_VERSION_27, |
27 GTALK_PLUGIN_VERSION_28, | 31 GTALK_PLUGIN_VERSION_28, |
28 GTALK_PLUGIN_VERSION_29, | 32 GTALK_PLUGIN_VERSION_29, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 NULL, title, message, chrome::MESSAGE_BOX_TYPE_QUESTION) == | 120 NULL, title, message, chrome::MESSAGE_BOX_TYPE_QUESTION) == |
117 chrome::MESSAGE_BOX_RESULT_YES) { | 121 chrome::MESSAGE_BOX_RESULT_YES) { |
118 *action = HungWindowNotification::HUNG_WINDOW_TERMINATE_PROCESS; | 122 *action = HungWindowNotification::HUNG_WINDOW_TERMINATE_PROCESS; |
119 } else { | 123 } else { |
120 // If the user choses to ignore the hung window warning, the | 124 // If the user choses to ignore the hung window warning, the |
121 // message timeout for this window should be doubled. We only | 125 // message timeout for this window should be doubled. We only |
122 // double the timeout property on the window if the property | 126 // double the timeout property on the window if the property |
123 // exists. The property is deleted if the window becomes | 127 // exists. The property is deleted if the window becomes |
124 // responsive. | 128 // responsive. |
125 continue_hang_detection = false; | 129 continue_hang_detection = false; |
126 #pragma warning(disable:4311) | 130 int child_window_message_timeout = base::win::HandleToUint32( |
127 int child_window_message_timeout = | 131 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) { | 132 if (child_window_message_timeout) { |
132 child_window_message_timeout *= 2; | 133 child_window_message_timeout *= 2; |
133 #pragma warning(disable:4312) | 134 #pragma warning(disable:4312) |
134 SetProp(hung_window, HungWindowDetector::kHungChildWindowTimeout, | 135 SetProp(hung_window, HungWindowDetector::kHungChildWindowTimeout, |
135 reinterpret_cast<HANDLE>(child_window_message_timeout)); | 136 reinterpret_cast<HANDLE>(child_window_message_timeout)); |
136 #pragma warning(default:4312) | 137 #pragma warning(default:4312) |
137 } | 138 } |
138 } | 139 } |
139 current_hung_plugin_window_ = NULL; | 140 current_hung_plugin_window_ = NULL; |
140 } | 141 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 void CALLBACK HungPluginAction::HungWindowResponseCallback(HWND target_window, | 176 void CALLBACK HungPluginAction::HungWindowResponseCallback(HWND target_window, |
176 UINT message, | 177 UINT message, |
177 ULONG_PTR data, | 178 ULONG_PTR data, |
178 LRESULT result) { | 179 LRESULT result) { |
179 HungPluginAction* instance = reinterpret_cast<HungPluginAction*>(data); | 180 HungPluginAction* instance = reinterpret_cast<HungPluginAction*>(data); |
180 DCHECK(NULL != instance); | 181 DCHECK(NULL != instance); |
181 if (NULL != instance) { | 182 if (NULL != instance) { |
182 instance->OnWindowResponsive(target_window); | 183 instance->OnWindowResponsive(target_window); |
183 } | 184 } |
184 } | 185 } |
OLD | NEW |