1 // Copyright (c) 2011 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_FRAME_CHROME_FRAME_HELPER_UTIL_H_
6 #define CHROME_FRAME_CHROME_FRAME_HELPER_UTIL_H_
10 // Compare the given class name with the known window class names for
11 // internet explorer browser windows.
13 // @param [in] window_to_check handle to the window to be checked
15 // @return true if the window class matches known class names for IE browser.
17 bool UtilIsWebBrowserWindow(HWND window_to_check
);
19 // A utility function that retrieves the specified web browser COM interface
20 // from the web browser window. The passed in window must be the web browser
21 // window (class name "IEFrame" in IE6 and "TabWindowClass" in IE7)
22 // @param[in] window The web browser window whose COM object is to be fetched
23 // @param[in] iid The IID of the interface to be fetched
24 // @param[out] web_browser_object
25 // The requested interface pointer to the web browser object
26 // is returned in this variable upon success
28 HRESULT
UtilGetWebBrowserObjectFromWindow(HWND window
,
30 void** web_browser_object
);
32 // Checks to see whether the passed in window is of the class specified.
33 // of the heirarchy list
34 // @param hwnd_to_match [in] The handle of the window that is to be
36 // @param window_class [in] The window class to match against.
38 bool IsWindowOfClass(HWND hwnd_to_match
, const wchar_t* window_class
);
40 // Returns true if the current process name is process_name, false otherwise.
41 bool IsNamedProcess(const wchar_t* process_name
);
43 // Returns true if window has the name |window_name|, false otherwise.
44 bool IsNamedWindow(HWND window
, const wchar_t* window_name
);
47 // This function recursively enumerates all windows from a given starting point
48 // and searches for the first occurrence of a window matching
49 // the class name and window name passed in. We use the EnumChildWindows API
50 // to search for the window.
51 // @note The FindWindowEx function does something similar, however, it goes
52 // only one level deep and does not recurse descendants.
53 // @param parent [in] The HWND of the window from which to start looking. If
54 // this is NULL then enumerate all windows on the desktop.
55 // @param class_name [in, optional] The class name of the matching window
56 // @param window_name [in, optional] The window text of the matching window.
57 // At least one of class_name and
58 // window_name must be non-NULL.
59 // @param thread_id_to_match [in] This parameter will be used to match
60 // particular thread id for window.
61 // @param process_id_to_match [in] This parameter will be used to match
62 // particular process id for window.
63 // @return The window handle of the matching window, if found, or NULL.
65 HWND
RecurseFindWindow(HWND parent
,
66 const wchar_t* class_name
,
67 const wchar_t* window_name
,
68 DWORD thread_id_to_match
,
69 DWORD process_id_to_match
);
71 // Reads |value_size| characters from a value named |value_name| in |key| and
72 // places them in the buffer pointed to by |value|. Returns ERROR_SUCCESS on
74 LONG
ReadValue(HKEY key
,
75 const wchar_t* value_name
,
80 // Returns true if our BHO is registered in the HKLM subkey that IE checks for
81 // the list of BHOs to load.
82 bool IsBHOLoadingPolicyRegistered();
84 // Returns true if system-level Chrome Frame is installed.
85 bool IsSystemLevelChromeFrameInstalled();
87 #endif // CHROME_FRAME_CHROME_FRAME_HELPER_UTIL_H_