| 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/views/simple_message_box_win.h" |
| 12 #include "chrome/common/logging_chrome.h" | 12 #include "chrome/common/logging_chrome.h" |
| 13 #include "content/public/browser/plugin_service.h" | 13 #include "content/public/browser/plugin_service.h" |
| 14 #include "content/public/common/webplugininfo.h" | 14 #include "content/public/common/webplugininfo.h" |
| 15 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.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 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 const wchar_t kGTalkPluginName[] = L"Google Talk Plugin"; | 21 const wchar_t kGTalkPluginName[] = L"Google Talk Plugin"; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // Before displaying the message box, invoke SendMessageCallback on the | 106 // Before displaying the message box, invoke SendMessageCallback on the |
| 107 // hung window. If the callback ever hits, the window is not hung anymore | 107 // hung window. If the callback ever hits, the window is not hung anymore |
| 108 // and we can dismiss the message box. | 108 // and we can dismiss the message box. |
| 109 SendMessageCallback(hung_window, | 109 SendMessageCallback(hung_window, |
| 110 WM_NULL, | 110 WM_NULL, |
| 111 0, | 111 0, |
| 112 0, | 112 0, |
| 113 HungWindowResponseCallback, | 113 HungWindowResponseCallback, |
| 114 reinterpret_cast<ULONG_PTR>(this)); | 114 reinterpret_cast<ULONG_PTR>(this)); |
| 115 current_hung_plugin_window_ = hung_window; | 115 current_hung_plugin_window_ = hung_window; |
| 116 if (chrome::ShowMessageBox(NULL, title, message, | 116 // We use chrome::NativeShowMessageBox instead of chrome::ShowMessageBox |
| 117 chrome::MESSAGE_BOX_TYPE_QUESTION) == | 117 // because the latter depends on UI-thread classes on Win Aura. See |
| 118 // http://crbug.com/330424. |
| 119 if (chrome::NativeShowMessageBox( |
| 120 NULL, title, message, chrome::MESSAGE_BOX_TYPE_QUESTION) == |
| 118 chrome::MESSAGE_BOX_RESULT_YES) { | 121 chrome::MESSAGE_BOX_RESULT_YES) { |
| 119 *action = HungWindowNotification::HUNG_WINDOW_TERMINATE_PROCESS; | 122 *action = HungWindowNotification::HUNG_WINDOW_TERMINATE_PROCESS; |
| 120 } else { | 123 } else { |
| 121 // If the user choses to ignore the hung window warning, the | 124 // If the user choses to ignore the hung window warning, the |
| 122 // message timeout for this window should be doubled. We only | 125 // message timeout for this window should be doubled. We only |
| 123 // double the timeout property on the window if the property | 126 // double the timeout property on the window if the property |
| 124 // exists. The property is deleted if the window becomes | 127 // exists. The property is deleted if the window becomes |
| 125 // responsive. | 128 // responsive. |
| 126 continue_hang_detection = false; | 129 continue_hang_detection = false; |
| 127 #pragma warning(disable:4311) | 130 #pragma warning(disable:4311) |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 void CALLBACK HungPluginAction::HungWindowResponseCallback(HWND target_window, | 203 void CALLBACK HungPluginAction::HungWindowResponseCallback(HWND target_window, |
| 201 UINT message, | 204 UINT message, |
| 202 ULONG_PTR data, | 205 ULONG_PTR data, |
| 203 LRESULT result) { | 206 LRESULT result) { |
| 204 HungPluginAction* instance = reinterpret_cast<HungPluginAction*>(data); | 207 HungPluginAction* instance = reinterpret_cast<HungPluginAction*>(data); |
| 205 DCHECK(NULL != instance); | 208 DCHECK(NULL != instance); |
| 206 if (NULL != instance) { | 209 if (NULL != instance) { |
| 207 instance->OnWindowResponsive(target_window); | 210 instance->OnWindowResponsive(target_window); |
| 208 } | 211 } |
| 209 } | 212 } |
| OLD | NEW |