summaryrefslogtreecommitdiffstats
path: root/ceee/ie/broker/window_events_funnel.h
blob: 0278959e864ef76dbd3a031f276a37d71dab49e8 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
// 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.
//
// Funnel of Chrome Extension Window Events.

#ifndef CEEE_IE_BROKER_WINDOW_EVENTS_FUNNEL_H_
#define CEEE_IE_BROKER_WINDOW_EVENTS_FUNNEL_H_

#include <wtypes.h>  // For HRESULT and others...

#include "base/basictypes.h"


// Fwd.
class Value;


// Implements a set of methods to send window related events to the Chrome.
class WindowEventsFunnel {
 public:
  WindowEventsFunnel() {}
  virtual ~WindowEventsFunnel() {}

  // Un/Register our window to receive Shell Hook Notification Messages.
  static void Initialize();
  static void Terminate();

  // Sends the windows.onCreated event to Chrome.
  // @param window_id The identifier of the window that was created.
  virtual HRESULT OnCreated(int window_id);

  // Sends the windows.onFocusChanged event to Chrome.
  // @param window_id The identifier of the window that received the focus.
  virtual HRESULT OnFocusChanged(int window_id);

  // Sends the windows.onRemoved event to Chrome.
  // @param window_id The identifier of the window that was removed.
  virtual HRESULT OnRemoved(int window_id);

 protected:
  // Send the given event to Chrome.
  // @param event_name The name of the event.
  // @param event_args The arguments to be sent with the event.
  // protected virtual for testability...
  virtual HRESULT SendEvent(const char* event_name,
                            const Value& event_args);
 private:
  DISALLOW_COPY_AND_ASSIGN(WindowEventsFunnel);
};

#endif  // CEEE_IE_BROKER_WINDOW_EVENTS_FUNNEL_H_