| 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_VARIATIONS_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ |
| 6 #define CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ | 6 #define CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 virtual void OnResourceRequestsAllowed() OVERRIDE; | 86 virtual void OnResourceRequestsAllowed() OVERRIDE; |
| 87 | 87 |
| 88 // Store the given seed data to the given local prefs. Note that |seed_data| | 88 // Store the given seed data to the given local prefs. Note that |seed_data| |
| 89 // is assumed to be the raw serialized protobuf data stored in a string. It | 89 // is assumed to be the raw serialized protobuf data stored in a string. It |
| 90 // will be Base64Encoded for storage. If the string is invalid or the encoding | 90 // will be Base64Encoded for storage. If the string is invalid or the encoding |
| 91 // fails, the |local_prefs| is left as is and the function returns false. | 91 // fails, the |local_prefs| is left as is and the function returns false. |
| 92 bool StoreSeedData(const std::string& seed_data, | 92 bool StoreSeedData(const std::string& seed_data, |
| 93 const base::Time& seed_date, | 93 const base::Time& seed_date, |
| 94 PrefService* local_prefs); | 94 PrefService* local_prefs); |
| 95 | 95 |
| 96 // Wrapper around channel checking, used to enable channel mocking for |
| 97 // testing. If the current browser channel is not UNKNOWN, this will return |
| 98 // that channel value. Otherwise, if the fake channel flag is provided, this |
| 99 // will return the fake channel. Failing that, this will return the UNKNOWN |
| 100 // channel. |
| 101 static chrome::VersionInfo::Channel GetChannelForVariations(); |
| 102 |
| 96 // Returns whether |study| should be disabled according to its restriction | 103 // Returns whether |study| should be disabled according to its restriction |
| 97 // parameters. Uses |version_info| for min / max version checks and | 104 // parameters. Uses |version_info| for min / max version checks and |
| 98 // |reference_date| for the start date check. | 105 // |reference_date| for the start date check. |
| 99 static bool ShouldAddStudy(const Study& study, | 106 static bool ShouldAddStudy(const Study& study, |
| 100 const chrome::VersionInfo& version_info, | 107 const chrome::VersionInfo& version_info, |
| 101 const base::Time& reference_date); | 108 const base::Time& reference_date); |
| 102 | 109 |
| 103 // Checks whether a study is applicable for the given |channel| per |filter|. | 110 // Checks whether a study is applicable for the given |channel| per |filter|. |
| 104 static bool CheckStudyChannel(const Study_Filter& filter, | 111 static bool CheckStudyChannel(const Study_Filter& filter, |
| 105 chrome::VersionInfo::Channel channel); | 112 chrome::VersionInfo::Channel channel); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 scoped_ptr<ResourceRequestAllowedNotifier> resource_request_allowed_notifier_; | 171 scoped_ptr<ResourceRequestAllowedNotifier> resource_request_allowed_notifier_; |
| 165 | 172 |
| 166 // The start time of the last seed request. This is used to measure the | 173 // The start time of the last seed request. This is used to measure the |
| 167 // latency of seed requests. Initially zero. | 174 // latency of seed requests. Initially zero. |
| 168 base::TimeTicks last_request_started_time_; | 175 base::TimeTicks last_request_started_time_; |
| 169 }; | 176 }; |
| 170 | 177 |
| 171 } // namespace chrome_variations | 178 } // namespace chrome_variations |
| 172 | 179 |
| 173 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ | 180 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ |
| OLD | NEW |