| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |