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_service.h" | 5 #include "chrome/browser/metrics/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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 bool VariationsService::CheckStudyVersion( | 233 bool VariationsService::CheckStudyVersion( |
234 const chrome_variations::Study_Filter& filter, | 234 const chrome_variations::Study_Filter& filter, |
235 const std::string& version_string) { | 235 const std::string& version_string) { |
236 const Version version(version_string); | 236 const Version version(version_string); |
237 if (!version.IsValid()) { | 237 if (!version.IsValid()) { |
238 NOTREACHED(); | 238 NOTREACHED(); |
239 return false; | 239 return false; |
240 } | 240 } |
241 | 241 |
242 if (filter.has_min_version()) { | 242 if (filter.has_min_version()) { |
243 const Version min_version(filter.min_version()); | 243 if (version.CompareToWildcard(filter.min_version()) < 0) |
244 if (!min_version.IsValid()) | |
245 return false; | |
246 if (version.CompareTo(min_version) < 0) | |
247 return false; | 244 return false; |
248 } | 245 } |
249 | 246 |
250 if (filter.has_max_version()) { | 247 if (filter.has_max_version()) { |
251 const Version max_version(filter.max_version()); | 248 if (version.CompareToWildcard(filter.max_version()) > 0) |
252 if (!max_version.IsValid()) | |
253 return false; | |
254 if (version.CompareTo(max_version) > 0) | |
255 return false; | 249 return false; |
256 } | 250 } |
257 | 251 |
258 return true; | 252 return true; |
259 } | 253 } |
260 | 254 |
261 // static | 255 // static |
262 bool VariationsService::CheckStudyStartDate( | 256 bool VariationsService::CheckStudyStartDate( |
263 const chrome_variations::Study_Filter& filter, | 257 const chrome_variations::Study_Filter& filter, |
264 const base::Time& date_time) { | 258 const base::Time& date_time) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 experiments_helper::AssociateGoogleVariationIDForce(study.name(), | 367 experiments_helper::AssociateGoogleVariationIDForce(study.name(), |
374 experiment.name(), | 368 experiment.name(), |
375 variation_id); | 369 variation_id); |
376 } | 370 } |
377 } | 371 } |
378 | 372 |
379 trial->SetForced(); | 373 trial->SetForced(); |
380 if (IsStudyExpired(study, reference_date)) | 374 if (IsStudyExpired(study, reference_date)) |
381 trial->Disable(); | 375 trial->Disable(); |
382 } | 376 } |
OLD | NEW |