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

Side by Side Diff: extensions/renderer/bindings/api_bindings_system.cc

Issue 2961103002: [Extensions Bindings] Add an ExceptionHandler class (Closed)
Patch Set: rebase + nits Created 3 years, 5 months 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 unified diff | Download patch
OLDNEW
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/bindings/api_bindings_system.h" 5 #include "extensions/renderer/bindings/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/bindings/api_binding_hooks.h" 10 #include "extensions/renderer/bindings/api_binding_hooks.h"
11 11
12 namespace extensions { 12 namespace extensions {
13 13
14 APIBindingsSystem::APIBindingsSystem( 14 APIBindingsSystem::APIBindingsSystem(
15 const binding::RunJSFunction& call_js, 15 const binding::RunJSFunction& call_js,
16 const binding::RunJSFunctionSync& call_js_sync, 16 const binding::RunJSFunctionSync& call_js_sync,
17 const GetAPISchemaMethod& get_api_schema, 17 const GetAPISchemaMethod& get_api_schema,
18 const BindingAccessChecker::AvailabilityCallback& is_available, 18 const BindingAccessChecker::AvailabilityCallback& is_available,
19 const APIRequestHandler::SendRequestMethod& send_request, 19 const APIRequestHandler::SendRequestMethod& send_request,
20 const APIEventHandler::EventListenersChangedMethod& event_listeners_changed, 20 const APIEventHandler::EventListenersChangedMethod& event_listeners_changed,
21 const APIBinding::OnSilentRequest& on_silent_request, 21 const APIBinding::OnSilentRequest& on_silent_request,
22 const binding::AddConsoleError& add_console_error,
22 APILastError last_error) 23 APILastError last_error)
23 : type_reference_map_(base::Bind(&APIBindingsSystem::InitializeType, 24 : type_reference_map_(base::Bind(&APIBindingsSystem::InitializeType,
24 base::Unretained(this))), 25 base::Unretained(this))),
25 request_handler_(send_request, call_js, std::move(last_error)), 26 exception_handler_(add_console_error, call_js),
27 request_handler_(send_request,
28 call_js,
29 std::move(last_error),
30 &exception_handler_),
26 event_handler_(call_js, call_js_sync, event_listeners_changed), 31 event_handler_(call_js, call_js_sync, event_listeners_changed),
27 access_checker_(is_available), 32 access_checker_(is_available),
28 call_js_(call_js), 33 call_js_(call_js),
29 call_js_sync_(call_js_sync), 34 call_js_sync_(call_js_sync),
30 get_api_schema_(get_api_schema), 35 get_api_schema_(get_api_schema),
31 on_silent_request_(on_silent_request) {} 36 on_silent_request_(on_silent_request) {}
32 37
33 APIBindingsSystem::~APIBindingsSystem() {} 38 APIBindingsSystem::~APIBindingsSystem() {}
34 39
35 v8::Local<v8::Object> APIBindingsSystem::CreateAPIInstance( 40 v8::Local<v8::Object> APIBindingsSystem::CreateAPIInstance(
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 const std::string& property_name, 143 const std::string& property_name,
139 const base::ListValue* property_values) { 144 const base::ListValue* property_values) {
140 auto iter = custom_types_.find(type_name); 145 auto iter = custom_types_.find(type_name);
141 DCHECK(iter != custom_types_.end()) << "Custom type not found: " << type_name; 146 DCHECK(iter != custom_types_.end()) << "Custom type not found: " << type_name;
142 return iter->second.Run(isolate, property_name, property_values, 147 return iter->second.Run(isolate, property_name, property_values,
143 &request_handler_, &event_handler_, 148 &request_handler_, &event_handler_,
144 &type_reference_map_, &access_checker_); 149 &type_reference_map_, &access_checker_);
145 } 150 }
146 151
147 } // namespace extensions 152 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/bindings/api_bindings_system.h ('k') | extensions/renderer/bindings/api_bindings_system_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698