summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-04 07:06:38 +0000
committeryoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-04 07:06:38 +0000
commit4a5fe3e214681129ec12208e92f33a0fd3be2037 (patch)
treef4767a1a68b5524ddfddbc7ce6ee31b8b2d36345
parent2b26c2fb712cf1f1094e20730863b8be73bfc116 (diff)
downloadchromium_src-4a5fe3e214681129ec12208e92f33a0fd3be2037.zip
chromium_src-4a5fe3e214681129ec12208e92f33a0fd3be2037.tar.gz
chromium_src-4a5fe3e214681129ec12208e92f33a0fd3be2037.tar.bz2
Move Extension::UpdatesFromGallery to ManifestURL.
BUG=162530 TBR=jhawkins@chromium.org Review URL: https://chromiumcodereview.appspot.com/16283002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203886 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/crx_installer.cc3
-rw-r--r--chrome/browser/extensions/extension_service.cc2
-rw-r--r--chrome/browser/extensions/external_install_ui.cc3
-rw-r--r--chrome/browser/extensions/updater/extension_downloader.cc2
-rw-r--r--chrome/browser/ui/webui/extensions/extension_settings_handler.cc2
-rw-r--r--chrome/common/extensions/extension.cc9
-rw-r--r--chrome/common/extensions/extension.h4
-rw-r--r--chrome/common/extensions/manifest_url_handler.cc7
-rw-r--r--chrome/common/extensions/manifest_url_handler.h3
9 files changed, 19 insertions, 16 deletions
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc
index b3cf07f..f763e99 100644
--- a/chrome/browser/extensions/crx_installer.cc
+++ b/chrome/browser/extensions/crx_installer.cc
@@ -41,6 +41,7 @@
#include "chrome/common/extensions/manifest.h"
#include "chrome/common/extensions/manifest_handlers/icons_handler.h"
#include "chrome/common/extensions/manifest_handlers/shared_module_info.h"
+#include "chrome/common/extensions/manifest_url_handler.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/resource_dispatcher_host.h"
@@ -309,7 +310,7 @@ CrxInstallerError CrxInstaller::AllowInstall(const Extension* extension) {
// For apps with a gallery update URL, require that they be installed
// from the gallery.
// TODO(erikkay) Apply this rule for paid extensions and themes as well.
- if (extension->UpdatesFromGallery()) {
+ if (ManifestURL::UpdatesFromGallery(extension)) {
return CrxInstallerError(
l10n_util::GetStringFUTF16(
IDS_EXTENSION_DISALLOW_NON_DOWNLOADED_GALLERY_INSTALLS,
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 0288d5d..93c9492 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -642,7 +642,7 @@ bool ExtensionService::UpdateExtension(const std::string& id,
// which are newer.
int creation_flags = Extension::NO_FLAGS;
if ((extension && extension->from_webstore()) ||
- (extension && extension->UpdatesFromGallery()) ||
+ (extension && extensions::ManifestURL::UpdatesFromGallery(extension)) ||
(!extension && extension_urls::IsWebstoreUpdateUrl(
pending_extension_info->update_url()))) {
creation_flags |= Extension::FROM_WEBSTORE;
diff --git a/chrome/browser/extensions/external_install_ui.cc b/chrome/browser/extensions/external_install_ui.cc
index 97ba32bc..fd20b7a 100644
--- a/chrome/browser/extensions/external_install_ui.cc
+++ b/chrome/browser/extensions/external_install_ui.cc
@@ -28,6 +28,7 @@
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_constants.h"
+#include "chrome/common/extensions/manifest_url_handler.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -46,7 +47,7 @@ namespace {
// Whether the external extension can use the streamlined bubble install flow.
bool UseBubbleInstall(const Extension* extension, bool is_new_profile) {
- return extension->UpdatesFromGallery() && !is_new_profile;
+ return ManifestURL::UpdatesFromGallery(extension) && !is_new_profile;
}
} // namespace
diff --git a/chrome/browser/extensions/updater/extension_downloader.cc b/chrome/browser/extensions/updater/extension_downloader.cc
index addacd6..4cc871c 100644
--- a/chrome/browser/extensions/updater/extension_downloader.cc
+++ b/chrome/browser/extensions/updater/extension_downloader.cc
@@ -197,7 +197,7 @@ bool ExtensionDownloader::AddExtension(const Extension& extension,
// data. At the moment there is no extra data that an extension can
// communicate to the the gallery update servers.
std::string update_url_data;
- if (!extension.UpdatesFromGallery())
+ if (!ManifestURL::UpdatesFromGallery(&extension))
update_url_data = delegate_->GetUpdateUrlData(extension.id());
return AddExtensionData(extension.id(), *extension.version(),
diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
index 75752a9..a0dda4f 100644
--- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
+++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
@@ -170,7 +170,7 @@ DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue(
string16 location_text;
if (extension->location() == Manifest::INTERNAL &&
- !extension->UpdatesFromGallery()) {
+ !extensions::ManifestURL::UpdatesFromGallery(extension)) {
location_text = l10n_util::GetStringUTF16(
IDS_OPTIONS_INSTALL_LOCATION_UNKNOWN);
} else if (extension->location() == Manifest::EXTERNAL_REGISTRY) {
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 720d8cf..c9197c2 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -424,10 +424,6 @@ GURL Extension::GetFullLaunchURL() const {
url().Resolve(launch_local_path());
}
-bool Extension::UpdatesFromGallery() const {
- return extension_urls::IsWebstoreUpdateUrl(ManifestURL::GetUpdateURL(this));
-}
-
bool Extension::OverlapsWithOrigin(const GURL& origin) const {
if (url() == origin)
return true;
@@ -458,7 +454,8 @@ Extension::SyncType Extension::GetSyncType() const {
//
// TODO(akalin): Relax this restriction once we've put in UI to
// approve synced extensions.
- if (!ManifestURL::GetUpdateURL(this).is_empty() && !UpdatesFromGallery())
+ if (!ManifestURL::GetUpdateURL(this).is_empty() &&
+ !ManifestURL::UpdatesFromGallery(this))
return SYNC_TYPE_NONE;
// Disallow extensions with native code plugins.
@@ -474,7 +471,7 @@ Extension::SyncType Extension::GetSyncType() const {
case Manifest::TYPE_USER_SCRIPT:
// We only want to sync user scripts with gallery update URLs.
- if (UpdatesFromGallery())
+ if (ManifestURL::UpdatesFromGallery(this))
return SYNC_TYPE_EXTENSION;
else
return SYNC_TYPE_NONE;
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index cf1f67c..2f7506c 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -253,10 +253,6 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
// Gets the fully resolved absolute launch URL.
GURL GetFullLaunchURL() const;
- // Returns true if this extension updates itself using the extension
- // gallery.
- bool UpdatesFromGallery() const;
-
// Returns true if this extension or app includes areas within |origin|.
bool OverlapsWithOrigin(const GURL& origin) const;
diff --git a/chrome/common/extensions/manifest_url_handler.cc b/chrome/common/extensions/manifest_url_handler.cc
index 1d15f40..04afe9c 100644
--- a/chrome/common/extensions/manifest_url_handler.cc
+++ b/chrome/common/extensions/manifest_url_handler.cc
@@ -55,7 +55,7 @@ const GURL ManifestURL::GetHomepageURL(const Extension* extension) {
const GURL& homepage_url = GetManifestURL(extension, keys::kHomepageURL);
if (homepage_url.is_valid())
return homepage_url;
- return extension->UpdatesFromGallery() ?
+ return UpdatesFromGallery(extension) ?
GURL(extension_urls::GetWebstoreItemDetailURLPrefix() + extension->id()) :
GURL::EmptyGURL();
}
@@ -66,6 +66,11 @@ const GURL& ManifestURL::GetUpdateURL(const Extension* extension) {
}
// static
+bool ManifestURL::UpdatesFromGallery(const Extension* extension) {
+ return extension_urls::IsWebstoreUpdateUrl(GetUpdateURL(extension));
+}
+
+// static
const GURL& ManifestURL::GetOptionsPage(const Extension* extension) {
return GetManifestURL(extension, keys::kOptionsPage);
}
diff --git a/chrome/common/extensions/manifest_url_handler.h b/chrome/common/extensions/manifest_url_handler.h
index 3802294..500dce1 100644
--- a/chrome/common/extensions/manifest_url_handler.h
+++ b/chrome/common/extensions/manifest_url_handler.h
@@ -29,6 +29,9 @@ struct ManifestURL : public Extension::ManifestData {
// Returns the Update URL for this extension.
static const GURL& GetUpdateURL(const Extension* extension);
+ // Returns true if this extension's update URL is the extension gallery.
+ static bool UpdatesFromGallery(const Extension* extension);
+
// Returns the Options Page for this extension.
static const GURL& GetOptionsPage(const Extension* extension);