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 <string> | 9 #include <string> |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // Creates a completely clean instance. Configure using RegisterSchema() and | 58 // Creates a completely clean instance. Configure using RegisterSchema() and |
59 // RegisterDependencyProvider before use. | 59 // RegisterDependencyProvider before use. |
60 ExtensionAPI(); | 60 ExtensionAPI(); |
61 virtual ~ExtensionAPI(); | 61 virtual ~ExtensionAPI(); |
62 | 62 |
63 void RegisterSchemaResource(const std::string& api_name, int resource_id); | 63 void RegisterSchemaResource(const std::string& api_name, int resource_id); |
64 | 64 |
65 void RegisterDependencyProvider(const std::string& name, | 65 void RegisterDependencyProvider(const std::string& name, |
66 FeatureProvider* provider); | 66 FeatureProvider* provider); |
67 | 67 |
68 // Returns true if the specified API is available. Returns true if the feature | 68 // Returns true if the API feature |api| and all of its dependencies are |
69 // and all of its dependencies are available to the specified context. | 69 // available in |context|. |
| 70 // |
| 71 // Depending on the configuration of |api| (in _api_features.json), either |
| 72 // |extension| or |url| (or both) may determine its availability, but this is |
| 73 // up to the configuration of the individual feature. |
70 Feature::Availability IsAvailable(const Feature& api, | 74 Feature::Availability IsAvailable(const Feature& api, |
71 const Extension* extension, | 75 const Extension* extension, |
72 Feature::Context context, | 76 Feature::Context context, |
73 const GURL& url); | 77 const GURL& url); |
74 // Same as the previous overload, but takes a feature name instead of an | 78 // Same as the previous overload, but takes a feature name instead of an |
75 // object. |api_full_name| can be either a namespace name (like "bookmarks") | 79 // object. |api_full_name| can be either a namespace name (like "bookmarks") |
76 // or a member name (like "bookmarks.create"). | 80 // or a member name (like "bookmarks.create"). |
77 Feature::Availability IsAvailable(const std::string& api_full_name, | 81 Feature::Availability IsAvailable(const std::string& api_full_name, |
78 const Extension* extension, | 82 const Extension* extension, |
79 Feature::Context context, | 83 Feature::Context context, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // FeatureProviders used for resolving dependencies. | 141 // FeatureProviders used for resolving dependencies. |
138 typedef std::map<std::string, FeatureProvider*> FeatureProviderMap; | 142 typedef std::map<std::string, FeatureProvider*> FeatureProviderMap; |
139 FeatureProviderMap dependency_providers_; | 143 FeatureProviderMap dependency_providers_; |
140 | 144 |
141 DISALLOW_COPY_AND_ASSIGN(ExtensionAPI); | 145 DISALLOW_COPY_AND_ASSIGN(ExtensionAPI); |
142 }; | 146 }; |
143 | 147 |
144 } // namespace extensions | 148 } // namespace extensions |
145 | 149 |
146 #endif // EXTENSIONS_COMMON_EXTENSION_API_H_ | 150 #endif // EXTENSIONS_COMMON_EXTENSION_API_H_ |
OLD | NEW |