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

Side by Side Diff: chrome/browser/metrics/variations/variations_service.cc

Issue 86913002: Make base::Base64Encode() return void (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: One more chromeos-specific fix. Created 7 years 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/metrics/variations/variations_service.h" 5 #include "chrome/browser/metrics/variations/variations_service.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/build_time.h" 10 #include "base/build_time.h"
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 474
475 // Only store the seed data if it parses correctly. 475 // Only store the seed data if it parses correctly.
476 VariationsSeed seed; 476 VariationsSeed seed;
477 if (!seed.ParseFromString(seed_data)) { 477 if (!seed.ParseFromString(seed_data)) {
478 VLOG(1) << "Variations Seed data from server is not in valid proto format, " 478 VLOG(1) << "Variations Seed data from server is not in valid proto format, "
479 << "rejecting the seed."; 479 << "rejecting the seed.";
480 return false; 480 return false;
481 } 481 }
482 482
483 std::string base64_seed_data; 483 std::string base64_seed_data;
484 if (!base::Base64Encode(seed_data, &base64_seed_data)) { 484 base::Base64Encode(seed_data, &base64_seed_data);
485 VLOG(1) << "Variations Seed data from server fails Base64Encode, rejecting "
486 << "the seed.";
487 return false;
488 }
489 485
490 local_state_->SetString(prefs::kVariationsSeed, base64_seed_data); 486 local_state_->SetString(prefs::kVariationsSeed, base64_seed_data);
491 local_state_->SetString(prefs::kVariationsSeedHash, HashSeed(seed_data)); 487 local_state_->SetString(prefs::kVariationsSeedHash, HashSeed(seed_data));
492 local_state_->SetInt64(prefs::kVariationsSeedDate, 488 local_state_->SetInt64(prefs::kVariationsSeedDate,
493 seed_date.ToInternalValue()); 489 seed_date.ToInternalValue());
494 variations_serial_number_ = seed.serial_number(); 490 variations_serial_number_ = seed.serial_number();
495 491
496 RecordLastFetchTime(); 492 RecordLastFetchTime();
497 493
498 return true; 494 return true;
(...skipping 29 matching lines...) Expand all
528 524
529 void VariationsService::RecordLastFetchTime() { 525 void VariationsService::RecordLastFetchTime() {
530 // local_state_ is NULL in tests, so check it first. 526 // local_state_ is NULL in tests, so check it first.
531 if (local_state_) { 527 if (local_state_) {
532 local_state_->SetInt64(prefs::kVariationsLastFetchTime, 528 local_state_->SetInt64(prefs::kVariationsLastFetchTime,
533 base::Time::Now().ToInternalValue()); 529 base::Time::Now().ToInternalValue());
534 } 530 }
535 } 531 }
536 532
537 } // namespace chrome_variations 533 } // namespace chrome_variations
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698