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 // 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 APIRequestHandler* request_handler() { return &request_handler_; } | 86 APIRequestHandler* request_handler() { return &request_handler_; } |
| 87 APIEventHandler* event_handler() { return &event_handler_; } |
87 APITypeReferenceMap* type_reference_map() { return &type_reference_map_; } | 88 APITypeReferenceMap* type_reference_map() { return &type_reference_map_; } |
88 | 89 |
89 private: | 90 private: |
90 // Creates a new APIBinding for the given |api_name|. | 91 // Creates a new APIBinding for the given |api_name|. |
91 std::unique_ptr<APIBinding> CreateNewAPIBinding(const std::string& api_name); | 92 std::unique_ptr<APIBinding> CreateNewAPIBinding(const std::string& api_name); |
92 | 93 |
93 // Callback for the APITypeReferenceMap in order to initialize an unknown | 94 // Callback for the APITypeReferenceMap in order to initialize an unknown |
94 // type. | 95 // type. |
95 void InitializeType(const std::string& name); | 96 void InitializeType(const std::string& name); |
96 | 97 |
(...skipping 29 matching lines...) Expand all Loading... |
126 // The method to retrieve the DictionaryValue describing a given extension | 127 // The method to retrieve the DictionaryValue describing a given extension |
127 // API. Curried in for testing purposes so we can use fake APIs. | 128 // API. Curried in for testing purposes so we can use fake APIs. |
128 GetAPISchemaMethod get_api_schema_; | 129 GetAPISchemaMethod get_api_schema_; |
129 | 130 |
130 DISALLOW_COPY_AND_ASSIGN(APIBindingsSystem); | 131 DISALLOW_COPY_AND_ASSIGN(APIBindingsSystem); |
131 }; | 132 }; |
132 | 133 |
133 } // namespace | 134 } // namespace |
134 | 135 |
135 #endif // EXTENSIONS_RENDERER_API_BINDINGS_SYSTEM_H_ | 136 #endif // EXTENSIONS_RENDERER_API_BINDINGS_SYSTEM_H_ |
OLD | NEW |