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

Side by Side Diff: components/variations/service/variations_service.cc

Issue 1575523002: Comparison and streaming operators for base::Version (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes mistake in previous 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 "components/variations/service/variations_service.h" 5 #include "components/variations/service/variations_service.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 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 792
793 // Determine if the saved pref value is present and valid. 793 // Determine if the saved pref value is present and valid.
794 const bool is_pref_empty = list_value->empty(); 794 const bool is_pref_empty = list_value->empty();
795 const bool is_pref_valid = list_value->GetSize() == 2 && 795 const bool is_pref_valid = list_value->GetSize() == 2 &&
796 list_value->GetString(0, &stored_version_string) && 796 list_value->GetString(0, &stored_version_string) &&
797 list_value->GetString(1, &stored_country) && 797 list_value->GetString(1, &stored_country) &&
798 base::Version(stored_version_string).IsValid(); 798 base::Version(stored_version_string).IsValid();
799 799
800 // Determine if the version from the saved pref matches |version|. 800 // Determine if the version from the saved pref matches |version|.
801 const bool does_version_match = 801 const bool does_version_match =
802 is_pref_valid && version.Equals(base::Version(stored_version_string)); 802 is_pref_valid && version == base::Version(stored_version_string);
803 803
804 // Determine if the country in the saved pref matches the country in 804 // Determine if the country in the saved pref matches the country in
805 // |latest_country|. 805 // |latest_country|.
806 const bool does_country_match = is_pref_valid && !latest_country.empty() && 806 const bool does_country_match = is_pref_valid && !latest_country.empty() &&
807 stored_country == latest_country; 807 stored_country == latest_country;
808 808
809 // Record a histogram for how the saved pref value compares to the current 809 // Record a histogram for how the saved pref value compares to the current
810 // version and the country code in the variations seed. 810 // version and the country code in the variations seed.
811 LoadPermanentConsistencyCountryResult result; 811 LoadPermanentConsistencyCountryResult result;
812 if (is_pref_empty) { 812 if (is_pref_empty) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 std::string stored_country; 858 std::string stored_country;
859 859
860 if (list_value->GetSize() == 2) { 860 if (list_value->GetSize() == 2) {
861 list_value->GetString(1, &stored_country); 861 list_value->GetString(1, &stored_country);
862 } 862 }
863 863
864 return stored_country; 864 return stored_country;
865 } 865 }
866 866
867 } // namespace variations 867 } // namespace variations
OLDNEW
« no previous file with comments | « components/update_client/update_client_unittest.cc ('k') | extensions/browser/content_hash_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698