OLD | NEW |
1 // Copyright (c) 2011 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 "chrome/browser/hang_monitor/hung_window_detector.h" | 5 #include "chrome/browser/hang_monitor/hung_window_detector.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <atlbase.h> | 8 #include <atlbase.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // If we already are checking for hung windows on another thread, | 52 // If we already are checking for hung windows on another thread, |
53 // don't do this again. | 53 // don't do this again. |
54 if (enumerating_) { | 54 if (enumerating_) { |
55 return; | 55 return; |
56 } | 56 } |
57 enumerating_ = true; | 57 enumerating_ = true; |
58 } while (false); // To scope the AutoLock | 58 } while (false); // To scope the AutoLock |
59 | 59 |
60 EnumChildWindows(top_level_window_, ChildWndEnumProc, | 60 EnumChildWindows(top_level_window_, ChildWndEnumProc, |
61 reinterpret_cast<LPARAM>(this)); | 61 reinterpret_cast<LPARAM>(this)); |
| 62 |
| 63 // The window shouldn't be disabled unless we're showing a modal dialog. |
| 64 // If we're not, then reenable the window. |
| 65 if (!::IsWindowEnabled(top_level_window_) && |
| 66 !::GetWindow(top_level_window_, GW_ENABLEDPOPUP)) { |
| 67 ::EnableWindow(top_level_window_, TRUE); |
| 68 } |
| 69 |
62 enumerating_ = false; | 70 enumerating_ = false; |
63 } | 71 } |
64 | 72 |
65 bool HungWindowDetector::CheckChildWindow(HWND child_window) { | 73 bool HungWindowDetector::CheckChildWindow(HWND child_window) { |
66 // It can happen that the window is DOA. It specifically happens | 74 // It can happen that the window is DOA. It specifically happens |
67 // when we have just killed a plugin process and the enum is still | 75 // when we have just killed a plugin process and the enum is still |
68 // enumerating windows from that process. | 76 // enumerating windows from that process. |
69 if (!IsWindow(child_window)) { | 77 if (!IsWindow(child_window)) { |
70 return true; | 78 return true; |
71 } | 79 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 LPARAM param) { | 177 LPARAM param) { |
170 HungWindowDetector* detector_instance = | 178 HungWindowDetector* detector_instance = |
171 reinterpret_cast<HungWindowDetector*>(param); | 179 reinterpret_cast<HungWindowDetector*>(param); |
172 if (NULL == detector_instance) { | 180 if (NULL == detector_instance) { |
173 NOTREACHED(); | 181 NOTREACHED(); |
174 return FALSE; | 182 return FALSE; |
175 } | 183 } |
176 | 184 |
177 return detector_instance->CheckChildWindow(child_window); | 185 return detector_instance->CheckChildWindow(child_window); |
178 } | 186 } |
OLD | NEW |