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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 const CreateCustomType& create_custom_type, | 65 const CreateCustomType& create_custom_type, |
66 std::unique_ptr<APIBindingHooks> binding_hooks, | 66 std::unique_ptr<APIBindingHooks> binding_hooks, |
67 APITypeReferenceMap* type_refs, | 67 APITypeReferenceMap* type_refs, |
68 APIRequestHandler* request_handler, | 68 APIRequestHandler* request_handler, |
69 APIEventHandler* event_handler); | 69 APIEventHandler* event_handler); |
70 ~APIBinding(); | 70 ~APIBinding(); |
71 | 71 |
72 // Returns a new v8::Object for the API this APIBinding represents. | 72 // Returns a new v8::Object for the API this APIBinding represents. |
73 v8::Local<v8::Object> CreateInstance( | 73 v8::Local<v8::Object> CreateInstance( |
74 v8::Local<v8::Context> context, | 74 v8::Local<v8::Context> context, |
75 v8::Isolate* isolate, | |
76 const AvailabilityCallback& is_available); | 75 const AvailabilityCallback& is_available); |
77 | 76 |
78 APIBindingHooks* hooks() { return binding_hooks_.get(); } | 77 APIBindingHooks* hooks() { return binding_hooks_.get(); } |
79 | 78 |
80 private: | 79 private: |
81 // Initializes the object_template_ for this API. Called lazily when the | 80 // Initializes the object_template_ for this API. Called lazily when the |
82 // first instance is created. | 81 // first instance is created. |
83 void InitializeTemplate(v8::Isolate* isolate); | 82 void InitializeTemplate(v8::Isolate* isolate); |
84 | 83 |
85 // Decorates |object_template| with the properties specified by |properties|. | 84 // Decorates |object_template| with the properties specified by |properties|. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 v8::Eternal<v8::ObjectTemplate> object_template_; | 150 v8::Eternal<v8::ObjectTemplate> object_template_; |
152 | 151 |
153 base::WeakPtrFactory<APIBinding> weak_factory_; | 152 base::WeakPtrFactory<APIBinding> weak_factory_; |
154 | 153 |
155 DISALLOW_COPY_AND_ASSIGN(APIBinding); | 154 DISALLOW_COPY_AND_ASSIGN(APIBinding); |
156 }; | 155 }; |
157 | 156 |
158 } // namespace extensions | 157 } // namespace extensions |
159 | 158 |
160 #endif // EXTENSIONS_RENDERER_API_BINDING_H_ | 159 #endif // EXTENSIONS_RENDERER_API_BINDING_H_ |
OLD | NEW |