OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/extensions/event_router.h" | 5 #include "chrome/browser/extensions/event_router.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 #include "content/public/browser/render_process_host.h" | 38 #include "content/public/browser/render_process_host.h" |
39 | 39 |
40 using base::DictionaryValue; | 40 using base::DictionaryValue; |
41 using base::ListValue; | 41 using base::ListValue; |
42 using content::BrowserThread; | 42 using content::BrowserThread; |
43 | 43 |
44 namespace extensions { | 44 namespace extensions { |
45 | 45 |
46 namespace { | 46 namespace { |
47 | 47 |
48 const char kDispatchEvent[] = "Event.dispatchEvent"; | |
49 | |
50 void NotifyEventListenerRemovedOnIOThread( | 48 void NotifyEventListenerRemovedOnIOThread( |
51 void* profile, | 49 void* profile, |
52 const std::string& extension_id, | 50 const std::string& extension_id, |
53 const std::string& sub_event_name) { | 51 const std::string& sub_event_name) { |
54 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( | 52 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( |
55 profile, extension_id, sub_event_name); | 53 profile, extension_id, sub_event_name); |
56 } | 54 } |
57 | 55 |
58 void DispatchOnInstalledEvent( | 56 void DispatchOnInstalledEvent( |
59 Profile* profile, | 57 Profile* profile, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 scoped_ptr<ListValue>(event_args->DeepCopy())); | 127 scoped_ptr<ListValue>(event_args->DeepCopy())); |
130 } | 128 } |
131 | 129 |
132 ListValue args; | 130 ListValue args; |
133 args.Set(0, Value::CreateStringValue(event_name)); | 131 args.Set(0, Value::CreateStringValue(event_name)); |
134 args.Set(1, event_args); | 132 args.Set(1, event_args); |
135 args.Set(2, info.AsValue().release()); | 133 args.Set(2, info.AsValue().release()); |
136 ipc_sender->Send(new ExtensionMsg_MessageInvoke( | 134 ipc_sender->Send(new ExtensionMsg_MessageInvoke( |
137 MSG_ROUTING_CONTROL, | 135 MSG_ROUTING_CONTROL, |
138 extension_id, | 136 extension_id, |
139 kDispatchEvent, | 137 "event_bindings", |
| 138 "dispatchEvent", |
140 args, | 139 args, |
141 user_gesture == USER_GESTURE_ENABLED)); | 140 user_gesture == USER_GESTURE_ENABLED)); |
142 | 141 |
143 // DispatchExtensionMessage does _not_ take ownership of event_args, so we | 142 // DispatchExtensionMessage does _not_ take ownership of event_args, so we |
144 // must ensure that the destruction of args does not attempt to free it. | 143 // must ensure that the destruction of args does not attempt to free it. |
145 Value* removed_event_args = NULL; | 144 Value* removed_event_args = NULL; |
146 args.Remove(1, &removed_event_args); | 145 args.Remove(1, &removed_event_args); |
147 } | 146 } |
148 | 147 |
149 // static | 148 // static |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 copy->will_dispatch_callback = will_dispatch_callback; | 845 copy->will_dispatch_callback = will_dispatch_callback; |
847 return copy; | 846 return copy; |
848 } | 847 } |
849 | 848 |
850 EventListenerInfo::EventListenerInfo(const std::string& event_name, | 849 EventListenerInfo::EventListenerInfo(const std::string& event_name, |
851 const std::string& extension_id) | 850 const std::string& extension_id) |
852 : event_name(event_name), | 851 : event_name(event_name), |
853 extension_id(extension_id) {} | 852 extension_id(extension_id) {} |
854 | 853 |
855 } // namespace extensions | 854 } // namespace extensions |
OLD | NEW |