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 #include <vector> | 10 #include <vector> |
11 | 11 |
| 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/strings/string_piece.h" | 13 #include "base/strings/string_piece.h" |
13 | 14 |
14 class GURL; | 15 class GURL; |
15 | 16 |
16 namespace extensions { | 17 namespace extensions { |
17 | 18 |
18 class APIPermissionSet; | 19 class APIPermissionSet; |
19 class Extension; | 20 class Extension; |
20 class FeatureProvider; | 21 class FeatureProvider; |
21 class ManifestPermissionSet; | 22 class ManifestPermissionSet; |
(...skipping 17 matching lines...) Expand all Loading... |
39 virtual void Initialize() = 0; | 40 virtual void Initialize() = 0; |
40 | 41 |
41 // Returns a PermissionsProvider to initialize the permissions system. | 42 // Returns a PermissionsProvider to initialize the permissions system. |
42 virtual const PermissionsProvider& GetPermissionsProvider() const = 0; | 43 virtual const PermissionsProvider& GetPermissionsProvider() const = 0; |
43 | 44 |
44 // Returns the global PermissionMessageProvider to use to provide permission | 45 // Returns the global PermissionMessageProvider to use to provide permission |
45 // warning strings. | 46 // warning strings. |
46 virtual const PermissionMessageProvider& GetPermissionMessageProvider() | 47 virtual const PermissionMessageProvider& GetPermissionMessageProvider() |
47 const = 0; | 48 const = 0; |
48 | 49 |
49 // Gets a feature provider for a specific feature type. | 50 // Create a FeatureProvider for a specific feature type, e.g. "permission". |
50 virtual FeatureProvider* GetFeatureProviderByName(const std::string& name) | 51 virtual scoped_ptr<FeatureProvider> CreateFeatureProvider( |
51 const = 0; | 52 const std::string& name) const = 0; |
52 | 53 |
53 // Takes the list of all hosts and filters out those with special | 54 // Takes the list of all hosts and filters out those with special |
54 // permission strings. Adds the regular hosts to |new_hosts|, | 55 // permission strings. Adds the regular hosts to |new_hosts|, |
55 // and adds the special permission messages to |messages|. | 56 // and adds the special permission messages to |messages|. |
56 virtual void FilterHostPermissions( | 57 virtual void FilterHostPermissions( |
57 const URLPatternSet& hosts, | 58 const URLPatternSet& hosts, |
58 URLPatternSet* new_hosts, | 59 URLPatternSet* new_hosts, |
59 std::set<PermissionMessage>* messages) const = 0; | 60 std::set<PermissionMessage>* messages) const = 0; |
60 | 61 |
61 // Replaces the scripting whitelist with |whitelist|. Used in the renderer; | 62 // Replaces the scripting whitelist with |whitelist|. Used in the renderer; |
(...skipping 11 matching lines...) Expand all Loading... |
73 | 74 |
74 // Returns false if content scripts are forbidden from running on |url|. | 75 // Returns false if content scripts are forbidden from running on |url|. |
75 virtual bool IsScriptableURL(const GURL& url, std::string* error) const = 0; | 76 virtual bool IsScriptableURL(const GURL& url, std::string* error) const = 0; |
76 | 77 |
77 // Returns true iff a schema named |name| is generated. | 78 // Returns true iff a schema named |name| is generated. |
78 virtual bool IsAPISchemaGenerated(const std::string& name) const = 0; | 79 virtual bool IsAPISchemaGenerated(const std::string& name) const = 0; |
79 | 80 |
80 // Gets the API schema named |name|. | 81 // Gets the API schema named |name|. |
81 virtual base::StringPiece GetAPISchema(const std::string& name) const = 0; | 82 virtual base::StringPiece GetAPISchema(const std::string& name) const = 0; |
82 | 83 |
83 // Appends extra filters to any Features created by the features system. | |
84 virtual void AddExtraFeatureFilters(SimpleFeature* feature) const = 0; | |
85 | |
86 // Determines if certain fatal extensions errors should be surpressed | 84 // Determines if certain fatal extensions errors should be surpressed |
87 // (i.e., only logged) or allowed (i.e., logged before crashing). | 85 // (i.e., only logged) or allowed (i.e., logged before crashing). |
88 virtual bool ShouldSuppressFatalErrors() const = 0; | 86 virtual bool ShouldSuppressFatalErrors() const = 0; |
89 | 87 |
90 // Return the extensions client. | 88 // Return the extensions client. |
91 static ExtensionsClient* Get(); | 89 static ExtensionsClient* Get(); |
92 | 90 |
93 // Initialize the extensions system with this extensions client. | 91 // Initialize the extensions system with this extensions client. |
94 static void Set(ExtensionsClient* client); | 92 static void Set(ExtensionsClient* client); |
95 }; | 93 }; |
96 | 94 |
97 } // namespace extensions | 95 } // namespace extensions |
98 | 96 |
99 #endif // EXTENSIONS_COMMON_EXTENSIONS_CLIENT_H_ | 97 #endif // EXTENSIONS_COMMON_EXTENSIONS_CLIENT_H_ |
OLD | NEW |