| 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_BINDINGS_SYSTEM_H_ | 5 #ifndef EXTENSIONS_RENDERER_API_BINDINGS_SYSTEM_H_ |
| 6 #define EXTENSIONS_RENDERER_API_BINDINGS_SYSTEM_H_ | 6 #define EXTENSIONS_RENDERER_API_BINDINGS_SYSTEM_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // is, maybe we should rethink this. Downside would be that it's less | 76 // is, maybe we should rethink this. Downside would be that it's less |
| 77 // efficient to register multiple hooks for the same API. | 77 // efficient to register multiple hooks for the same API. |
| 78 APIBindingHooks* GetHooksForAPI(const std::string& api_name); | 78 APIBindingHooks* GetHooksForAPI(const std::string& api_name); |
| 79 | 79 |
| 80 // Registers the handler for creating a custom type with the given | 80 // Registers the handler for creating a custom type with the given |
| 81 // |type_name|, where |type_name| is the fully-qualified type (e.g. | 81 // |type_name|, where |type_name| is the fully-qualified type (e.g. |
| 82 // storage.StorageArea). | 82 // storage.StorageArea). |
| 83 void RegisterCustomType(const std::string& type_name, | 83 void RegisterCustomType(const std::string& type_name, |
| 84 const CustomTypeHandler& function); | 84 const CustomTypeHandler& function); |
| 85 | 85 |
| 86 // Handles any cleanup necessary before releasing the given |context|. |
| 87 void WillReleaseContext(v8::Local<v8::Context> context); |
| 88 |
| 86 APIRequestHandler* request_handler() { return &request_handler_; } | 89 APIRequestHandler* request_handler() { return &request_handler_; } |
| 87 APITypeReferenceMap* type_reference_map() { return &type_reference_map_; } | 90 APITypeReferenceMap* type_reference_map() { return &type_reference_map_; } |
| 88 | 91 |
| 89 private: | 92 private: |
| 90 // Creates a new APIBinding for the given |api_name|. | 93 // Creates a new APIBinding for the given |api_name|. |
| 91 std::unique_ptr<APIBinding> CreateNewAPIBinding(const std::string& api_name); | 94 std::unique_ptr<APIBinding> CreateNewAPIBinding(const std::string& api_name); |
| 92 | 95 |
| 93 // Callback for the APITypeReferenceMap in order to initialize an unknown | 96 // Callback for the APITypeReferenceMap in order to initialize an unknown |
| 94 // type. | 97 // type. |
| 95 void InitializeType(const std::string& name); | 98 void InitializeType(const std::string& name); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 126 // The method to retrieve the DictionaryValue describing a given extension | 129 // The method to retrieve the DictionaryValue describing a given extension |
| 127 // API. Curried in for testing purposes so we can use fake APIs. | 130 // API. Curried in for testing purposes so we can use fake APIs. |
| 128 GetAPISchemaMethod get_api_schema_; | 131 GetAPISchemaMethod get_api_schema_; |
| 129 | 132 |
| 130 DISALLOW_COPY_AND_ASSIGN(APIBindingsSystem); | 133 DISALLOW_COPY_AND_ASSIGN(APIBindingsSystem); |
| 131 }; | 134 }; |
| 132 | 135 |
| 133 } // namespace | 136 } // namespace |
| 134 | 137 |
| 135 #endif // EXTENSIONS_RENDERER_API_BINDINGS_SYSTEM_H_ | 138 #endif // EXTENSIONS_RENDERER_API_BINDINGS_SYSTEM_H_ |
| OLD | NEW |