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

Side by Side Diff: chrome/browser/component_updater/pnacl_component_installer.cc

Issue 1575523002: Comparison and streaming operators for base::Version (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/component_updater/pnacl_component_installer.h" 5 #include "chrome/browser/component_updater/pnacl_component_installer.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 OverrideDirPnaclComponent(path); 265 OverrideDirPnaclComponent(path);
266 return true; 266 return true;
267 } 267 }
268 268
269 // Given |file|, which can be a path like "_platform_specific/arm/pnacl_foo", 269 // Given |file|, which can be a path like "_platform_specific/arm/pnacl_foo",
270 // returns the assumed install path. The path separator in |file| is '/' 270 // returns the assumed install path. The path separator in |file| is '/'
271 // for all platforms. Caller is responsible for checking that the 271 // for all platforms. Caller is responsible for checking that the
272 // |installed_file| actually exists. 272 // |installed_file| actually exists.
273 bool PnaclComponentInstaller::GetInstalledFile(const std::string& file, 273 bool PnaclComponentInstaller::GetInstalledFile(const std::string& file,
274 base::FilePath* installed_file) { 274 base::FilePath* installed_file) {
275 if (current_version().Equals(Version(kNullVersion))) 275 if (current_version() == Version(kNullVersion))
276 return false; 276 return false;
277 277
278 *installed_file = GetPnaclBaseDirectory() 278 *installed_file = GetPnaclBaseDirectory()
279 .AppendASCII(current_version().GetString()) 279 .AppendASCII(current_version().GetString())
280 .AppendASCII(file); 280 .AppendASCII(file);
281 return true; 281 return true;
282 } 282 }
283 283
284 bool PnaclComponentInstaller::Uninstall() { 284 bool PnaclComponentInstaller::Uninstall() {
285 return false; 285 return false;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 scoped_ptr<base::DictionaryValue> manifest(ReadComponentManifest(path)); 332 scoped_ptr<base::DictionaryValue> manifest(ReadComponentManifest(path));
333 scoped_ptr<base::DictionaryValue> pnacl_manifest(ReadPnaclManifest(path)); 333 scoped_ptr<base::DictionaryValue> pnacl_manifest(ReadPnaclManifest(path));
334 Version manifest_version; 334 Version manifest_version;
335 // Check that the component manifest and PNaCl manifest files 335 // Check that the component manifest and PNaCl manifest files
336 // are legit, and that the indicated version matches the one 336 // are legit, and that the indicated version matches the one
337 // encoded within the path name. 337 // encoded within the path name.
338 if (manifest == NULL || pnacl_manifest == NULL || 338 if (manifest == NULL || pnacl_manifest == NULL ||
339 !CheckPnaclComponentManifest(*manifest, 339 !CheckPnaclComponentManifest(*manifest,
340 *pnacl_manifest, 340 *pnacl_manifest,
341 &manifest_version) || 341 &manifest_version) ||
342 !current_version.Equals(manifest_version)) { 342 current_version != manifest_version) {
343 current_version = Version(kNullVersion); 343 current_version = Version(kNullVersion);
344 } else { 344 } else {
345 OverrideDirPnaclComponent(path); 345 OverrideDirPnaclComponent(path);
346 base::ReadFileToString(path.AppendASCII("manifest.fingerprint"), 346 base::ReadFileToString(path.AppendASCII("manifest.fingerprint"),
347 &current_fingerprint); 347 &current_fingerprint);
348 } 348 }
349 } 349 }
350 350
351 BrowserThread::PostTask(BrowserThread::UI, 351 BrowserThread::PostTask(BrowserThread::UI,
352 FROM_HERE, 352 FROM_HERE,
(...skipping 23 matching lines...) Expand all
376 } // namespace component_updater 376 } // namespace component_updater
377 377
378 namespace pnacl { 378 namespace pnacl {
379 379
380 bool NeedsOnDemandUpdate() { 380 bool NeedsOnDemandUpdate() {
381 return base::subtle::NoBarrier_Load( 381 return base::subtle::NoBarrier_Load(
382 &component_updater::needs_on_demand_update) != 0; 382 &component_updater::needs_on_demand_update) != 0;
383 } 383 }
384 384
385 } // namespace pnacl 385 } // namespace pnacl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698