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 "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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 return "android"; | 101 return "android"; |
102 #elif defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) | 102 #elif defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) |
103 // Default BSD and SOLARIS to Linux to not break those builds, although these | 103 // Default BSD and SOLARIS to Linux to not break those builds, although these |
104 // platforms are not officially supported by Chrome. | 104 // platforms are not officially supported by Chrome. |
105 return "linux"; | 105 return "linux"; |
106 #else | 106 #else |
107 #error Unknown platform | 107 #error Unknown platform |
108 #endif | 108 #endif |
109 } | 109 } |
110 | 110 |
111 // Converts |date_time| in Study date format to base::Time. | |
112 base::Time ConvertStudyDateToBaseTime(int64 date_time) { | |
113 return base::Time::UnixEpoch() + base::TimeDelta::FromSeconds(date_time); | |
114 } | |
115 | |
116 // Gets the restrict parameter from |local_state| or from Chrome OS settings in | 111 // Gets the restrict parameter from |local_state| or from Chrome OS settings in |
117 // the case of that platform. | 112 // the case of that platform. |
118 std::string GetRestrictParameterPref(PrefService* local_state) { | 113 std::string GetRestrictParameterPref(PrefService* local_state) { |
119 std::string parameter; | 114 std::string parameter; |
120 #if defined(OS_CHROMEOS) | 115 #if defined(OS_CHROMEOS) |
121 chromeos::CrosSettings::Get()->GetString( | 116 chromeos::CrosSettings::Get()->GetString( |
122 chromeos::kVariationsRestrictParameter, ¶meter); | 117 chromeos::kVariationsRestrictParameter, ¶meter); |
123 #else | 118 #else |
124 if (local_state) | 119 if (local_state) |
125 parameter = local_state->GetString(prefs::kVariationsRestrictParameter); | 120 parameter = local_state->GetString(prefs::kVariationsRestrictParameter); |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 | 489 |
495 void VariationsService::RecordLastFetchTime() { | 490 void VariationsService::RecordLastFetchTime() { |
496 // local_state_ is NULL in tests, so check it first. | 491 // local_state_ is NULL in tests, so check it first. |
497 if (local_state_) { | 492 if (local_state_) { |
498 local_state_->SetInt64(prefs::kVariationsLastFetchTime, | 493 local_state_->SetInt64(prefs::kVariationsLastFetchTime, |
499 base::Time::Now().ToInternalValue()); | 494 base::Time::Now().ToInternalValue()); |
500 } | 495 } |
501 } | 496 } |
502 | 497 |
503 } // namespace chrome_variations | 498 } // namespace chrome_variations |
OLD | NEW |