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

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

Issue 2230203002: chrome: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed accidental components/ change Created 4 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/extensions/install_signer.h" 5 #include "chrome/browser/extensions/install_signer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 machine_id = "unknown"; 92 machine_id = "unknown";
93 #endif 93 #endif
94 94
95 std::unique_ptr<crypto::SecureHash> hash( 95 std::unique_ptr<crypto::SecureHash> hash(
96 crypto::SecureHash::Create(crypto::SecureHash::SHA256)); 96 crypto::SecureHash::Create(crypto::SecureHash::SHA256));
97 97
98 hash->Update(machine_id.data(), machine_id.size()); 98 hash->Update(machine_id.data(), machine_id.size());
99 hash->Update(salt.data(), salt.size()); 99 hash->Update(salt.data(), salt.size());
100 100
101 std::string result_bytes(crypto::kSHA256Length, 0); 101 std::string result_bytes(crypto::kSHA256Length, 0);
102 hash->Finish(string_as_array(&result_bytes), result_bytes.size()); 102 hash->Finish(base::string_as_array(&result_bytes), result_bytes.size());
103 103
104 base::Base64Encode(result_bytes, result); 104 base::Base64Encode(result_bytes, result);
105 return true; 105 return true;
106 } 106 }
107 107
108 // Validates that |input| is a string of the form "YYYY-MM-DD". 108 // Validates that |input| is a string of the form "YYYY-MM-DD".
109 bool ValidateExpireDateFormat(const std::string& input) { 109 bool ValidateExpireDateFormat(const std::string& input) {
110 if (input.length() != 10) 110 if (input.length() != 10)
111 return false; 111 return false;
112 for (int i = 0; i < 10; i++) { 112 for (int i = 0; i < 10; i++) {
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 // If the set of ids is empty, just return an empty signature and skip the 349 // If the set of ids is empty, just return an empty signature and skip the
350 // call to the server. 350 // call to the server.
351 if (ids_.empty()) { 351 if (ids_.empty()) {
352 if (!callback_.is_null()) 352 if (!callback_.is_null())
353 callback_.Run(std::unique_ptr<InstallSignature>(new InstallSignature())); 353 callback_.Run(std::unique_ptr<InstallSignature>(new InstallSignature()));
354 return; 354 return;
355 } 355 }
356 356
357 salt_ = std::string(kSaltBytes, 0); 357 salt_ = std::string(kSaltBytes, 0);
358 DCHECK_EQ(kSaltBytes, salt_.size()); 358 DCHECK_EQ(kSaltBytes, salt_.size());
359 crypto::RandBytes(string_as_array(&salt_), salt_.size()); 359 crypto::RandBytes(base::string_as_array(&salt_), salt_.size());
360 360
361 std::string hash_base64; 361 std::string hash_base64;
362 if (!HashWithMachineId(salt_, &hash_base64)) { 362 if (!HashWithMachineId(salt_, &hash_base64)) {
363 ReportErrorViaCallback(); 363 ReportErrorViaCallback();
364 return; 364 return;
365 } 365 }
366 366
367 if (!context_getter_) { 367 if (!context_getter_) {
368 ReportErrorViaCallback(); 368 ReportErrorViaCallback();
369 return; 369 return;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 if (!verified) 505 if (!verified)
506 result.reset(); 506 result.reset();
507 } 507 }
508 508
509 if (!callback_.is_null()) 509 if (!callback_.is_null())
510 callback_.Run(std::move(result)); 510 callback_.Run(std::move(result));
511 } 511 }
512 512
513 513
514 } // namespace extensions 514 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/external_provider_impl.cc ('k') | chrome/browser/extensions/install_verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698