OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_EVENT_H_ | 5 #ifndef COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_EVENT_H_ |
6 #define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_EVENT_H_ | 6 #define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_EVENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 | 13 |
14 namespace guest_view { | 14 namespace guest_view { |
15 | 15 |
16 class GuestViewBase; | 16 class GuestViewBase; |
17 | 17 |
18 // A GuestViewEvent is a wrapper class for a GuestView event. | 18 // A GuestViewEvent is a wrapper class for a GuestView event. |
19 // GuestViewEvents may be queued until the guest is attached to a container. | 19 // GuestViewEvents may be queued until the guest is attached to a container. |
20 // This wrapper class holds all the necessary information to fire the event | 20 // This wrapper class holds all the necessary information to fire the event |
21 // on attachment. GuestViewEvents are owned by GuestViewBase. | 21 // on attachment. GuestViewEvents are owned by GuestViewBase. |
22 class GuestViewEvent { | 22 class GuestViewEvent { |
23 public: | 23 public: |
24 GuestViewEvent(const std::string& name, | 24 GuestViewEvent(const std::string& name, |
25 scoped_ptr<base::DictionaryValue> args); | 25 scoped_ptr<base::DictionaryValue> args); |
26 ~GuestViewEvent(); | 26 ~GuestViewEvent(); |
27 | 27 |
28 // This method will dispatch the event to the specified |guest|'s embedder and | 28 // This method will dispatch the event to the specified |guest|'s embedder and |
29 // use the provided |instance_id| for routing. After dispatch, this object | 29 // use the provided |instance_id| for routing. |
30 // will self-destruct. | |
31 void Dispatch(GuestViewBase* guest, int instance_id); | 30 void Dispatch(GuestViewBase* guest, int instance_id); |
32 | 31 |
33 private: | 32 private: |
34 const std::string name_; | 33 const std::string name_; |
35 scoped_ptr<base::DictionaryValue> args_; | 34 scoped_ptr<base::DictionaryValue> args_; |
36 | 35 |
37 DISALLOW_COPY_AND_ASSIGN(GuestViewEvent); | 36 DISALLOW_COPY_AND_ASSIGN(GuestViewEvent); |
38 }; | 37 }; |
39 | 38 |
40 } // namespace guest_view | 39 } // namespace guest_view |
41 | 40 |
42 #endif // COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_EVENT_H_ | 41 #endif // COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_EVENT_H_ |
OLD | NEW |