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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 // The root name of the API, e.g. "tabs" for chrome.tabs. | 89 // The root name of the API, e.g. "tabs" for chrome.tabs. |
90 std::string api_name_; | 90 std::string api_name_; |
91 | 91 |
92 // A map from method name to expected signature. | 92 // A map from method name to expected signature. |
93 std::map<std::string, std::unique_ptr<APISignature>> signatures_; | 93 std::map<std::string, std::unique_ptr<APISignature>> signatures_; |
94 | 94 |
95 // The names of all events associated with this API. | 95 // The names of all events associated with this API. |
96 std::vector<std::string> event_names_; | 96 std::vector<std::string> event_names_; |
97 | 97 |
| 98 // The pair for enum entry is <original, js-ified>. JS enum entries use |
| 99 // SCREAMING_STYLE (whereas our API enums are just inconsistent). |
| 100 using EnumEntry = std::pair<std::string, std::string>; |
| 101 // A map of <name, values> for the enums on this API. |
| 102 std::map<std::string, std::vector<EnumEntry>> enums_; |
| 103 |
98 // The callback to use when an API is invoked with valid arguments. | 104 // The callback to use when an API is invoked with valid arguments. |
99 APIMethodCallback method_callback_; | 105 APIMethodCallback method_callback_; |
100 | 106 |
101 // The registered hooks for this API. | 107 // The registered hooks for this API. |
102 std::unique_ptr<APIBindingHooks> binding_hooks_; | 108 std::unique_ptr<APIBindingHooks> binding_hooks_; |
103 | 109 |
104 // The reference map for all known types; required to outlive this object. | 110 // The reference map for all known types; required to outlive this object. |
105 const ArgumentSpec::RefMap* type_refs_; | 111 const ArgumentSpec::RefMap* type_refs_; |
106 | 112 |
107 base::WeakPtrFactory<APIBinding> weak_factory_; | 113 base::WeakPtrFactory<APIBinding> weak_factory_; |
108 | 114 |
109 DISALLOW_COPY_AND_ASSIGN(APIBinding); | 115 DISALLOW_COPY_AND_ASSIGN(APIBinding); |
110 }; | 116 }; |
111 | 117 |
112 } // namespace extensions | 118 } // namespace extensions |
113 | 119 |
114 #endif // EXTENSIONS_RENDERER_API_BINDING_H_ | 120 #endif // EXTENSIONS_RENDERER_API_BINDING_H_ |
OLD | NEW |