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

Unified Diff: chrome/browser/extensions/extension_system_impl.cc

Issue 288273004: A bunch of remaining parts of extension content verification (Reland) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix browser test Created 6 years, 7 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
« no previous file with comments | « no previous file | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_system_impl.cc
diff --git a/chrome/browser/extensions/extension_system_impl.cc b/chrome/browser/extensions/extension_system_impl.cc
index dab00948c4b3f9a7fda1d3412e252cc6f975b17f..3e8d350178ac46ec4014ae17593afdbbc22272f6 100644
--- a/chrome/browser/extensions/extension_system_impl.cc
+++ b/chrome/browser/extensions/extension_system_impl.cc
@@ -26,12 +26,14 @@
#include "chrome/browser/extensions/standard_management_policy_provider.h"
#include "chrome/browser/extensions/state_store.h"
#include "chrome/browser/extensions/unpacked_installer.h"
+#include "chrome/browser/extensions/updater/manifest_fetch_data.h"
#include "chrome/browser/extensions/user_script_master.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
+#include "chrome/common/extensions/extension_file_util.h"
#include "chrome/common/extensions/features/feature_channel.h"
#include "chrome/common/extensions/manifest_url_handler.h"
#include "content/public/browser/browser_thread.h"
@@ -53,6 +55,7 @@
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest.h"
+#include "net/base/escape.h"
#if defined(ENABLE_NOTIFICATIONS)
#include "chrome/browser/notifications/desktop_notification_service.h"
@@ -151,9 +154,21 @@ class ContentVerifierDelegateImpl : public ContentVerifierDelegate {
virtual ~ContentVerifierDelegateImpl() {}
virtual bool ShouldBeVerified(const Extension& extension) OVERRIDE {
- return ((extension.is_extension() || extension.is_legacy_packaged_app()) &&
- ManifestURL::UpdatesFromGallery(&extension) &&
- Manifest::IsAutoUpdateableLocation(extension.location()));
+ if (!extension.is_extension() && !extension.is_legacy_packaged_app())
+ return false;
+ if (!Manifest::IsAutoUpdateableLocation(extension.location()))
+ return false;
+
+ if (!ManifestURL::UpdatesFromGallery(&extension)) {
+ // It's possible that the webstore update url was overridden for testing
+ // so also consider extensions with the default (production) update url
+ // to be from the store as well.
+ GURL default_webstore_url = extension_urls::GetDefaultWebstoreUpdateUrl();
+ if (ManifestURL::GetUpdateURL(&extension) != default_webstore_url)
+ return false;
+ }
+
+ return true;
}
virtual const ContentVerifierKey& PublicKey() OVERRIDE {
@@ -165,7 +180,26 @@ class ContentVerifierDelegateImpl : public ContentVerifierDelegate {
virtual GURL GetSignatureFetchUrl(const std::string& extension_id,
const base::Version& version) OVERRIDE {
- return GURL();
+ // TODO(asargent) Factor out common code from the extension updater's
+ // ManifestFetchData class that can be shared for use here.
+ std::vector<std::string> parts;
+ parts.push_back("uc");
+ parts.push_back("installsource=signature");
+ parts.push_back("id=" + extension_id);
+ parts.push_back("v=" + version.GetString());
+ std::string x_value =
+ net::EscapeQueryParamValue(JoinString(parts, "&"), true);
+ std::string query = "response=redirect&x=" + x_value;
+
+ GURL base_url = extension_urls::GetWebstoreUpdateUrl();
+ GURL::Replacements replacements;
+ replacements.SetQuery(query.c_str(), url::Component(0, query.length()));
+ return base_url.ReplaceComponents(replacements);
+ }
+
+ virtual std::set<base::FilePath> GetBrowserImagePaths(
+ const extensions::Extension* extension) OVERRIDE {
+ return extension_file_util::GetBrowserImagePaths(extension);
}
virtual void VerifyFailed(const std::string& extension_id) OVERRIDE {
« no previous file with comments | « no previous file | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698