summaryrefslogtreecommitdiffstats
path: root/chrome_frame/bho_loader.h
blob: 05033758aa22a3c53c43b1ff4d0276d5458c2beb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_FRAME_BHO_LOADER_H_
#define CHROME_FRAME_BHO_LOADER_H_

#include <windows.h>

// Forward.
class EventHooker;

// This class simulates BHO loading in an IE process. It watches for the
// creation of a specific window and then retrieves the web browser object
// for that window and simulates loading of the BHO.
class BHOLoader {
 public:
  BHOLoader();
  ~BHOLoader();

  // Callback invoked on receipt of an accessibility event.
  void OnHookEvent(DWORD event, HWND window);

  // Call this to install event hooks that will trigger on window creation
  // and reparenting. Returns true if the hooks are successfully installed,
  // false otherwise.
  bool StartHook();

  // Call this to remove the event hooks that are installed by StartHook().
  void StopHook();

  // Retrieve the BHOLoader instance. Note that this is NOT thread-safe.
  static BHOLoader* GetInstance();

 private:
  EventHooker* hooker_;
};

#endif  // CHROME_FRAME_BHO_LOADER_H_