OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 13 matching lines...) Expand all Loading... | |
24 | 24 |
25 class GURL; | 25 class GURL; |
26 class PrefService; | 26 class PrefService; |
27 | 27 |
28 namespace content { | 28 namespace content { |
29 class BrowserContext; | 29 class BrowserContext; |
30 } // namespace content | 30 } // namespace content |
31 | 31 |
32 namespace extensions { | 32 namespace extensions { |
33 | 33 |
34 namespace schema_constants { | |
35 | |
36 extern const char kAllOtherExtension[]; | |
37 | |
38 extern const char kInstallationMode[]; | |
39 extern const char kAllowed[]; | |
40 extern const char kBlocked[]; | |
41 extern const char kForceInstalled[]; | |
42 extern const char kNormalInstalled[]; | |
43 | |
44 extern const char kUpdateUrl[]; | |
45 extern const char kInstallSources[]; | |
46 extern const char kAllowedTypes[]; | |
47 | |
48 extern const char kUpdateUrlPrefix[]; | |
49 | |
50 struct AllowedTypesMapType { | |
51 const char* name; | |
52 Manifest::Type manifest_type; | |
Joao da Silva
2014/09/18 12:08:22
Document these 2 fields
binjin
2014/09/18 14:37:27
Done. I also renamed AllowedTypesMapType into Allo
| |
53 }; | |
54 | |
55 extern const AllowedTypesMapType kAllowedTypesMap[]; | |
Joao da Silva
2014/09/18 12:08:22
Add a size constant for this array:
extern const
binjin
2014/09/18 14:37:27
Done.
| |
56 | |
57 } // namespace schema_constants | |
Joao da Silva
2014/09/18 12:08:22
Move these constants to separate files. This class
binjin
2014/09/18 14:37:27
Done.
| |
58 | |
34 // Tracks the management policies that affect extensions and provides interfaces | 59 // Tracks the management policies that affect extensions and provides interfaces |
35 // for observing and obtaining the global settings for all extensions, as well | 60 // for observing and obtaining the global settings for all extensions, as well |
36 // as per-extension settings. | 61 // as per-extension settings. |
37 class ExtensionManagement : public KeyedService { | 62 class ExtensionManagement : public KeyedService { |
38 public: | 63 public: |
39 // Observer class for extension management settings changes. | 64 // Observer class for extension management settings changes. |
40 class Observer { | 65 class Observer { |
41 public: | 66 public: |
42 virtual ~Observer() {} | 67 virtual ~Observer() {} |
43 | 68 |
(...skipping 13 matching lines...) Expand all Loading... | |
57 INSTALLATION_BLOCKED, | 82 INSTALLATION_BLOCKED, |
58 INSTALLATION_FORCED, | 83 INSTALLATION_FORCED, |
59 INSTALLATION_RECOMMENDED, | 84 INSTALLATION_RECOMMENDED, |
60 }; | 85 }; |
61 | 86 |
62 // Class to hold extension management settings for one or a group of | 87 // Class to hold extension management settings for one or a group of |
63 // extensions. Settings can be applied to an individual extension identified | 88 // extensions. Settings can be applied to an individual extension identified |
64 // by an ID, a group of extensions with specific |update_url| or all | 89 // by an ID, a group of extensions with specific |update_url| or all |
65 // extensions at once. | 90 // extensions at once. |
66 struct IndividualSettings { | 91 struct IndividualSettings { |
92 enum Scope { | |
93 SCOPE_DEFAULT = 0, | |
94 SCOPE_BY_UPDATE_URL, | |
Joao da Silva
2014/09/18 12:08:22
This scope is never being used
binjin
2014/09/18 14:37:27
Done.
| |
95 SCOPE_INDIVIDUAL, | |
Joao da Silva
2014/09/18 12:08:22
Document what each value means
binjin
2014/09/18 14:37:27
Done.
| |
96 }; | |
97 | |
67 void Reset(); | 98 void Reset(); |
99 bool Parse(const base::DictionaryValue* dict, Scope scope); | |
Joao da Silva
2014/09/18 12:08:22
These methods don't belong in the interface either
binjin
2014/09/18 14:37:27
Done. I left Reset() though.
| |
68 | 100 |
69 // Extension installation mode. Setting this to INSTALLATION_FORCED or | 101 // Extension installation mode. Setting this to INSTALLATION_FORCED or |
70 // INSTALLATION_RECOMMENDED will enable extension auto-loading (only | 102 // INSTALLATION_RECOMMENDED will enable extension auto-loading (only |
71 // applicable to single extension), and in this case the |update_url| must | 103 // applicable to single extension), and in this case the |update_url| must |
72 // be specified, containing the update URL for this extension. | 104 // be specified, containing the update URL for this extension. |
73 // Note that |update_url| will be ignored for INSTALLATION_ALLOWED and | 105 // Note that |update_url| will be ignored for INSTALLATION_ALLOWED and |
74 // INSTALLATION_BLOCKED installation mode. | 106 // INSTALLATION_BLOCKED installation mode. |
75 InstallationMode installation_mode; | 107 InstallationMode installation_mode; |
76 std::string update_url; | 108 std::string update_url; |
77 }; | 109 }; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
193 content::BrowserContext* context) const OVERRIDE; | 225 content::BrowserContext* context) const OVERRIDE; |
194 virtual content::BrowserContext* GetBrowserContextToUse( | 226 virtual content::BrowserContext* GetBrowserContextToUse( |
195 content::BrowserContext* context) const OVERRIDE; | 227 content::BrowserContext* context) const OVERRIDE; |
196 | 228 |
197 DISALLOW_COPY_AND_ASSIGN(ExtensionManagementFactory); | 229 DISALLOW_COPY_AND_ASSIGN(ExtensionManagementFactory); |
198 }; | 230 }; |
199 | 231 |
200 } // namespace extensions | 232 } // namespace extensions |
201 | 233 |
202 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_H_ | 234 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_H_ |
OLD | NEW |