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 #ifndef CHROME_BROWSER_HANG_MONITOR_HUNG_PLUGIN_ACTION_H__ | 5 #ifndef CHROME_BROWSER_HANG_MONITOR_HUNG_PLUGIN_ACTION_H__ |
6 #define CHROME_BROWSER_HANG_MONITOR_HUNG_PLUGIN_ACTION_H__ | 6 #define CHROME_BROWSER_HANG_MONITOR_HUNG_PLUGIN_ACTION_H__ |
7 #pragma once | 7 #pragma once |
8 | 8 |
| 9 #include "base/string16.h" |
9 #include "chrome/browser/hang_monitor/hung_window_detector.h" | 10 #include "chrome/browser/hang_monitor/hung_window_detector.h" |
| 11 |
10 // This class provides an implementation the | 12 // This class provides an implementation the |
11 // HungWindowDetector::HungWindowNotification callback interface. | 13 // HungWindowDetector::HungWindowNotification callback interface. |
12 // It checks to see if the hung window belongs to a process different | 14 // It checks to see if the hung window belongs to a process different |
13 // from that of the browser process and, if so, it returns an action | 15 // from that of the browser process and, if so, it returns an action |
14 // of HungWindowNotification::HUNG_WINDOW_TERMINATE_PROCESS. | 16 // of HungWindowNotification::HUNG_WINDOW_TERMINATE_PROCESS. |
15 // Note: We can write other action classes that implement the same | 17 // Note: We can write other action classes that implement the same |
16 // interface and switch the action done on hung plugins based on user | 18 // interface and switch the action done on hung plugins based on user |
17 // preferences. | 19 // preferences. |
18 class HungPluginAction : public HungWindowDetector::HungWindowNotification { | 20 class HungPluginAction : public HungWindowDetector::HungWindowNotification { |
19 public: | 21 public: |
20 HungPluginAction(); | 22 HungPluginAction(); |
21 ~HungPluginAction(); | 23 ~HungPluginAction(); |
22 // HungWindowNotification implementation | 24 // HungWindowNotification implementation |
23 virtual bool OnHungWindowDetected(HWND hung_window, | 25 virtual bool OnHungWindowDetected(HWND hung_window, |
24 HWND top_level_window, | 26 HWND top_level_window, |
25 ActionOnHungWindow* action); | 27 ActionOnHungWindow* action); |
26 | 28 |
27 protected: | 29 protected: |
28 void OnWindowResponsive(HWND window); | 30 void OnWindowResponsive(HWND window); |
29 | 31 |
30 // The callback function for the SendMessageCallback API | 32 // The callback function for the SendMessageCallback API |
31 static void CALLBACK HungWindowResponseCallback(HWND target_window, | 33 static void CALLBACK HungWindowResponseCallback(HWND target_window, |
32 UINT message, | 34 UINT message, |
33 ULONG_PTR data, | 35 ULONG_PTR data, |
34 LRESULT result); | 36 LRESULT result); |
35 | 37 |
36 static BOOL CALLBACK DismissMessageBox(HWND window, LPARAM ignore); | 38 static BOOL CALLBACK DismissMessageBox(HWND window, LPARAM ignore); |
37 | 39 |
38 protected: | 40 protected: |
39 bool GetPluginName(HWND plugin_window, | 41 bool GetPluginNameAndVersion(HWND plugin_window, |
40 DWORD browser_process_id, | 42 DWORD browser_process_id, |
41 std::wstring *plugin_name); | 43 string16* plugin_name, |
| 44 string16* plugin_version); |
42 // The currently hung plugin window that we are prompting the user about | 45 // The currently hung plugin window that we are prompting the user about |
43 HWND current_hung_plugin_window_; | 46 HWND current_hung_plugin_window_; |
44 }; | 47 }; |
45 | 48 |
46 #endif // CHROME_BROWSER_HANG_MONITOR_HUNG_PLUGIN_ACTION_H__ | 49 #endif // CHROME_BROWSER_HANG_MONITOR_HUNG_PLUGIN_ACTION_H__ |
OLD | NEW |