Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: extensions/common/extensions_client.h

Issue 293943002: Clean up TestFeaturesNativeHandler to use the ExtensionsClient's JSON feature sources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/memory/scoped_ptr.h"
13 #include "base/strings/string_piece.h" 13 #include "base/strings/string_piece.h"
14 14
15 class GURL; 15 class GURL;
16 16
17 namespace extensions { 17 namespace extensions {
18 18
19 class APIPermissionSet; 19 class APIPermissionSet;
20 class Extension; 20 class Extension;
21 class FeatureProvider; 21 class FeatureProvider;
22 class JSONFeatureProviderSource;
22 class ManifestPermissionSet; 23 class ManifestPermissionSet;
23 class PermissionMessage; 24 class PermissionMessage;
24 class PermissionMessageProvider; 25 class PermissionMessageProvider;
25 class PermissionsProvider; 26 class PermissionsProvider;
26 class SimpleFeature; 27 class SimpleFeature;
27 class URLPatternSet; 28 class URLPatternSet;
28 29
29 // Sets up global state for the extensions system. Should be Set() once in each 30 // Sets up global state for the extensions system. Should be Set() once in each
30 // process. This should be implemented by the client of the extensions system. 31 // process. This should be implemented by the client of the extensions system.
31 class ExtensionsClient { 32 class ExtensionsClient {
32 public: 33 public:
33 typedef std::vector<std::string> ScriptingWhitelist; 34 typedef std::vector<std::string> ScriptingWhitelist;
34 35
35 virtual ~ExtensionsClient() {} 36 virtual ~ExtensionsClient() {}
36 37
37 // Initializes global state. Not done in the constructor because unit tests 38 // Initializes global state. Not done in the constructor because unit tests
38 // can create additional ExtensionsClients because the utility thread runs 39 // can create additional ExtensionsClients because the utility thread runs
39 // in-process. 40 // in-process.
40 virtual void Initialize() = 0; 41 virtual void Initialize() = 0;
41 42
42 // Returns the global PermissionMessageProvider to use to provide permission 43 // Returns the global PermissionMessageProvider to use to provide permission
43 // warning strings. 44 // warning strings.
44 virtual const PermissionMessageProvider& GetPermissionMessageProvider() 45 virtual const PermissionMessageProvider& GetPermissionMessageProvider()
45 const = 0; 46 const = 0;
46 47
47 // Create a FeatureProvider for a specific feature type, e.g. "permission". 48 // Create a FeatureProvider for a specific feature type, e.g. "permission".
48 virtual scoped_ptr<FeatureProvider> CreateFeatureProvider( 49 virtual scoped_ptr<FeatureProvider> CreateFeatureProvider(
49 const std::string& name) const = 0; 50 const std::string& name) const = 0;
50 51
52 // Create a JSONFeatureProviderSource for a specific feature type,
53 // e.g. "permission". (There are currently no other sources of features data.)
James Cook 2014/05/20 18:15:47 Doesn't this also work for "api" and "manifest"?
Yoyo Zhou 2014/05/21 01:05:47 This wording is confusing. I'll fix it.
54 // This is used primarily in CreateFeatureProvider, above.
55 virtual scoped_ptr<JSONFeatureProviderSource> CreateFeatureProviderSource(
56 const std::string& name) const = 0;
57
51 // Takes the list of all hosts and filters out those with special 58 // Takes the list of all hosts and filters out those with special
52 // permission strings. Adds the regular hosts to |new_hosts|, 59 // permission strings. Adds the regular hosts to |new_hosts|,
53 // and adds the special permission messages to |messages|. 60 // and adds the special permission messages to |messages|.
54 virtual void FilterHostPermissions( 61 virtual void FilterHostPermissions(
55 const URLPatternSet& hosts, 62 const URLPatternSet& hosts,
56 URLPatternSet* new_hosts, 63 URLPatternSet* new_hosts,
57 std::set<PermissionMessage>* messages) const = 0; 64 std::set<PermissionMessage>* messages) const = 0;
58 65
59 // Replaces the scripting whitelist with |whitelist|. Used in the renderer; 66 // Replaces the scripting whitelist with |whitelist|. Used in the renderer;
60 // only used for testing in the browser process. 67 // only used for testing in the browser process.
(...skipping 24 matching lines...) Expand all
85 // Return the extensions client. 92 // Return the extensions client.
86 static ExtensionsClient* Get(); 93 static ExtensionsClient* Get();
87 94
88 // Initialize the extensions system with this extensions client. 95 // Initialize the extensions system with this extensions client.
89 static void Set(ExtensionsClient* client); 96 static void Set(ExtensionsClient* client);
90 }; 97 };
91 98
92 } // namespace extensions 99 } // namespace extensions
93 100
94 #endif // EXTENSIONS_COMMON_EXTENSIONS_CLIENT_H_ 101 #endif // EXTENSIONS_COMMON_EXTENSIONS_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698