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

Side by Side Diff: extensions/renderer/api_binding.h

Issue 2575173002: [Extensions Bindings] Add a bridge to use current custom bindings (Closed)
Patch Set: . Created 4 years 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 #ifndef EXTENSIONS_RENDERER_API_BINDING_H_ 5 #ifndef EXTENSIONS_RENDERER_API_BINDING_H_
6 #define EXTENSIONS_RENDERER_API_BINDING_H_ 6 #define EXTENSIONS_RENDERER_API_BINDING_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 ArgumentSpec::RefMap* type_refs); 67 ArgumentSpec::RefMap* type_refs);
68 ~APIBinding(); 68 ~APIBinding();
69 69
70 // Returns a new v8::Object for the API this APIBinding represents. 70 // Returns a new v8::Object for the API this APIBinding represents.
71 v8::Local<v8::Object> CreateInstance( 71 v8::Local<v8::Object> CreateInstance(
72 v8::Local<v8::Context> context, 72 v8::Local<v8::Context> context,
73 v8::Isolate* isolate, 73 v8::Isolate* isolate,
74 APIEventHandler* event_handler, 74 APIEventHandler* event_handler,
75 const AvailabilityCallback& is_available); 75 const AvailabilityCallback& is_available);
76 76
77 // Returns the JS interface to use when registering hooks with legacy custom
78 // bindings.
79 v8::Local<v8::Object> GetJSHooksInterface(v8::Local<v8::Context> context);
80
77 private: 81 private:
78 using APISignature = std::vector<std::unique_ptr<ArgumentSpec>>; 82 using APISignature = std::vector<std::unique_ptr<ArgumentSpec>>;
79 83
80 // Handles a call an API method with the given |name| and matches the 84 // Handles a call an API method with the given |name| and matches the
81 // arguments against |signature|. 85 // arguments against |signature|.
82 void HandleCall(const std::string& name, 86 void HandleCall(const std::string& name,
83 const APISignature* signature, 87 const APISignature* signature,
84 gin::Arguments* args); 88 gin::Arguments* args);
85 89
86 // The root name of the API, e.g. "tabs" for chrome.tabs. 90 // The root name of the API, e.g. "tabs" for chrome.tabs.
(...skipping 16 matching lines...) Expand all
103 const ArgumentSpec::RefMap* type_refs_; 107 const ArgumentSpec::RefMap* type_refs_;
104 108
105 base::WeakPtrFactory<APIBinding> weak_factory_; 109 base::WeakPtrFactory<APIBinding> weak_factory_;
106 110
107 DISALLOW_COPY_AND_ASSIGN(APIBinding); 111 DISALLOW_COPY_AND_ASSIGN(APIBinding);
108 }; 112 };
109 113
110 } // namespace extensions 114 } // namespace extensions
111 115
112 #endif // EXTENSIONS_RENDERER_API_BINDING_H_ 116 #endif // EXTENSIONS_RENDERER_API_BINDING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698