| 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_EXTENSIONS_CLIENT_H_ | 5 #ifndef EXTENSIONS_COMMON_EXTENSIONS_CLIENT_H_ |
| 6 #define EXTENSIONS_COMMON_EXTENSIONS_CLIENT_H_ | 6 #define EXTENSIONS_COMMON_EXTENSIONS_CLIENT_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 namespace extensions { | 11 namespace extensions { |
| 12 | 12 |
| 13 class FeatureProvider; | 13 class FeatureProvider; |
| 14 class PermissionMessage; | 14 class PermissionMessage; |
| 15 class PermissionsProvider; | 15 class PermissionsProvider; |
| 16 class URLPatternSet; | 16 class URLPatternSet; |
| 17 | 17 |
| 18 // Sets up global state for the extensions system. Should be Set() once in each | 18 // Sets up global state for the extensions system. Should be Set() once in each |
| 19 // process. This should be implemented by the client of the extensions system. | 19 // process. This should be implemented by the client of the extensions system. |
| 20 class ExtensionsClient { | 20 class ExtensionsClient { |
| 21 public: | 21 public: |
| 22 // Initializes global state. Not done in the constructor because unit tests |
| 23 // can create additional ExtensionsClients because the utility thread runs |
| 24 // in-process. |
| 25 virtual void Initialize() = 0; |
| 26 |
| 22 // Returns a PermissionsProvider to initialize the permissions system. | 27 // Returns a PermissionsProvider to initialize the permissions system. |
| 23 virtual const PermissionsProvider& GetPermissionsProvider() const = 0; | 28 virtual const PermissionsProvider& GetPermissionsProvider() const = 0; |
| 24 | 29 |
| 25 // Gets a feature provider for a specific feature type. | 30 // Gets a feature provider for a specific feature type. |
| 26 virtual FeatureProvider* GetFeatureProviderByName(const std::string& name) | 31 virtual FeatureProvider* GetFeatureProviderByName(const std::string& name) |
| 27 const = 0; | 32 const = 0; |
| 28 | 33 |
| 29 // Called at startup. Registers the handlers for parsing manifests. | |
| 30 virtual void RegisterManifestHandlers() const = 0; | |
| 31 | |
| 32 // Takes the list of all hosts and filters out those with special | 34 // Takes the list of all hosts and filters out those with special |
| 33 // permission strings. Adds the regular hosts to |new_hosts|, | 35 // permission strings. Adds the regular hosts to |new_hosts|, |
| 34 // and adds the special permission messages to |messages|. | 36 // and adds the special permission messages to |messages|. |
| 35 virtual void FilterHostPermissions( | 37 virtual void FilterHostPermissions( |
| 36 const URLPatternSet& hosts, | 38 const URLPatternSet& hosts, |
| 37 URLPatternSet* new_hosts, | 39 URLPatternSet* new_hosts, |
| 38 std::set<PermissionMessage>* messages) const = 0; | 40 std::set<PermissionMessage>* messages) const = 0; |
| 39 | 41 |
| 40 // Return the extensions client. | 42 // Return the extensions client. |
| 41 static ExtensionsClient* Get(); | 43 static ExtensionsClient* Get(); |
| 42 | 44 |
| 43 // Initialize the extensions system with this extensions client. | 45 // Initialize the extensions system with this extensions client. |
| 44 static void Set(ExtensionsClient* client); | 46 static void Set(ExtensionsClient* client); |
| 45 }; | 47 }; |
| 46 | 48 |
| 47 } // namespace extensions | 49 } // namespace extensions |
| 48 | 50 |
| 49 #endif // EXTENSIONS_COMMON_EXTENSIONS_CLIENT_H_ | 51 #endif // EXTENSIONS_COMMON_EXTENSIONS_CLIENT_H_ |
| OLD | NEW |