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

Side by Side Diff: chrome/browser/chromeos/extensions/external_cache.cc

Issue 829583002: Validate hash_sha256 checksum on .crx update. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unittest build for windows. Created 5 years, 10 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/chromeos/extensions/external_cache.h" 5 #include "chrome/browser/chromeos/extensions/external_cache.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 delegate_->OnExtensionLoadedInCache(id); 172 delegate_->OnExtensionLoadedInCache(id);
173 } 173 }
174 } else { 174 } else {
175 LOG(ERROR) << "ExternalCache failed to download extension " << id 175 LOG(ERROR) << "ExternalCache failed to download extension " << id
176 << ", error " << error; 176 << ", error " << error;
177 delegate_->OnExtensionDownloadFailed(id, error); 177 delegate_->OnExtensionDownloadFailed(id, error);
178 } 178 }
179 } 179 }
180 180
181 void ExternalCache::OnExtensionDownloadFinished( 181 void ExternalCache::OnExtensionDownloadFinished(
182 const std::string& id, 182 const extensions::CRXFileInfo& file,
183 const base::FilePath& path,
184 bool file_ownership_passed, 183 bool file_ownership_passed,
185 const GURL& download_url, 184 const GURL& download_url,
186 const std::string& version, 185 const std::string& version,
187 const extensions::ExtensionDownloaderDelegate::PingResult& ping_result, 186 const extensions::ExtensionDownloaderDelegate::PingResult& ping_result,
188 const std::set<int>& request_ids) { 187 const std::set<int>& request_ids) {
189 DCHECK(file_ownership_passed); 188 DCHECK(file_ownership_passed);
190 local_cache_.PutExtension(id, path, version, 189 local_cache_.PutExtension(
191 base::Bind(&ExternalCache::OnPutExtension, 190 file.extension_id, file.path, version,
192 weak_ptr_factory_.GetWeakPtr(), 191 base::Bind(&ExternalCache::OnPutExtension, weak_ptr_factory_.GetWeakPtr(),
193 id)); 192 file.extension_id));
194 } 193 }
195 194
196 bool ExternalCache::IsExtensionPending(const std::string& id) { 195 bool ExternalCache::IsExtensionPending(const std::string& id) {
197 // Pending means that there is no installed version yet. 196 // Pending means that there is no installed version yet.
198 return extensions_->HasKey(id) && !cached_extensions_->HasKey(id); 197 return extensions_->HasKey(id) && !cached_extensions_->HasKey(id);
199 } 198 }
200 199
201 bool ExternalCache::GetExtensionExistingVersion(const std::string& id, 200 bool ExternalCache::GetExtensionExistingVersion(const std::string& id,
202 std::string* version) { 201 std::string* version) {
203 base::DictionaryValue* extension_dictionary = NULL; 202 base::DictionaryValue* extension_dictionary = NULL;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 OnPutExtension(id, file_path, file_ownership_passed); 344 OnPutExtension(id, file_path, file_ownership_passed);
346 callback.Run(id, !file_ownership_passed); 345 callback.Run(id, !file_ownership_passed);
347 } 346 }
348 347
349 std::string ExternalCache::Delegate::GetInstalledExtensionVersion( 348 std::string ExternalCache::Delegate::GetInstalledExtensionVersion(
350 const std::string& id) { 349 const std::string& id) {
351 return std::string(); 350 return std::string();
352 } 351 }
353 352
354 } // namespace chromeos 353 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/external_cache.h ('k') | chrome/browser/chromeos/extensions/external_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698