| 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 #ifndef CHROME_BROWSER_METRICS_VARIATIONS_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_METRICS_VARIATIONS_SERVICE_H_ |
| 6 #define CHROME_BROWSER_METRICS_VARIATIONS_SERVICE_H_ | 6 #define CHROME_BROWSER_METRICS_VARIATIONS_SERVICE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 static void RegisterPrefs(PrefService* prefs); | 51 static void RegisterPrefs(PrefService* prefs); |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyChannel); | 54 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyChannel); |
| 55 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyLocale); | 55 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyLocale); |
| 56 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyPlatform); | 56 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyPlatform); |
| 57 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyVersion); | 57 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyVersion); |
| 58 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyVersionWildcards); | 58 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyVersionWildcards); |
| 59 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyStartDate); | 59 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, CheckStudyStartDate); |
| 60 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, IsStudyExpired); | 60 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, IsStudyExpired); |
| 61 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, LoadSeed); |
| 62 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, StoreSeed); |
| 61 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, ValidateStudy); | 63 FRIEND_TEST_ALL_PREFIXES(VariationsServiceTest, ValidateStudy); |
| 62 | 64 |
| 63 // Store the given seed data to the given local prefs. Note that |seed_data| | 65 // Store the given seed data to the given local prefs. Note that |seed_data| |
| 64 // is assumed to be the raw serialized protobuf data stored in a string. It | 66 // is assumed to be the raw serialized protobuf data stored in a string. It |
| 65 // will be Base64Encoded for storage. If the string is invalid or the encoding | 67 // will be Base64Encoded for storage. If the string is invalid or the encoding |
| 66 // fails, the |local_prefs| is left as is. | 68 // fails, the |local_prefs| is left as is and the function returns false. |
| 67 void StoreSeedData(const std::string& seed_data, | 69 bool StoreSeedData(const std::string& seed_data, |
| 68 const base::Time& seed_date, | 70 const base::Time& seed_date, |
| 69 PrefService* local_prefs); | 71 PrefService* local_prefs); |
| 70 | 72 |
| 71 // Returns whether |study| should be disabled according to its restriction | 73 // Returns whether |study| should be disabled according to its restriction |
| 72 // parameters. Uses |version_info| for min / max version checks and | 74 // parameters. Uses |version_info| for min / max version checks and |
| 73 // |reference_date| for the start date check. | 75 // |reference_date| for the start date check. |
| 74 static bool ShouldAddStudy(const Study& study, | 76 static bool ShouldAddStudy(const Study& study, |
| 75 const chrome::VersionInfo& version_info, | 77 const chrome::VersionInfo& version_info, |
| 76 const base::Time& reference_date); | 78 const base::Time& reference_date); |
| 77 | 79 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // The URL to use for querying the variations server. | 124 // The URL to use for querying the variations server. |
| 123 GURL variations_server_url_; | 125 GURL variations_server_url_; |
| 124 | 126 |
| 125 // Keep a weak pointer generator so we can bind delayed calls to the server. | 127 // Keep a weak pointer generator so we can bind delayed calls to the server. |
| 126 base::WeakPtrFactory<VariationsService> weak_factory_; | 128 base::WeakPtrFactory<VariationsService> weak_factory_; |
| 127 }; | 129 }; |
| 128 | 130 |
| 129 } // namespace chrome_variations | 131 } // namespace chrome_variations |
| 130 | 132 |
| 131 #endif // CHROME_BROWSER_METRICS_VARIATIONS_SERVICE_H_ | 133 #endif // CHROME_BROWSER_METRICS_VARIATIONS_SERVICE_H_ |
| OLD | NEW |