OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/win_util.h" | 10 #include "app/win_util.h" |
11 #include "base/win_util.h" | 11 #include "base/win_util.h" |
12 #include "chrome/browser/platform_util.h" | 12 #include "chrome/browser/platform_util.h" |
13 #include "chrome/common/logging_chrome.h" | 13 #include "chrome/common/logging_chrome.h" |
14 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
15 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 15 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
16 | 16 |
17 HungPluginAction::HungPluginAction() : current_hung_plugin_window_(NULL) { | 17 HungPluginAction::HungPluginAction() : current_hung_plugin_window_(NULL) { |
18 } | 18 } |
19 | 19 |
20 HungPluginAction::~HungPluginAction() { | 20 HungPluginAction::~HungPluginAction() { |
21 } | 21 } |
22 | 22 |
23 bool HungPluginAction::OnHungWindowDetected(HWND hung_window, | 23 bool HungPluginAction::OnHungWindowDetected(HWND hung_window, |
24 HWND top_level_window, | 24 HWND top_level_window, |
25 ActionOnHungWindow* action) { | 25 ActionOnHungWindow* action) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 DCHECK(plugin_name); | 115 DCHECK(plugin_name); |
116 HWND window_to_check = plugin_window; | 116 HWND window_to_check = plugin_window; |
117 while (NULL != window_to_check) { | 117 while (NULL != window_to_check) { |
118 DWORD process_id = 0; | 118 DWORD process_id = 0; |
119 GetWindowThreadProcessId(window_to_check, &process_id); | 119 GetWindowThreadProcessId(window_to_check, &process_id); |
120 if (process_id == browser_process_id) { | 120 if (process_id == browser_process_id) { |
121 // If we have reached a window the that belongs to the browser process | 121 // If we have reached a window the that belongs to the browser process |
122 // we have gone too far. | 122 // we have gone too far. |
123 return false; | 123 return false; |
124 } | 124 } |
125 if (webkit::npapi::WebPluginDelegateImpl::GetPluginNameFromWindow( | 125 if (WebPluginDelegateImpl::GetPluginNameFromWindow(window_to_check, |
126 window_to_check, plugin_name)) { | 126 plugin_name)) { |
127 return true; | 127 return true; |
128 } | 128 } |
129 window_to_check = GetParent(window_to_check); | 129 window_to_check = GetParent(window_to_check); |
130 } | 130 } |
131 return false; | 131 return false; |
132 } | 132 } |
133 | 133 |
134 // static | 134 // static |
135 BOOL CALLBACK HungPluginAction::DismissMessageBox(HWND window, LPARAM ignore) { | 135 BOOL CALLBACK HungPluginAction::DismissMessageBox(HWND window, LPARAM ignore) { |
136 std::wstring class_name = win_util::GetClassNameW(window); | 136 std::wstring class_name = win_util::GetClassNameW(window); |
(...skipping 10 matching lines...) Expand all Loading... |
147 void CALLBACK HungPluginAction::HungWindowResponseCallback(HWND target_window, | 147 void CALLBACK HungPluginAction::HungWindowResponseCallback(HWND target_window, |
148 UINT message, | 148 UINT message, |
149 ULONG_PTR data, | 149 ULONG_PTR data, |
150 LRESULT result) { | 150 LRESULT result) { |
151 HungPluginAction* instance = reinterpret_cast<HungPluginAction*>(data); | 151 HungPluginAction* instance = reinterpret_cast<HungPluginAction*>(data); |
152 DCHECK(NULL != instance); | 152 DCHECK(NULL != instance); |
153 if (NULL != instance) { | 153 if (NULL != instance) { |
154 instance->OnWindowResponsive(target_window); | 154 instance->OnWindowResponsive(target_window); |
155 } | 155 } |
156 } | 156 } |
OLD | NEW |