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

Side by Side Diff: extensions/renderer/api_binding_hooks_test_delegate.cc

Issue 2853023002: [Extensions Bindings] Add native declarativeContent verification (Closed)
Patch Set: lazyboy's Created 3 years, 7 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_binding_hooks_test_delegate.h" 5 #include "extensions/renderer/api_binding_hooks_test_delegate.h"
6 6
7 namespace extensions { 7 namespace extensions {
8 8
9 APIBindingHooksTestDelegate::APIBindingHooksTestDelegate() {} 9 APIBindingHooksTestDelegate::APIBindingHooksTestDelegate() {}
10 APIBindingHooksTestDelegate::~APIBindingHooksTestDelegate() {} 10 APIBindingHooksTestDelegate::~APIBindingHooksTestDelegate() {}
(...skipping 13 matching lines...) Expand all
24 void APIBindingHooksTestDelegate::AddHandler(base::StringPiece name, 24 void APIBindingHooksTestDelegate::AddHandler(base::StringPiece name,
25 const RequestHandler& handler) { 25 const RequestHandler& handler) {
26 request_handlers_[name.as_string()] = handler; 26 request_handlers_[name.as_string()] = handler;
27 } 27 }
28 28
29 void APIBindingHooksTestDelegate::SetCustomEvent( 29 void APIBindingHooksTestDelegate::SetCustomEvent(
30 const CustomEventFactory& custom_event) { 30 const CustomEventFactory& custom_event) {
31 custom_event_ = custom_event; 31 custom_event_ = custom_event;
32 } 32 }
33 33
34 void APIBindingHooksTestDelegate::SetTemplateInitializer(
35 const TemplateInitializer& initializer) {
36 template_initializer_ = initializer;
37 }
38
34 APIBindingHooks::RequestResult APIBindingHooksTestDelegate::HandleRequest( 39 APIBindingHooks::RequestResult APIBindingHooksTestDelegate::HandleRequest(
35 const std::string& method_name, 40 const std::string& method_name,
36 const APISignature* signature, 41 const APISignature* signature,
37 v8::Local<v8::Context> context, 42 v8::Local<v8::Context> context,
38 std::vector<v8::Local<v8::Value>>* arguments, 43 std::vector<v8::Local<v8::Value>>* arguments,
39 const APITypeReferenceMap& refs) { 44 const APITypeReferenceMap& refs) {
40 auto iter = request_handlers_.find(method_name); 45 auto iter = request_handlers_.find(method_name);
41 if (iter == request_handlers_.end()) { 46 if (iter == request_handlers_.end()) {
42 return APIBindingHooks::RequestResult( 47 return APIBindingHooks::RequestResult(
43 APIBindingHooks::RequestResult::NOT_HANDLED); 48 APIBindingHooks::RequestResult::NOT_HANDLED);
44 } 49 }
45 return iter->second.Run(signature, context, arguments, refs); 50 return iter->second.Run(signature, context, arguments, refs);
46 } 51 }
47 52
53 void APIBindingHooksTestDelegate::InitializeTemplate(
54 v8::Isolate* isolate,
55 v8::Local<v8::ObjectTemplate> object_template,
56 const APITypeReferenceMap& type_refs) {
57 if (template_initializer_)
58 template_initializer_.Run(isolate, object_template, type_refs);
59 }
60
48 } // namespace extensions 61 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/api_binding_hooks_test_delegate.h ('k') | extensions/renderer/api_binding_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698