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

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

Issue 2438623002: [Extensions Bindings] Add APIBindingsSystem (Closed)
Patch Set: woot Created 4 years, 2 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 #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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 std::vector<std::unique_ptr<HandlerCallback>> context_callbacks; 74 std::vector<std::unique_ptr<HandlerCallback>> context_callbacks;
75 }; 75 };
76 76
77 // Handles a call an API method with the given |name| and matches the 77 // Handles a call an API method with the given |name| and matches the
78 // arguments against |signature|. 78 // arguments against |signature|.
79 void HandleCall(const std::string& name, 79 void HandleCall(const std::string& name,
80 const APISignature* signature, 80 const APISignature* signature,
81 gin::Arguments* args); 81 gin::Arguments* args);
82 82
83 // The root name of the API, e.g. "tabs" for chrome.tabs.
84 std::string api_name_;
85
83 // A map from method name to expected signature. 86 // A map from method name to expected signature.
84 std::map<std::string, std::unique_ptr<APISignature>> signatures_; 87 std::map<std::string, std::unique_ptr<APISignature>> signatures_;
85 88
86 // The callback to use when an API is invoked with valid arguments. 89 // The callback to use when an API is invoked with valid arguments.
87 APIMethodCallback method_callback_; 90 APIMethodCallback method_callback_;
88 91
89 // The reference map for all known types; required to outlive this object. 92 // The reference map for all known types; required to outlive this object.
90 const ArgumentSpec::RefMap* type_refs_; 93 const ArgumentSpec::RefMap* type_refs_;
91 94
92 base::WeakPtrFactory<APIBinding> weak_factory_; 95 base::WeakPtrFactory<APIBinding> weak_factory_;
93 96
94 DISALLOW_COPY_AND_ASSIGN(APIBinding); 97 DISALLOW_COPY_AND_ASSIGN(APIBinding);
95 }; 98 };
96 99
97 } // namespace extensions 100 } // namespace extensions
98 101
99 #endif // EXTENSIONS_RENDERER_API_BINDING_H_ 102 #endif // EXTENSIONS_RENDERER_API_BINDING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698