Index: chrome/common/extensions/extension.h |
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h |
index 146c53458965a863f2be73195dba7e8b83bff816..981eb943da51f3d5c0b33c0c5b0d1a3c89afdd43 100644 |
--- a/chrome/common/extensions/extension.h |
+++ b/chrome/common/extensions/extension.h |
@@ -20,6 +20,7 @@ |
#include "chrome/common/extensions/extension_constants.h" |
#include "chrome/common/extensions/extension_icon_set.h" |
#include "chrome/common/extensions/extension_permission_set.h" |
+#include "chrome/common/extensions/manifest.h" |
#include "chrome/common/extensions/user_script.h" |
#include "chrome/common/extensions/url_pattern.h" |
#include "chrome/common/extensions/url_pattern_set.h" |
@@ -368,7 +369,7 @@ class Extension : public base::RefCountedThreadSafe<Extension> { |
// Parses the host and api permissions from the specified permission |key| |
// in the manifest |source|. |
- bool ParsePermissions(const base::DictionaryValue* source, |
+ bool ParsePermissions(const extensions::Manifest* source, |
const char* key, |
int flags, |
std::string* error, |
@@ -525,8 +526,8 @@ class Extension : public base::RefCountedThreadSafe<Extension> { |
} |
const GURL& update_url() const { return update_url_; } |
const ExtensionIconSet& icons() const { return icons_; } |
- const base::DictionaryValue* manifest_value() const { |
- return manifest_value_.get(); |
+ const extensions::Manifest* manifest() const { |
+ return manifest_.get(); |
} |
const std::string default_locale() const { return default_locale_; } |
const URLOverrideMap& GetChromeURLOverrides() const { |
@@ -551,10 +552,12 @@ class Extension : public base::RefCountedThreadSafe<Extension> { |
} |
// App-related. |
- bool is_app() const { return is_app_; } |
- bool is_platform_app() const { return is_platform_app_; } |
- bool is_hosted_app() const { return is_app() && !web_extent().is_empty(); } |
- bool is_packaged_app() const { return is_app() && web_extent().is_empty(); } |
+ bool is_app() const { |
+ return is_packaged_app() || is_hosted_app() || is_platform_app(); |
+ } |
+ bool is_platform_app() const { return manifest()->IsPlatformApp(); } |
+ bool is_hosted_app() const { return manifest()->IsHostedApp(); } |
+ bool is_packaged_app() const { return manifest()->IsPackagedApp(); } |
bool is_storage_isolated() const { return is_app() && is_storage_isolated_; } |
const URLPatternSet& web_extent() const { return extent_; } |
const std::string& launch_local_path() const { return launch_local_path_; } |
@@ -566,7 +569,7 @@ class Extension : public base::RefCountedThreadSafe<Extension> { |
int launch_height() const { return launch_height_; } |
// Theme-related. |
- bool is_theme() const { return is_theme_; } |
+ bool is_theme() const { return manifest()->IsTheme(); } |
base::DictionaryValue* GetThemeImages() const { return theme_images_.get(); } |
base::DictionaryValue* GetThemeColors() const {return theme_colors_.get(); } |
base::DictionaryValue* GetThemeTints() const { return theme_tints_.get(); } |
@@ -608,7 +611,8 @@ class Extension : public base::RefCountedThreadSafe<Extension> { |
~Extension(); |
// Initialize the extension from a parsed manifest. |
- bool InitFromValue(const base::DictionaryValue& value, int flags, |
+ // Takes ownership of the manifest |value|. |
+ bool InitFromValue(extensions::Manifest* value, int flags, |
std::string* error); |
// Helper function for implementing HasCachedImage/GetCachedImage. A return |
@@ -635,24 +639,21 @@ class Extension : public base::RefCountedThreadSafe<Extension> { |
UserScript *instance); |
// Helpers to load various chunks of the manifest. |
- bool LoadIsApp(const base::DictionaryValue* manifest, std::string* error); |
- bool LoadExtent(const base::DictionaryValue* manifest, |
+ bool LoadExtent(const extensions::Manifest* manifest, |
const char* key, |
URLPatternSet* extent, |
const char* list_error, |
const char* value_error, |
URLPattern::ParseOption parse_strictness, |
std::string* error); |
- bool LoadLaunchContainer(const base::DictionaryValue* manifest, |
+ bool LoadLaunchContainer(const extensions::Manifest* manifest, |
std::string* error); |
- bool LoadLaunchURL(const base::DictionaryValue* manifest, |
+ bool LoadLaunchURL(const extensions::Manifest* manifest, |
std::string* error); |
- bool LoadAppIsolation(const base::DictionaryValue* manifest, |
+ bool LoadAppIsolation(const extensions::Manifest* manifest, |
std::string* error); |
- bool LoadWebIntentServices(const base::DictionaryValue& manifest, |
+ bool LoadWebIntentServices(const extensions::Manifest* manifest, |
std::string* error); |
- bool EnsureNotHybridApp(const base::DictionaryValue* manifest, |
- std::string* error); |
// Helper method to load an ExtensionAction from the page_action or |
// browser_action entries in the manifest. |
@@ -675,10 +676,6 @@ class Extension : public base::RefCountedThreadSafe<Extension> { |
// an extension that has a browser action and a page action. |
bool HasMultipleUISurfaces() const; |
- // Figures out if a source contains keys not associated with themes - we |
- // don't want to allow scripts and such to be bundled with themes. |
- bool ContainsNonThemeKeys(const base::DictionaryValue& source) const; |
- |
// Updates the launch URL and extents for the extension using the given |
// |override_url|. |
void OverrideLaunchUrl(const GURL& override_url); |
@@ -814,9 +811,6 @@ class Extension : public base::RefCountedThreadSafe<Extension> { |
// A map of display properties. |
scoped_ptr<base::DictionaryValue> theme_display_properties_; |
- // Whether the extension is a theme. |
- bool is_theme_; |
- |
// The homepage for this extension. Useful if it is not hosted by Google and |
// therefore does not have a Gallery URL. |
GURL homepage_url_; |
@@ -824,19 +818,13 @@ class Extension : public base::RefCountedThreadSafe<Extension> { |
// URL for fetching an update manifest |
GURL update_url_; |
- // A copy of the manifest that this extension was created from. |
- scoped_ptr<base::DictionaryValue> manifest_value_; |
+ // The manifest that this extension was created from. |
+ scoped_ptr<extensions::Manifest> manifest_; |
// A map of chrome:// hostnames (newtab, downloads, etc.) to Extension URLs |
// which override the handling of those URLs. (see ExtensionOverrideUI). |
URLOverrideMap chrome_url_overrides_; |
- // Whether this extension uses app features. |
- bool is_app_; |
- |
- // Whether this app uses platform features. |
- bool is_platform_app_; |
- |
// Whether this extension requests isolated storage. |
bool is_storage_isolated_; |