OLD | NEW |
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 v8::Local<v8::Function>)>; | 50 v8::Local<v8::Function>)>; |
51 | 51 |
52 // The callback for determining if a given API method (specified by |name|) | 52 // The callback for determining if a given API method (specified by |name|) |
53 // is available. | 53 // is available. |
54 using AvailabilityCallback = base::Callback<bool(const std::string& name)>; | 54 using AvailabilityCallback = base::Callback<bool(const std::string& name)>; |
55 | 55 |
56 // The callback type for handling an API call. | 56 // The callback type for handling an API call. |
57 using HandlerCallback = base::Callback<void(gin::Arguments*)>; | 57 using HandlerCallback = base::Callback<void(gin::Arguments*)>; |
58 | 58 |
59 // The ArgumentSpec::RefMap is required to outlive this object. | 59 // The ArgumentSpec::RefMap is required to outlive this object. |
60 // |type_definitions| and |event_definitions| may be null if the API does not | 60 // |function_definitions|, |type_definitions| and |event_definitions| |
61 // specify any types or events. | 61 // may be null if the API does not specify any of that category. |
62 APIBinding(const std::string& name, | 62 APIBinding(const std::string& name, |
63 const base::ListValue& function_definitions, | 63 const base::ListValue* function_definitions, |
64 const base::ListValue* type_definitions, | 64 const base::ListValue* type_definitions, |
65 const base::ListValue* event_definitions, | 65 const base::ListValue* event_definitions, |
66 const APIMethodCallback& callback, | 66 const APIMethodCallback& callback, |
67 std::unique_ptr<APIBindingHooks> binding_hooks, | 67 std::unique_ptr<APIBindingHooks> binding_hooks, |
68 ArgumentSpec::RefMap* type_refs); | 68 ArgumentSpec::RefMap* type_refs); |
69 ~APIBinding(); | 69 ~APIBinding(); |
70 | 70 |
71 // Returns a new v8::Object for the API this APIBinding represents. | 71 // Returns a new v8::Object for the API this APIBinding represents. |
72 v8::Local<v8::Object> CreateInstance( | 72 v8::Local<v8::Object> CreateInstance( |
73 v8::Local<v8::Context> context, | 73 v8::Local<v8::Context> context, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 const ArgumentSpec::RefMap* type_refs_; | 105 const ArgumentSpec::RefMap* type_refs_; |
106 | 106 |
107 base::WeakPtrFactory<APIBinding> weak_factory_; | 107 base::WeakPtrFactory<APIBinding> weak_factory_; |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(APIBinding); | 109 DISALLOW_COPY_AND_ASSIGN(APIBinding); |
110 }; | 110 }; |
111 | 111 |
112 } // namespace extensions | 112 } // namespace extensions |
113 | 113 |
114 #endif // EXTENSIONS_RENDERER_API_BINDING_H_ | 114 #endif // EXTENSIONS_RENDERER_API_BINDING_H_ |
OLD | NEW |