summaryrefslogtreecommitdiffstats
path: root/extensions/browser/guest_view/guest_view_event.h
blob: 1d557a0ba12c8cdfee288094a584cc1f73dc1893 (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
// Copyright 2015 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 EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_EVENT_H_
#define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_EVENT_H_

#include <string>

#include "base/memory/scoped_ptr.h"
#include "base/values.h"

namespace extensions {

class GuestViewBase;

// A GuestViewEvent is a wrapper class for an extension event.
// GuestViewEvents may be queued until the guest is attached to a conatiner.
// This wrapper class holds all the necessary information to fire the event
// on attachment. GuestViewEvents are owned by GuestViewBase.
class GuestViewEvent {
 public:
  GuestViewEvent(const std::string& name,
                 scoped_ptr<base::DictionaryValue> args);
  ~GuestViewEvent();

  // This method will dispatch the event to the specified |guest|'s embedder and
  // use the provided |instance_id| for routing. After dispatch, this object
  // will self-destruct.
  void Dispatch(GuestViewBase* guest, int instance_id);

private:
  const std::string name_;
  scoped_ptr<base::DictionaryValue> args_;

  DISALLOW_COPY_AND_ASSIGN(GuestViewEvent);
};

}  // namespace extensions

#endif  // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_EVENT_H_