| 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 "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 15 #include "ui/base/win/hwnd_util.h" | 15 #include "ui/base/win/hwnd_util.h" |
| 16 #include "webkit/plugins/npapi/plugin_utils.h" | 16 #include "webkit/plugins/npapi/plugin_utils.h" |
| 17 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | |
| 18 | 17 |
| 19 namespace { | 18 namespace { |
| 20 | 19 |
| 21 const wchar_t kGTalkPluginName[] = L"Google Talk Plugin"; | 20 const wchar_t kGTalkPluginName[] = L"Google Talk Plugin"; |
| 22 const int kGTalkPluginLogMinVersion = 26; // For version 2.6 and below. | 21 const int kGTalkPluginLogMinVersion = 26; // For version 2.6 and below. |
| 23 | 22 |
| 24 enum GTalkPluginLogVersion { | 23 enum GTalkPluginLogVersion { |
| 25 GTALK_PLUGIN_VERSION_MIN = 0, | 24 GTALK_PLUGIN_VERSION_MIN = 0, |
| 26 GTALK_PLUGIN_VERSION_27, | 25 GTALK_PLUGIN_VERSION_27, |
| 27 GTALK_PLUGIN_VERSION_28, | 26 GTALK_PLUGIN_VERSION_28, |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 DCHECK(plugin_version); | 167 DCHECK(plugin_version); |
| 169 HWND window_to_check = plugin_window; | 168 HWND window_to_check = plugin_window; |
| 170 while (NULL != window_to_check) { | 169 while (NULL != window_to_check) { |
| 171 DWORD process_id = 0; | 170 DWORD process_id = 0; |
| 172 GetWindowThreadProcessId(window_to_check, &process_id); | 171 GetWindowThreadProcessId(window_to_check, &process_id); |
| 173 if (process_id == browser_process_id) { | 172 if (process_id == browser_process_id) { |
| 174 // If we have reached a window the that belongs to the browser process | 173 // If we have reached a window the that belongs to the browser process |
| 175 // we have gone too far. | 174 // we have gone too far. |
| 176 return false; | 175 return false; |
| 177 } | 176 } |
| 178 if (webkit::npapi::WebPluginDelegateImpl::GetPluginNameFromWindow( | 177 if (webkit::npapi::GetPluginNameFromWindow(window_to_check, plugin_name)) { |
| 179 window_to_check, plugin_name)) { | 178 webkit::npapi::GetPluginVersionFromWindow( |
| 180 webkit::npapi::WebPluginDelegateImpl::GetPluginVersionFromWindow( | |
| 181 window_to_check, plugin_version); | 179 window_to_check, plugin_version); |
| 182 return true; | 180 return true; |
| 183 } | 181 } |
| 184 window_to_check = GetParent(window_to_check); | 182 window_to_check = GetParent(window_to_check); |
| 185 } | 183 } |
| 186 return false; | 184 return false; |
| 187 } | 185 } |
| 188 | 186 |
| 189 // static | 187 // static |
| 190 BOOL CALLBACK HungPluginAction::DismissMessageBox(HWND window, LPARAM ignore) { | 188 BOOL CALLBACK HungPluginAction::DismissMessageBox(HWND window, LPARAM ignore) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 202 void CALLBACK HungPluginAction::HungWindowResponseCallback(HWND target_window, | 200 void CALLBACK HungPluginAction::HungWindowResponseCallback(HWND target_window, |
| 203 UINT message, | 201 UINT message, |
| 204 ULONG_PTR data, | 202 ULONG_PTR data, |
| 205 LRESULT result) { | 203 LRESULT result) { |
| 206 HungPluginAction* instance = reinterpret_cast<HungPluginAction*>(data); | 204 HungPluginAction* instance = reinterpret_cast<HungPluginAction*>(data); |
| 207 DCHECK(NULL != instance); | 205 DCHECK(NULL != instance); |
| 208 if (NULL != instance) { | 206 if (NULL != instance) { |
| 209 instance->OnWindowResponsive(target_window); | 207 instance->OnWindowResponsive(target_window); |
| 210 } | 208 } |
| 211 } | 209 } |
| OLD | NEW |