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

Unified Diff: chrome/common/extensions/extension.h

Issue 6766002: Replace bools in extension creation with flags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For landing Created 9 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/extension.h
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index e029c7a02b70112ecc386c12d317b63a38898e0c..6b40f1561319df0f1136fbdcb2c9a60055a0c811 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -114,21 +114,31 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
const int message_id;
};
- // |strict_error_checks| enables extra error checking, such as
- // checks that URL patterns do not contain ports. This error
- // checking may find an error that a previous version of
- // chrome did not flag. To avoid errors in installed extensions
- // when chrome is upgraded, strict error checking is only enabled
- // when loading extensions as a developer would (such as loading
- // an unpacked extension), or when loading an extension that is
- // tied to a specific version of chrome (such as a component
- // extension). Most callers will set |strict_error_checks| to
- // Extension::ShouldDoStrictErrorChecking(location).
+ enum InitFromValueFlags {
+ NO_FLAGS = 0,
+
+ // Usually, the id of an extension is generated by the "key" property of
+ // its manifest, but if |REQUIRE_KEY| is not set, a temporary ID will be
+ // generated based on the path.
+ REQUIRE_KEY = 1 << 0,
+
+ // |STRICT_ERROR_CHECKS| enables extra error checking, such as
+ // checks that URL patterns do not contain ports. This error
+ // checking may find an error that a previous version of
+ // Chrome did not flag. To avoid errors in installed extensions
+ // when Chrome is upgraded, strict error checking is only enabled
+ // when loading extensions as a developer would (such as loading
+ // an unpacked extension), or when loading an extension that is
+ // tied to a specific version of Chrome (such as a component
+ // extension). Most callers will set the |STRICT_ERROR_CHECKS| bit when
+ // Extension::ShouldDoStrictErrorChecking(location) returns true.
+ STRICT_ERROR_CHECKS = 1 << 1,
+ };
+
static scoped_refptr<Extension> Create(const FilePath& path,
Location location,
const DictionaryValue& value,
- bool require_key,
- bool strict_error_checks,
+ int flags,
std::string* error);
// Return the update url used by gallery/webstore extensions.
@@ -539,11 +549,8 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
~Extension();
// Initialize the extension from a parsed manifest.
- // Usually, the id of an extension is generated by the "key" property of
- // its manifest, but if |require_key| is |false|, a temporary ID will be
- // generated based on the path.
- bool InitFromValue(const DictionaryValue& value, bool require_key,
- bool strict_error_checks, std::string* error);
+ bool InitFromValue(const DictionaryValue& value, int flags,
+ std::string* error);
// Helper function for implementing HasCachedImage/GetCachedImage. A return
// value of NULL means there is no matching image cached (we allow caching an

Powered by Google App Engine
This is Rietveld 408576698