OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/study_filtering.h" | 5 #include "components/variations/study_filtering.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include <set> | 10 #include <set> |
8 | 11 |
9 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "build/build_config.h" |
10 | 14 |
11 namespace variations { | 15 namespace variations { |
12 | 16 |
13 namespace { | 17 namespace { |
14 | 18 |
15 Study_Platform GetCurrentPlatform() { | 19 Study_Platform GetCurrentPlatform() { |
16 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
17 return Study_Platform_PLATFORM_WINDOWS; | 21 return Study_Platform_PLATFORM_WINDOWS; |
18 #elif defined(OS_IOS) | 22 #elif defined(OS_IOS) |
19 return Study_Platform_PLATFORM_IOS; | 23 return Study_Platform_PLATFORM_IOS; |
20 #elif defined(OS_MACOSX) | 24 #elif defined(OS_MACOSX) |
21 return Study_Platform_PLATFORM_MAC; | 25 return Study_Platform_PLATFORM_MAC; |
22 #elif defined(OS_CHROMEOS) | 26 #elif defined(OS_CHROMEOS) |
23 return Study_Platform_PLATFORM_CHROMEOS; | 27 return Study_Platform_PLATFORM_CHROMEOS; |
24 #elif defined(OS_ANDROID) | 28 #elif defined(OS_ANDROID) |
25 return Study_Platform_PLATFORM_ANDROID; | 29 return Study_Platform_PLATFORM_ANDROID; |
26 #elif defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) | 30 #elif defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) |
27 // Default BSD and SOLARIS to Linux to not break those builds, although these | 31 // Default BSD and SOLARIS to Linux to not break those builds, although these |
28 // platforms are not officially supported by Chrome. | 32 // platforms are not officially supported by Chrome. |
29 return Study_Platform_PLATFORM_LINUX; | 33 return Study_Platform_PLATFORM_LINUX; |
30 #else | 34 #else |
31 #error Unknown platform | 35 #error Unknown platform |
32 #endif | 36 #endif |
33 } | 37 } |
34 | 38 |
35 // Converts |date_time| in Study date format to base::Time. | 39 // Converts |date_time| in Study date format to base::Time. |
36 base::Time ConvertStudyDateToBaseTime(int64 date_time) { | 40 base::Time ConvertStudyDateToBaseTime(int64_t date_time) { |
37 return base::Time::UnixEpoch() + base::TimeDelta::FromSeconds(date_time); | 41 return base::Time::UnixEpoch() + base::TimeDelta::FromSeconds(date_time); |
38 } | 42 } |
39 | 43 |
40 } // namespace | 44 } // namespace |
41 | 45 |
42 namespace internal { | 46 namespace internal { |
43 | 47 |
44 bool CheckStudyChannel(const Study_Filter& filter, Study_Channel channel) { | 48 bool CheckStudyChannel(const Study_Filter& filter, Study_Channel channel) { |
45 // An empty channel list matches all channels. | 49 // An empty channel list matches all channels. |
46 if (filter.channel_size() == 0) | 50 if (filter.channel_size() == 0) |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 | 296 |
293 for (size_t i = 0; i < expired_studies.size(); ++i) { | 297 for (size_t i = 0; i < expired_studies.size(); ++i) { |
294 if (!ContainsKey(created_studies, expired_studies[i]->name())) { | 298 if (!ContainsKey(created_studies, expired_studies[i]->name())) { |
295 ProcessedStudy::ValidateAndAppendStudy(expired_studies[i], true, | 299 ProcessedStudy::ValidateAndAppendStudy(expired_studies[i], true, |
296 filtered_studies); | 300 filtered_studies); |
297 } | 301 } |
298 } | 302 } |
299 } | 303 } |
300 | 304 |
301 } // namespace variations | 305 } // namespace variations |
OLD | NEW |