summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-19 08:58:12 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-19 08:58:12 +0000
commit7d8867df6c96bf76c040042a834af04a8ab319bc (patch)
tree3e0914651dc6093502fc65fb89631bd34031528e /chrome/browser/extensions
parent6145198177d58f79e7ed1b44fee883ea074fc5fa (diff)
downloadchromium_src-7d8867df6c96bf76c040042a834af04a8ab319bc.zip
chromium_src-7d8867df6c96bf76c040042a834af04a8ab319bc.tar.gz
chromium_src-7d8867df6c96bf76c040042a834af04a8ab319bc.tar.bz2
Refactor app-related manifest properties so that they don't
include the name 'app'. I think these will be useful for normal extensions, too. Also extract an ExtensionExtent class out of Extension. I think this will be useful for passing by value to the IO thread. Review URL: http://codereview.chromium.org/1025006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42091 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r--chrome/browser/extensions/crx_installer.cc12
-rw-r--r--chrome/browser/extensions/crx_installer.h12
-rw-r--r--chrome/browser/extensions/extensions_service.cc13
-rw-r--r--chrome/browser/extensions/sandboxed_extension_unpacker.cc18
-rw-r--r--chrome/browser/extensions/sandboxed_extension_unpacker.h14
5 files changed, 31 insertions, 38 deletions
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc
index 02bc700..93ec0bb 100644
--- a/chrome/browser/extensions/crx_installer.cc
+++ b/chrome/browser/extensions/crx_installer.cc
@@ -39,7 +39,7 @@ CrxInstaller::CrxInstaller(const FilePath& install_directory,
install_source_(Extension::INTERNAL),
delete_source_(false),
allow_privilege_increase_(false),
- force_app_origin_to_download_url_(false),
+ force_web_origin_to_download_url_(false),
create_app_shortcut_(false),
frontend_(frontend),
client_(client) {
@@ -72,8 +72,8 @@ void CrxInstaller::InstallCrx(const FilePath& source_file) {
g_browser_process->resource_dispatcher_host(),
this));
- if (force_app_origin_to_download_url_ && original_url_.is_valid()) {
- unpacker->set_app_origin_override(original_url_.GetOrigin());
+ if (force_web_origin_to_download_url_ && original_url_.is_valid()) {
+ unpacker->set_web_origin(original_url_.GetOrigin());
}
ChromeThread::PostTask(
@@ -142,7 +142,7 @@ void CrxInstaller::OnUnpackSuccess(const FilePath& temp_dir,
return;
}
- if (client_.get() || extension_->IsApp()) {
+ if (client_.get() || extension_->GetFullLaunchURL().is_valid()) {
Extension::DecodeIcon(extension_.get(), Extension::EXTENSION_ICON_LARGE,
&install_icon_);
}
@@ -177,7 +177,7 @@ void CrxInstaller::ConfirmInstall() {
void CrxInstaller::InstallUIProceed(bool create_app_shortcut) {
if (create_app_shortcut) {
- DCHECK(extension_->IsApp());
+ DCHECK(extension_->GetFullLaunchURL().is_valid());
create_app_shortcut_ = true;
}
@@ -233,7 +233,7 @@ void CrxInstaller::CompleteInstall() {
IDR_EXTENSION_DEFAULT_ICON);
ShellIntegration::ShortcutInfo shortcut_info;
- shortcut_info.url = extension_->app_launch_url();
+ shortcut_info.url = extension_->GetFullLaunchURL();
shortcut_info.extension_id = UTF8ToUTF16(extension_->id());
shortcut_info.title = UTF8ToUTF16(extension_->name());
shortcut_info.description = UTF8ToUTF16(extension_->description());
diff --git a/chrome/browser/extensions/crx_installer.h b/chrome/browser/extensions/crx_installer.h
index 9e4990e..bb109c2 100644
--- a/chrome/browser/extensions/crx_installer.h
+++ b/chrome/browser/extensions/crx_installer.h
@@ -83,11 +83,11 @@ class CrxInstaller
allow_privilege_increase_ = val;
}
- bool force_app_origin_to_download_url() const {
- return force_app_origin_to_download_url_;
+ bool force_web_origin_to_download_url() const {
+ return force_web_origin_to_download_url_;
}
- void set_force_app_origin_to_download_url(bool val) {
- force_app_origin_to_download_url_ = val;
+ void set_force_web_origin_to_download_url(bool val) {
+ force_web_origin_to_download_url_ = val;
}
private:
@@ -153,9 +153,9 @@ class CrxInstaller
// either. Defaults to false.
bool allow_privilege_increase_;
- // If true and the installed extension is an app, the origin of that app will
+ // If true and the installed extension uses web content, the web origin will
// be forced to the origin of |original_url_|. Defaults to false.
- bool force_app_origin_to_download_url_;
+ bool force_web_origin_to_download_url_;
// Whether to create an app shortcut after successful installation. This is
// set based on the user's selection in the UI and can only ever be true for
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index 62432b5..3d72258 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -216,7 +216,7 @@ void ExtensionsService::UpdateExtension(const std::string& id,
NULL)); // no client (silent install)
installer->set_expected_id(id);
installer->set_delete_source(true);
- installer->set_force_app_origin_to_download_url(true);
+ installer->set_force_web_origin_to_download_url(true);
installer->set_original_url(download_url);
installer->InstallCrx(extension_path);
}
@@ -511,7 +511,7 @@ void ExtensionsService::NotifyExtensionLoaded(Extension* extension) {
new ChromeURLRequestContext::ExtensionInfo(
extension->path(),
extension->default_locale(),
- extension->app_extent(),
+ std::vector<URLPattern>(),
extension->api_permissions())));
}
@@ -706,15 +706,6 @@ void ExtensionsService::OnExtensionLoaded(Extension* extension,
// The extension is now loaded, remove its data from unloaded extension map.
unloaded_extension_paths_.erase(extension->id());
- if (extension->IsApp() &&
- !CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableExtensionApps)) {
- ReportExtensionLoadError(extension->path(), errors::kAppsDisabled,
- NotificationType::EXTENSION_INSTALL_ERROR,
- true); // be noisy
- return;
- }
-
// TODO(aa): Need to re-evaluate this branch. Does this still make sense now
// that extensions are enabled by default?
if (extensions_enabled() ||
diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker.cc b/chrome/browser/extensions/sandboxed_extension_unpacker.cc
index 1cbd932..427b864 100644
--- a/chrome/browser/extensions/sandboxed_extension_unpacker.cc
+++ b/chrome/browser/extensions/sandboxed_extension_unpacker.cc
@@ -255,16 +255,18 @@ DictionaryValue* SandboxedExtensionUnpacker::RewriteManifestFile(
static_cast<DictionaryValue*>(manifest.DeepCopy()));
final_manifest->SetString(extension_manifest_keys::kPublicKey, public_key_);
- // Override the app origin if appropriate.
- DictionaryValue* app = NULL;
- if (final_manifest->GetDictionary(extension_manifest_keys::kApp, &app) &&
- !app_origin_override_.is_empty()) {
- if (app->HasKey(extension_manifest_keys::kAppOrigin)) {
- ReportFailure("Unexpected 'origin' key in manifest.");
+ // Override the origin if appropriate.
+ bool web_content_enabled = false;
+ if (final_manifest->GetBoolean(extension_manifest_keys::kWebContentEnabled,
+ &web_content_enabled) &&
+ web_content_enabled &&
+ web_origin_.is_valid()) {
+ if (final_manifest->HasKey(extension_manifest_keys::kWebOrigin)) {
+ ReportFailure("Unexpected 'web_content.origin' key in manifest.");
return NULL;
}
- app->SetString(extension_manifest_keys::kAppOrigin,
- app_origin_override_.spec());
+ final_manifest->SetString(extension_manifest_keys::kWebOrigin,
+ web_origin_.spec());
}
std::string manifest_json;
diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker.h b/chrome/browser/extensions/sandboxed_extension_unpacker.h
index 25d77b6..a3b190c 100644
--- a/chrome/browser/extensions/sandboxed_extension_unpacker.h
+++ b/chrome/browser/extensions/sandboxed_extension_unpacker.h
@@ -96,9 +96,9 @@ class SandboxedExtensionUnpacker : public UtilityProcessHost::Client {
ResourceDispatcherHost* rdh,
SandboxedExtensionUnpackerClient* cilent);
- const GURL& app_origin_override() const { return app_origin_override_; }
- void set_app_origin_override(const GURL& val) {
- app_origin_override_ = val;
+ const GURL& web_origin() const { return web_origin_; }
+ void set_web_origin(const GURL& val) {
+ web_origin_ = val;
}
// Start unpacking the extension. The client is called with the results.
@@ -169,10 +169,10 @@ class SandboxedExtensionUnpacker : public UtilityProcessHost::Client {
// The public key that was extracted from the CRX header.
std::string public_key_;
- // If the unpacked extension is an app, its origin will be forced to this
- // value. This is used when an app is self-hosted. The only valid origin
- // is the origin it is served from.
- GURL app_origin_override_;
+ // If the unpacked extension uses web content, its origin will be set to this
+ // value. This is used when an app is self-hosted. The only valid origin is
+ // the origin it is served from.
+ GURL web_origin_;
};
#endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_EXTENSION_UNPACKER_H_