diff options
author | yoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-19 19:54:28 +0000 |
---|---|---|
committer | yoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-19 19:54:28 +0000 |
commit | 7576451096ac79de2031a0ce55ab26da195b2f7b (patch) | |
tree | 27ecd3acd667999a976009bb06f6cacc01708391 /chrome/common/extensions | |
parent | c0f298de177a284fd0d8e1517605b75a3d1d4d7d (diff) | |
download | chromium_src-7576451096ac79de2031a0ce55ab26da195b2f7b.zip chromium_src-7576451096ac79de2031a0ce55ab26da195b2f7b.tar.gz chromium_src-7576451096ac79de2031a0ce55ab26da195b2f7b.tar.bz2 |
Make extension installs from sync be from_webstore.
BUG=107783
TEST=enable sync, install extension; check that when synced on another browser, its Preferences entry has from_webstore: true.
Review URL: http://codereview.chromium.org/8965034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115013 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions')
-rw-r--r-- | chrome/common/extensions/extension.cc | 11 | ||||
-rw-r--r-- | chrome/common/extensions/extension_constants.cc | 5 | ||||
-rw-r--r-- | chrome/common/extensions/extension_constants.h | 3 |
3 files changed, 11 insertions, 8 deletions
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index 2bcc581..5c7cab6 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -2879,8 +2879,7 @@ bool Extension::CanCaptureVisiblePage(const GURL& page_url, } bool Extension::UpdatesFromGallery() const { - return update_url() == extension_urls::GetWebstoreUpdateUrl(false) || - update_url() == extension_urls::GetWebstoreUpdateUrl(true); + return extension_urls::IsWebstoreUpdateUrl(update_url()); } bool Extension::OverlapsWithOrigin(const GURL& origin) const { @@ -2914,11 +2913,8 @@ Extension::SyncType Extension::GetSyncType() const { // // TODO(akalin): Relax this restriction once we've put in UI to // approve synced extensions. - if (!update_url().is_empty() && - (update_url() != extension_urls::GetWebstoreUpdateUrl(false)) && - (update_url() != extension_urls::GetWebstoreUpdateUrl(true))) { + if (!update_url().is_empty() && !UpdatesFromGallery()) return SYNC_TYPE_NONE; - } // Disallow extensions with native code plugins. // @@ -2934,8 +2930,7 @@ Extension::SyncType Extension::GetSyncType() const { case Extension::TYPE_USER_SCRIPT: // We only want to sync user scripts with gallery update URLs. - if (update_url() == extension_urls::GetWebstoreUpdateUrl(true) || - update_url() == extension_urls::GetWebstoreUpdateUrl(false)) + if (UpdatesFromGallery()) return SYNC_TYPE_EXTENSION; else return SYNC_TYPE_NONE; diff --git a/chrome/common/extensions/extension_constants.cc b/chrome/common/extensions/extension_constants.cc index 4355f0d..fb1077d 100644 --- a/chrome/common/extensions/extension_constants.cc +++ b/chrome/common/extensions/extension_constants.cc @@ -467,6 +467,11 @@ GURL GetWebstoreUpdateUrl(bool secure) { return GURL(secure ? kGalleryUpdateHttpsUrl : kGalleryUpdateHttpUrl); } +bool IsWebstoreUpdateUrl(const GURL& update_url) { + return update_url == GetWebstoreUpdateUrl(false) || + update_url == GetWebstoreUpdateUrl(true); +} + const char kGalleryBrowsePrefix[] = "https://chrome.google.com/webstore"; } diff --git a/chrome/common/extensions/extension_constants.h b/chrome/common/extensions/extension_constants.h index abb77f0..2342761 100644 --- a/chrome/common/extensions/extension_constants.h +++ b/chrome/common/extensions/extension_constants.h @@ -308,6 +308,9 @@ namespace extension_urls { // --apps-gallery-update-url. GURL GetWebstoreUpdateUrl(bool secure); + // Returns whether the URL is the webstore update URL (secure or not). + bool IsWebstoreUpdateUrl(const GURL& update_url); + // The greatest common prefixes of the main extensions gallery's browse and // download URLs. extern const char kGalleryBrowsePrefix[]; |