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

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

Issue 24365004: Add EXTERNAL_POLICY to list of possible extension locations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments addressed. Created 7 years, 2 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
« no previous file with comments | « chrome/common/extensions/extension_unittest.cc ('k') | extensions/common/manifest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_MANIFEST_H_ 5 #ifndef EXTENSIONS_COMMON_MANIFEST_H_
6 #define EXTENSIONS_COMMON_MANIFEST_H_ 6 #define EXTENSIONS_COMMON_MANIFEST_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 22 matching lines...) Expand all
33 UNPACKED, // From loading an unpacked extension from the 33 UNPACKED, // From loading an unpacked extension from the
34 // extensions settings page. 34 // extensions settings page.
35 COMPONENT, // An integral component of Chrome itself, which 35 COMPONENT, // An integral component of Chrome itself, which
36 // happens to be implemented as an extension. We don't 36 // happens to be implemented as an extension. We don't
37 // show these in the management UI. 37 // show these in the management UI.
38 EXTERNAL_PREF_DOWNLOAD, // A crx file from an external directory (via 38 EXTERNAL_PREF_DOWNLOAD, // A crx file from an external directory (via
39 // prefs), installed from an update URL. 39 // prefs), installed from an update URL.
40 EXTERNAL_POLICY_DOWNLOAD, // A crx file from an external directory (via 40 EXTERNAL_POLICY_DOWNLOAD, // A crx file from an external directory (via
41 // admin policies), installed from an update URL. 41 // admin policies), installed from an update URL.
42 COMMAND_LINE, // --load-extension. 42 COMMAND_LINE, // --load-extension.
43 EXTERNAL_POLICY, // A crx file from an external directory (via admin
44 // policies), cached locally and installed from the
45 // cache.
43 46
44 NUM_LOCATIONS 47 NUM_LOCATIONS
45 }; 48 };
46 49
47 // Do not change the order of entries or remove entries in this list 50 // Do not change the order of entries or remove entries in this list
48 // as this is used in UMA_HISTOGRAM_ENUMERATIONs about extensions. 51 // as this is used in UMA_HISTOGRAM_ENUMERATIONs about extensions.
49 enum Type { 52 enum Type {
50 TYPE_UNKNOWN = 0, 53 TYPE_UNKNOWN = 0,
51 TYPE_EXTENSION, 54 TYPE_EXTENSION,
52 TYPE_THEME, 55 TYPE_THEME,
53 TYPE_USER_SCRIPT, 56 TYPE_USER_SCRIPT,
54 TYPE_HOSTED_APP, 57 TYPE_HOSTED_APP,
55 // This is marked legacy because platform apps are preferred. For 58 // This is marked legacy because platform apps are preferred. For
56 // backwards compatibility, we can't remove support for packaged apps 59 // backwards compatibility, we can't remove support for packaged apps
57 TYPE_LEGACY_PACKAGED_APP, 60 TYPE_LEGACY_PACKAGED_APP,
58 TYPE_PLATFORM_APP, 61 TYPE_PLATFORM_APP,
59 TYPE_SHARED_MODULE 62 TYPE_SHARED_MODULE
60 }; 63 };
61 64
62 // Given two install sources, return the one which should take priority 65 // Given two install sources, return the one which should take priority
63 // over the other. If an extension is installed from two sources A and B, 66 // over the other. If an extension is installed from two sources A and B,
64 // its install source should be set to GetHigherPriorityLocation(A, B). 67 // its install source should be set to GetHigherPriorityLocation(A, B).
65 static Location GetHigherPriorityLocation(Location loc1, Location loc2); 68 static Location GetHigherPriorityLocation(Location loc1, Location loc2);
66 69
67 // Whether the |location| is external or not. 70 // Whether the |location| is external or not.
68 static inline bool IsExternalLocation(Location location) { 71 static inline bool IsExternalLocation(Location location) {
69 return location == EXTERNAL_PREF || 72 return location == EXTERNAL_PREF ||
70 location == EXTERNAL_REGISTRY || 73 location == EXTERNAL_REGISTRY ||
71 location == EXTERNAL_PREF_DOWNLOAD || 74 location == EXTERNAL_PREF_DOWNLOAD ||
75 location == EXTERNAL_POLICY ||
72 location == EXTERNAL_POLICY_DOWNLOAD; 76 location == EXTERNAL_POLICY_DOWNLOAD;
73 } 77 }
74 78
75 // Whether the |location| is unpacked (no CRX) or not. 79 // Whether the |location| is unpacked (no CRX) or not.
76 static inline bool IsUnpackedLocation(Location location) { 80 static inline bool IsUnpackedLocation(Location location) {
77 return location == UNPACKED || location == COMMAND_LINE; 81 return location == UNPACKED || location == COMMAND_LINE;
78 } 82 }
79 83
80 // Whether extensions with |location| are auto-updatable or not. 84 // Whether extensions with |location| are auto-updatable or not.
81 static inline bool IsAutoUpdateableLocation(Location location) { 85 static inline bool IsAutoUpdateableLocation(Location location) {
82 // Only internal and external extensions can be autoupdated. 86 // Only internal and external extensions can be autoupdated.
83 return location == INTERNAL || 87 return location == INTERNAL ||
84 IsExternalLocation(location); 88 IsExternalLocation(location);
85 } 89 }
86 90
91 // Whether the |location| is a source of extensions force-installed through
92 // policy.
93 static inline bool IsPolicyLocation(Location location) {
94 return location == EXTERNAL_POLICY || location == EXTERNAL_POLICY_DOWNLOAD;
95 }
96
87 // Unpacked extensions start off with file access since they are a developer 97 // Unpacked extensions start off with file access since they are a developer
88 // feature. 98 // feature.
89 static inline bool ShouldAlwaysAllowFileAccess(Location location) { 99 static inline bool ShouldAlwaysAllowFileAccess(Location location) {
90 return IsUnpackedLocation(location); 100 return IsUnpackedLocation(location);
91 } 101 }
92 102
93 Manifest(Location location, scoped_ptr<base::DictionaryValue> value); 103 Manifest(Location location, scoped_ptr<base::DictionaryValue> value);
94 virtual ~Manifest(); 104 virtual ~Manifest();
95 105
96 const std::string& extension_id() const { return extension_id_; } 106 const std::string& extension_id() const { return extension_id_; }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 scoped_ptr<base::DictionaryValue> value_; 178 scoped_ptr<base::DictionaryValue> value_;
169 179
170 Type type_; 180 Type type_;
171 181
172 DISALLOW_COPY_AND_ASSIGN(Manifest); 182 DISALLOW_COPY_AND_ASSIGN(Manifest);
173 }; 183 };
174 184
175 } // namespace extensions 185 } // namespace extensions
176 186
177 #endif // EXTENSIONS_COMMON_MANIFEST_H_ 187 #endif // EXTENSIONS_COMMON_MANIFEST_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_unittest.cc ('k') | extensions/common/manifest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698