| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_COMMON_EXTENSION_API_H_ | 5 #ifndef EXTENSIONS_COMMON_EXTENSION_API_H_ |
| 6 #define EXTENSIONS_COMMON_EXTENSION_API_H_ | 6 #define EXTENSIONS_COMMON_EXTENSION_API_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // The |child_name| parameter can be be NULL if you don't need that part. | 121 // The |child_name| parameter can be be NULL if you don't need that part. |
| 122 std::string GetAPINameFromFullName(const std::string& full_name, | 122 std::string GetAPINameFromFullName(const std::string& full_name, |
| 123 std::string* child_name); | 123 std::string* child_name); |
| 124 | 124 |
| 125 // Gets a feature from any dependency provider registered with ExtensionAPI. | 125 // Gets a feature from any dependency provider registered with ExtensionAPI. |
| 126 // Returns NULL if the feature could not be found. | 126 // Returns NULL if the feature could not be found. |
| 127 Feature* GetFeatureDependency(const std::string& dependency_name); | 127 Feature* GetFeatureDependency(const std::string& dependency_name); |
| 128 | 128 |
| 129 private: | 129 private: |
| 130 FRIEND_TEST_ALL_PREFIXES(ExtensionAPITest, DefaultConfigurationFeatures); | 130 FRIEND_TEST_ALL_PREFIXES(ExtensionAPITest, DefaultConfigurationFeatures); |
| 131 FRIEND_TEST_ALL_PREFIXES(ExtensionAPITest, TypesHaveNamespace); | |
| 132 friend struct base::DefaultSingletonTraits<ExtensionAPI>; | 131 friend struct base::DefaultSingletonTraits<ExtensionAPI>; |
| 133 | 132 |
| 134 void InitDefaultConfiguration(); | 133 void InitDefaultConfiguration(); |
| 135 | 134 |
| 136 bool default_configuration_initialized_; | 135 bool default_configuration_initialized_; |
| 137 | 136 |
| 138 // Loads a schema. | 137 // Loads a schema. |
| 139 void LoadSchema(const std::string& name, const base::StringPiece& schema); | 138 void LoadSchema(const std::string& name, const base::StringPiece& schema); |
| 140 | 139 |
| 141 // Map from each API that hasn't been loaded yet to the schema which defines | 140 // Map from each API that hasn't been loaded yet to the schema which defines |
| 142 // it. Note that there may be multiple APIs per schema. | 141 // it. Note that there may be multiple APIs per schema. |
| 143 typedef std::map<std::string, int> UnloadedSchemaMap; | 142 typedef std::map<std::string, int> UnloadedSchemaMap; |
| 144 UnloadedSchemaMap unloaded_schemas_; | 143 UnloadedSchemaMap unloaded_schemas_; |
| 145 | 144 |
| 146 // Schemas for each namespace. | 145 // Schemas for each namespace. |
| 147 using SchemaMap = | 146 using SchemaMap = |
| 148 std::map<std::string, std::unique_ptr<const base::DictionaryValue>>; | 147 std::map<std::string, std::unique_ptr<const base::DictionaryValue>>; |
| 149 SchemaMap schemas_; | 148 SchemaMap schemas_; |
| 150 | 149 |
| 151 // FeatureProviders used for resolving dependencies. | 150 // FeatureProviders used for resolving dependencies. |
| 152 typedef std::map<std::string, const FeatureProvider*> FeatureProviderMap; | 151 typedef std::map<std::string, const FeatureProvider*> FeatureProviderMap; |
| 153 FeatureProviderMap dependency_providers_; | 152 FeatureProviderMap dependency_providers_; |
| 154 | 153 |
| 155 DISALLOW_COPY_AND_ASSIGN(ExtensionAPI); | 154 DISALLOW_COPY_AND_ASSIGN(ExtensionAPI); |
| 156 }; | 155 }; |
| 157 | 156 |
| 158 } // namespace extensions | 157 } // namespace extensions |
| 159 | 158 |
| 160 #endif // EXTENSIONS_COMMON_EXTENSION_API_H_ | 159 #endif // EXTENSIONS_COMMON_EXTENSION_API_H_ |
| OLD | NEW |