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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_HANG_MONITOR_HUNG_PLUGIN_ACTION_H__
6 #define CHROME_BROWSER_HANG_MONITOR_HUNG_PLUGIN_ACTION_H__
8 #include "base/strings/string16.h"
9 #include "chrome/browser/hang_monitor/hung_window_detector.h"
11 // This class provides an implementation the
12 // HungWindowDetector::HungWindowNotification callback interface.
13 // It checks to see if the hung window belongs to a process different
14 // from that of the browser process and, if so, it returns an action
15 // of HungWindowNotification::HUNG_WINDOW_TERMINATE_PROCESS.
16 // Note: We can write other action classes that implement the same
17 // interface and switch the action done on hung plugins based on user
19 class HungPluginAction
: public HungWindowDetector::HungWindowNotification
{
23 // HungWindowNotification implementation
24 bool OnHungWindowDetected(HWND hung_window
,
25 HWND top_level_window
,
26 ActionOnHungWindow
* action
) override
;
29 void OnWindowResponsive(HWND window
);
31 // The callback function for the SendMessageCallback API
32 static void CALLBACK
HungWindowResponseCallback(HWND target_window
,
37 static BOOL CALLBACK
DismissMessageBox(HWND window
, LPARAM ignore
);
40 bool GetPluginNameAndVersion(HWND plugin_window
,
41 DWORD browser_process_id
,
42 base::string16
* plugin_name
,
43 base::string16
* plugin_version
);
44 // The currently hung plugin window that we are prompting the user about
45 HWND current_hung_plugin_window_
;
48 #endif // CHROME_BROWSER_HANG_MONITOR_HUNG_PLUGIN_ACTION_H__