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 18 matching lines...) Expand all Loading... |
29 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
30 #include "chrome/common/chrome_version_info.h" | 30 #include "chrome/common/chrome_version_info.h" |
31 #include "chrome/common/extensions/api/extension_api.h" | 31 #include "chrome/common/extensions/api/extension_api.h" |
32 #include "chrome/common/extensions/background_info.h" | 32 #include "chrome/common/extensions/background_info.h" |
33 #include "chrome/common/extensions/extension.h" | 33 #include "chrome/common/extensions/extension.h" |
34 #include "chrome/common/extensions/extension_messages.h" | 34 #include "chrome/common/extensions/extension_messages.h" |
35 #include "chrome/common/extensions/incognito_handler.h" | 35 #include "chrome/common/extensions/incognito_handler.h" |
36 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
37 #include "content/public/browser/notification_service.h" | 37 #include "content/public/browser/notification_service.h" |
38 #include "content/public/browser/render_process_host.h" | 38 #include "content/public/browser/render_process_host.h" |
| 39 #include "extensions/common/extension_urls.h" |
39 | 40 |
40 using base::DictionaryValue; | 41 using base::DictionaryValue; |
41 using base::ListValue; | 42 using base::ListValue; |
42 using content::BrowserThread; | 43 using content::BrowserThread; |
43 | 44 |
44 namespace extensions { | 45 namespace extensions { |
45 | 46 |
46 namespace { | 47 namespace { |
47 | 48 |
48 void NotifyEventListenerRemovedOnIOThread( | 49 void NotifyEventListenerRemovedOnIOThread( |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 scoped_ptr<ListValue>(event_args->DeepCopy())); | 130 scoped_ptr<ListValue>(event_args->DeepCopy())); |
130 } | 131 } |
131 | 132 |
132 ListValue args; | 133 ListValue args; |
133 args.Set(0, new base::StringValue(event_name)); | 134 args.Set(0, new base::StringValue(event_name)); |
134 args.Set(1, event_args); | 135 args.Set(1, event_args); |
135 args.Set(2, info.AsValue().release()); | 136 args.Set(2, info.AsValue().release()); |
136 ipc_sender->Send(new ExtensionMsg_MessageInvoke( | 137 ipc_sender->Send(new ExtensionMsg_MessageInvoke( |
137 MSG_ROUTING_CONTROL, | 138 MSG_ROUTING_CONTROL, |
138 extension_id, | 139 extension_id, |
139 "event_bindings", | 140 kEventBindings, |
140 "dispatchEvent", | 141 "dispatchEvent", |
141 args, | 142 args, |
142 user_gesture == USER_GESTURE_ENABLED)); | 143 user_gesture == USER_GESTURE_ENABLED)); |
143 | 144 |
144 // DispatchExtensionMessage does _not_ take ownership of event_args, so we | 145 // DispatchExtensionMessage does _not_ take ownership of event_args, so we |
145 // must ensure that the destruction of args does not attempt to free it. | 146 // must ensure that the destruction of args does not attempt to free it. |
146 scoped_ptr<Value> removed_event_args; | 147 scoped_ptr<Value> removed_event_args; |
147 args.Remove(1, &removed_event_args); | 148 args.Remove(1, &removed_event_args); |
148 ignore_result(removed_event_args.release()); | 149 ignore_result(removed_event_args.release()); |
149 } | 150 } |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 copy->will_dispatch_callback = will_dispatch_callback; | 862 copy->will_dispatch_callback = will_dispatch_callback; |
862 return copy; | 863 return copy; |
863 } | 864 } |
864 | 865 |
865 EventListenerInfo::EventListenerInfo(const std::string& event_name, | 866 EventListenerInfo::EventListenerInfo(const std::string& event_name, |
866 const std::string& extension_id) | 867 const std::string& extension_id) |
867 : event_name(event_name), | 868 : event_name(event_name), |
868 extension_id(extension_id) {} | 869 extension_id(extension_id) {} |
869 | 870 |
870 } // namespace extensions | 871 } // namespace extensions |
OLD | NEW |