OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "extensions/renderer/api_bindings_system.h" | 5 #include "extensions/renderer/api_bindings_system.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "extensions/renderer/api_binding_hooks.h" | 10 #include "extensions/renderer/api_binding_hooks.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 96 } |
97 | 97 |
98 void APIBindingsSystem::CompleteRequest(int request_id, | 98 void APIBindingsSystem::CompleteRequest(int request_id, |
99 const base::ListValue& response, | 99 const base::ListValue& response, |
100 const std::string& error) { | 100 const std::string& error) { |
101 request_handler_.CompleteRequest(request_id, response, error); | 101 request_handler_.CompleteRequest(request_id, response, error); |
102 } | 102 } |
103 | 103 |
104 void APIBindingsSystem::FireEventInContext(const std::string& event_name, | 104 void APIBindingsSystem::FireEventInContext(const std::string& event_name, |
105 v8::Local<v8::Context> context, | 105 v8::Local<v8::Context> context, |
106 const base::ListValue& response) { | 106 const base::ListValue& response, |
107 event_handler_.FireEventInContext(event_name, context, response); | 107 const EventFilteringInfo& filter) { |
| 108 event_handler_.FireEventInContext(event_name, context, response, filter); |
108 } | 109 } |
109 | 110 |
110 APIBindingHooks* APIBindingsSystem::GetHooksForAPI( | 111 APIBindingHooks* APIBindingsSystem::GetHooksForAPI( |
111 const std::string& api_name) { | 112 const std::string& api_name) { |
112 DCHECK(api_bindings_.empty()) | 113 DCHECK(api_bindings_.empty()) |
113 << "Hook registration must happen before creating any binding instances."; | 114 << "Hook registration must happen before creating any binding instances."; |
114 std::unique_ptr<APIBindingHooks>& hooks = binding_hooks_[api_name]; | 115 std::unique_ptr<APIBindingHooks>& hooks = binding_hooks_[api_name]; |
115 if (!hooks) | 116 if (!hooks) |
116 hooks = base::MakeUnique<APIBindingHooks>(api_name, call_js_sync_); | 117 hooks = base::MakeUnique<APIBindingHooks>(api_name, call_js_sync_); |
117 return hooks.get(); | 118 return hooks.get(); |
(...skipping 15 matching lines...) Expand all Loading... |
133 v8::Local<v8::Context> context, | 134 v8::Local<v8::Context> context, |
134 const std::string& type_name, | 135 const std::string& type_name, |
135 const std::string& property_name) { | 136 const std::string& property_name) { |
136 auto iter = custom_types_.find(type_name); | 137 auto iter = custom_types_.find(type_name); |
137 DCHECK(iter != custom_types_.end()) << "Custom type not found: " << type_name; | 138 DCHECK(iter != custom_types_.end()) << "Custom type not found: " << type_name; |
138 return iter->second.Run(context, property_name, &request_handler_, | 139 return iter->second.Run(context, property_name, &request_handler_, |
139 &event_handler_, &type_reference_map_); | 140 &event_handler_, &type_reference_map_); |
140 } | 141 } |
141 | 142 |
142 } // namespace extensions | 143 } // namespace extensions |
OLD | NEW |