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