Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Unified Diff: extensions/renderer/api_bindings_system.cc

Issue 2480203002: ui: Cleanup class/struct forward declarations (Closed)
Patch Set: Sync CL to position 430550 Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/renderer/api_bindings_system.h ('k') | extensions/renderer/api_bindings_system_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/api_bindings_system.cc
diff --git a/extensions/renderer/api_bindings_system.cc b/extensions/renderer/api_bindings_system.cc
index 86ae7ab7ece4c7795acfd8c8f86f5da48fd29185..6fb7388a38cbd05892b93e20bdc7ac2f52723a2e 100644
--- a/extensions/renderer/api_bindings_system.cc
+++ b/extensions/renderer/api_bindings_system.cc
@@ -13,11 +13,11 @@ namespace extensions {
APIBindingsSystem::Request::Request() {}
APIBindingsSystem::Request::~Request() {}
-APIBindingsSystem::APIBindingsSystem(
- const APIRequestHandler::CallJSFunction& call_js,
- const GetAPISchemaMethod& get_api_schema,
- const SendRequestMethod& send_request)
+APIBindingsSystem::APIBindingsSystem(const binding::RunJSFunction& call_js,
+ const GetAPISchemaMethod& get_api_schema,
+ const SendRequestMethod& send_request)
: request_handler_(call_js),
+ event_handler_(call_js),
get_api_schema_(get_api_schema),
send_request_(send_request) {}
@@ -31,7 +31,8 @@ v8::Local<v8::Object> APIBindingsSystem::CreateAPIInstance(
std::unique_ptr<APIBinding>& binding = api_bindings_[api_name];
if (!binding)
binding = CreateNewAPIBinding(api_name);
- return binding->CreateInstance(context, isolate, is_available);
+ return binding->CreateInstance(
+ context, isolate, &event_handler_, is_available);
}
std::unique_ptr<APIBinding> APIBindingsSystem::CreateNewAPIBinding(
@@ -43,9 +44,11 @@ std::unique_ptr<APIBinding> APIBindingsSystem::CreateNewAPIBinding(
const base::ListValue* type_definitions = nullptr;
// Type definitions might not exist for the given API.
api_schema.GetList("types", &type_definitions);
+ const base::ListValue* event_definitions = nullptr;
+ api_schema.GetList("events", &event_definitions);
return base::MakeUnique<APIBinding>(
- api_name, *function_definitions, type_definitions,
+ api_name, *function_definitions, type_definitions, event_definitions,
base::Bind(&APIBindingsSystem::OnAPICall, base::Unretained(this)),
&type_reference_map_);
}
@@ -55,6 +58,12 @@ void APIBindingsSystem::CompleteRequest(const std::string& request_id,
request_handler_.CompleteRequest(request_id, response);
}
+void APIBindingsSystem::FireEventInContext(const std::string& event_name,
+ v8::Local<v8::Context> context,
+ const base::ListValue& response) {
+ event_handler_.FireEventInContext(event_name, context, response);
+}
+
void APIBindingsSystem::OnAPICall(const std::string& name,
std::unique_ptr<base::ListValue> arguments,
v8::Isolate* isolate,
« no previous file with comments | « extensions/renderer/api_bindings_system.h ('k') | extensions/renderer/api_bindings_system_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698