blob: 28a1f8848fb0cd6491511168c8b9285faa314b8f [file] [log] [blame]
[email protected]6a7748e2011-05-27 16:44:311// Copyright (c) 2011 The Chromium Authors. All rights reserved.
[email protected]9ceda772010-08-30 15:34:112// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_FRAME_CHROME_FRAME_HELPER_UTIL_H_
6#define CHROME_FRAME_CHROME_FRAME_HELPER_UTIL_H_
7
8#include <windows.h>
9
10// Compare the given class name with the known window class names for
11// internet explorer browser windows.
12//
13// @param [in] window_to_check handle to the window to be checked
14//
15// @return true if the window class matches known class names for IE browser.
16//
17bool UtilIsWebBrowserWindow(HWND window_to_check);
18
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
27//
28HRESULT UtilGetWebBrowserObjectFromWindow(HWND window,
29 REFIID iid,
30 void** web_browser_object);
31
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
35// matched.
36// @param window_class [in] The window class to match against.
37//
38bool IsWindowOfClass(HWND hwnd_to_match, const wchar_t* window_class);
39
40// Returns true if the current process name is process_name, false otherwise.
41bool IsNamedProcess(const wchar_t* process_name);
42
[email protected]35e09b22011-02-04 00:59:3943// Returns true if window has the name |window_name|, false otherwise.
44bool IsNamedWindow(HWND window, const wchar_t* window_name);
45
46//
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.
64//
65HWND 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);
70
[email protected]6a7748e2011-05-27 16:44:3171// 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
73// success.
74LONG ReadValue(HKEY key,
75 const wchar_t* value_name,
76 size_t value_size,
77 wchar_t* value);
78
79
80// Returns true if our BHO is registered in the HKLM subkey that IE checks for
81// the list of BHOs to load.
82bool IsBHOLoadingPolicyRegistered();
83
84// Returns true if system-level Chrome Frame is installed.
85bool IsSystemLevelChromeFrameInstalled();
86
[email protected]9ceda772010-08-30 15:34:1187#endif // CHROME_FRAME_CHROME_FRAME_HELPER_UTIL_H_