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