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

Side by Side Diff: chrome/browser/extensions/extension_management_internal.h

Issue 671943003: Add update url controlled extension management settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ext-5
Patch Set: fixes addressing #3 Created 6 years, 1 month 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
OLDNEW
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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_INTERNAL_H_ 4 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_INTERNAL_H_
5 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_INTERNAL_H_ 5 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_INTERNAL_H_
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "chrome/browser/extensions/extension_management.h" 11 #include "chrome/browser/extensions/extension_management.h"
12 #include "extensions/common/manifest.h" 12 #include "extensions/common/manifest.h"
13 #include "extensions/common/permissions/api_permission_set.h" 13 #include "extensions/common/permissions/api_permission_set.h"
14 14
15 namespace base { 15 namespace base {
16 class DictionaryValue; 16 class DictionaryValue;
17 } // namespace base 17 } // namespace base
18 18
19 namespace extensions { 19 namespace extensions {
20 20
21 class URLPatternSet; 21 class URLPatternSet;
22 22
23 namespace internal { 23 namespace internal {
24 24
25 // Class to hold extension management settings for one or a group of 25 // Class to hold extension management settings for one or a group of
26 // extensions. Settings can be applied to an individual extension identified 26 // extensions. Settings can be applied to an individual extension identified
27 // by an ID, a group of extensions with specific |update_url| or all 27 // by an ID, a group of extensions with specific |update_url| or all
28 // extensions at once. 28 // extensions at once.
29 // The settings applied to all extensions are the default settings and can be
30 // overridden by per-extension or per-update-url settings.
31 // There are multiple fields in this class. Unspecified fields in per-extension
32 // and per-update-url settings will take value from default settings (or merge
33 // from that, see per-field comments below for details). Unspecified fields in
34 // default extensions will take the default fall back value instead.
35 // Since update URL is not directly associated to extension ID, per-extension
36 // and per-update-url settings might be enforced at the same time, see per-field
37 // comments below for details.
29 struct IndividualSettings { 38 struct IndividualSettings {
30 enum ParsingScope { 39 enum ParsingScope {
31 // Parses the default settings. 40 // Parses the default settings.
32 SCOPE_DEFAULT = 0, 41 SCOPE_DEFAULT = 0,
42 // Parses the settings for extensions with specified update URL in its
43 // manifest.
44 SCOPE_UPDATE_URL,
33 // Parses the settings for an extension with specified extension ID. 45 // Parses the settings for an extension with specified extension ID.
34 SCOPE_INDIVIDUAL, 46 SCOPE_INDIVIDUAL,
35 }; 47 };
36 48
37 IndividualSettings(); 49 IndividualSettings();
38 ~IndividualSettings(); 50 ~IndividualSettings();
39 51
40 void Reset(); 52 void Reset();
41 53
42 // Parses the individual settings. |dict| is the a sub-dictionary in extension 54 // Parses the individual settings. |dict| is a sub-dictionary in extension
43 // management preference and |scope| represents the applicable range of the 55 // management preference and |scope| represents the applicable range of the
44 // settings, a single extension, a group of extensions or default settings. 56 // settings, a single extension, a group of extensions or default settings.
45 // Note that in case of parsing errors, |this| will NOT be left untouched. 57 // Note that in case of parsing errors, |this| will NOT be left untouched.
46 // This method is required to be called in order of ParsingScope, i.e. first 58 // This method is required to be called for SCOPE_DEFAULT first, then
47 // SCOPE_DEFAULT, then SCOPE_INDIVIDUAL. 59 // for SCOPE_INDIVIDUAL and SCOPE_UPDATE_URL.
48 bool Parse(const base::DictionaryValue* dict, ParsingScope scope); 60 bool Parse(const base::DictionaryValue* dict, ParsingScope scope);
49 61
50 // Extension installation mode. Setting this to INSTALLATION_FORCED or 62 // Extension installation mode. Setting this to INSTALLATION_FORCED or
51 // INSTALLATION_RECOMMENDED will enable extension auto-loading (only 63 // INSTALLATION_RECOMMENDED will enable extension auto-loading (only
52 // applicable to single extension), and in this case the |update_url| must 64 // applicable to single extension), and in this case the |update_url| must
53 // be specified, containing the update URL for this extension. 65 // be specified, containing the update URL for this extension.
54 // Note that |update_url| will be ignored for INSTALLATION_ALLOWED and 66 // Note that |update_url| will be ignored for INSTALLATION_ALLOWED and
55 // INSTALLATION_BLOCKED installation mode. 67 // INSTALLATION_BLOCKED installation mode.
56 // These settings will override the default settings, and unspecified 68 // This setting will override the default settings, and unspecified
57 // settings will take value from default settings. 69 // setting will take value from default settings.
70 // In case this setting is specified in both per-extensions and
71 // per-update-url settings, per-extension settings will override
72 // per-update-url settings.
58 ExtensionManagement::InstallationMode installation_mode; 73 ExtensionManagement::InstallationMode installation_mode;
59 std::string update_url; 74 std::string update_url;
60 75
61 // Permissions settings for extensions. These settings won't grant permissions 76 // Permissions block list for extensions. This setting won't grant permissions
62 // to extensions automatically. Instead, these settings will provide a list of 77 // to extensions automatically. Instead, this setting will provide a list of
63 // blocked permissions for each extension. That is, if an extension requires a 78 // blocked permissions for each extension. That is, if an extension requires a
64 // permission which has been blacklisted, this extension will not be allowed 79 // permission which has been blacklisted, this extension will not be allowed
65 // to load. And if it contains a blocked permission as optional requirement, 80 // to load. And if it contains a blocked permission as optional requirement,
66 // it will be allowed to load (of course, with permission granted from user if 81 // it will be allowed to load (of course, with permission granted from user if
67 // necessary), but conflicting permissions will be dropped. These settings 82 // necessary), but conflicting permissions will be dropped. This setting will
68 // will merge from the default settings, and unspecified settings will take 83 // merge from the default settings, and unspecified settings will take value
69 // value from default settings. 84 // from default settings.
85 // In case this setting is specified in both per-extensions and per-update-url
86 // settings, both settings will be enforced.
70 APIPermissionSet blocked_permissions; 87 APIPermissionSet blocked_permissions;
71 88
72 private: 89 private:
73 DISALLOW_ASSIGN(IndividualSettings); 90 DISALLOW_ASSIGN(IndividualSettings);
74 }; 91 };
75 92
76 // Global extension management settings, applicable to all extensions. 93 // Global extension management settings, applicable to all extensions.
77 struct GlobalSettings { 94 struct GlobalSettings {
78 GlobalSettings(); 95 GlobalSettings();
79 ~GlobalSettings(); 96 ~GlobalSettings();
(...skipping 12 matching lines...) Expand all
92 109
93 private: 110 private:
94 DISALLOW_COPY_AND_ASSIGN(GlobalSettings); 111 DISALLOW_COPY_AND_ASSIGN(GlobalSettings);
95 }; 112 };
96 113
97 } // namespace internal 114 } // namespace internal
98 115
99 } // namespace extensions 116 } // namespace extensions
100 117
101 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_INTERNAL_H_ 118 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_INTERNAL_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_management.cc ('k') | chrome/browser/extensions/extension_management_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698