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

Side by Side Diff: chrome/browser/extensions/chrome_content_verifier_delegate.cc

Issue 2336403002: Fix extension content verification out-of-band hash fetching (Closed)
Patch Set: review feedback Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/chrome_content_verifier_delegate.h" 5 #include "chrome/browser/extensions/chrome_content_verifier_delegate.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory>
8 #include <set> 9 #include <set>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/base_switches.h" 12 #include "base/base_switches.h"
12 #include "base/command_line.h" 13 #include "base/command_line.h"
13 #include "base/metrics/field_trial.h" 14 #include "base/metrics/field_trial.h"
14 #include "base/metrics/histogram_macros.h" 15 #include "base/metrics/histogram_macros.h"
15 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
16 #include "base/version.h" 17 #include "base/version.h"
17 #include "build/build_config.h" 18 #include "build/build_config.h"
18 #include "chrome/browser/extensions/extension_service.h" 19 #include "chrome/browser/extensions/extension_service.h"
19 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/extensions/extension_constants.h" 21 #include "chrome/common/extensions/extension_constants.h"
21 #include "extensions/browser/extension_prefs.h" 22 #include "extensions/browser/extension_prefs.h"
22 #include "extensions/browser/extension_registry.h" 23 #include "extensions/browser/extension_registry.h"
23 #include "extensions/browser/extension_system.h" 24 #include "extensions/browser/extension_system.h"
24 #include "extensions/browser/management_policy.h" 25 #include "extensions/browser/management_policy.h"
26 #include "extensions/common/constants.h"
25 #include "extensions/common/extension.h" 27 #include "extensions/common/extension.h"
26 #include "extensions/common/extension_urls.h" 28 #include "extensions/common/extension_urls.h"
27 #include "extensions/common/extensions_client.h" 29 #include "extensions/common/extensions_client.h"
28 #include "extensions/common/manifest.h" 30 #include "extensions/common/manifest.h"
29 #include "extensions/common/manifest_url_handlers.h" 31 #include "extensions/common/manifest_url_handlers.h"
30 #include "net/base/escape.h" 32 #include "net/base/escape.h"
31 33
32 #if defined(OS_CHROMEOS) 34 #if defined(OS_CHROMEOS)
33 #include "chrome/browser/extensions/extension_assets_manager_chromeos.h" 35 #include "chrome/browser/extensions/extension_assets_manager_chromeos.h"
34 #endif 36 #endif
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // to be from the store as well. 126 // to be from the store as well.
125 GURL default_webstore_url = extension_urls::GetDefaultWebstoreUpdateUrl(); 127 GURL default_webstore_url = extension_urls::GetDefaultWebstoreUpdateUrl();
126 if (ManifestURL::GetUpdateURL(&extension) != default_webstore_url) 128 if (ManifestURL::GetUpdateURL(&extension) != default_webstore_url)
127 return ContentVerifierDelegate::NONE; 129 return ContentVerifierDelegate::NONE;
128 } 130 }
129 131
130 return default_mode_; 132 return default_mode_;
131 } 133 }
132 134
133 ContentVerifierKey ChromeContentVerifierDelegate::GetPublicKey() { 135 ContentVerifierKey ChromeContentVerifierDelegate::GetPublicKey() {
134 return ContentVerifierKey(extension_misc::kWebstoreSignaturesPublicKey, 136 return ContentVerifierKey(kWebstoreSignaturesPublicKey,
135 extension_misc::kWebstoreSignaturesPublicKeySize); 137 kWebstoreSignaturesPublicKeySize);
136 } 138 }
137 139
138 GURL ChromeContentVerifierDelegate::GetSignatureFetchUrl( 140 GURL ChromeContentVerifierDelegate::GetSignatureFetchUrl(
139 const std::string& extension_id, 141 const std::string& extension_id,
140 const base::Version& version) { 142 const base::Version& version) {
141 // TODO(asargent) Factor out common code from the extension updater's 143 // TODO(asargent) Factor out common code from the extension updater's
142 // ManifestFetchData class that can be shared for use here. 144 // ManifestFetchData class that can be shared for use here.
143 std::vector<std::string> parts; 145 std::vector<std::string> parts;
144 parts.push_back("uc"); 146 parts.push_back("uc");
145 parts.push_back("installsource=signature"); 147 parts.push_back("installsource=signature");
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 UMA_HISTOGRAM_ENUMERATION("Extensions.CorruptExtensionDisabledReason", 197 UMA_HISTOGRAM_ENUMERATION("Extensions.CorruptExtensionDisabledReason",
196 reason, ContentVerifyJob::FAILURE_REASON_MAX); 198 reason, ContentVerifyJob::FAILURE_REASON_MAX);
197 } else if (!base::ContainsKey(would_be_disabled_ids_, extension_id)) { 199 } else if (!base::ContainsKey(would_be_disabled_ids_, extension_id)) {
198 UMA_HISTOGRAM_BOOLEAN("Extensions.CorruptExtensionWouldBeDisabled", true); 200 UMA_HISTOGRAM_BOOLEAN("Extensions.CorruptExtensionWouldBeDisabled", true);
199 would_be_disabled_ids_.insert(extension_id); 201 would_be_disabled_ids_.insert(extension_id);
200 } 202 }
201 } 203 }
202 204
203 205
204 } // namespace extensions 206 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698