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 <windows.h> | 5 #include <windows.h> |
6 #include <shlwapi.h> | 6 #include <shlwapi.h> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // Return true if the build time predates the expiration time.. | 69 // Return true if the build time predates the expiration time.. |
70 return build_time < expiration_time; | 70 return build_time < expiration_time; |
71 } | 71 } |
72 | 72 |
73 // Get random unit values, i.e., in the range (0, 1), denoting a die-toss for | 73 // Get random unit values, i.e., in the range (0, 1), denoting a die-toss for |
74 // being in an experiment population and experimental group thereof. | 74 // being in an experiment population and experimental group thereof. |
75 void GetPreReadPopulationAndGroup(double* population, double* group) { | 75 void GetPreReadPopulationAndGroup(double* population, double* group) { |
76 // By default we use the metrics id for the user as stable pseudo-random | 76 // By default we use the metrics id for the user as stable pseudo-random |
77 // input to a hash. | 77 // input to a hash. |
78 std::string metrics_id; | 78 std::string metrics_id; |
79 GoogleUpdateSettings::RetrieveMetricsID(&metrics_id); | 79 GoogleUpdateSettings::RetrieveMetricsInfo(&metrics_id, NULL); |
80 | 80 |
81 // If this user has not metrics id, we fall back to a purely random value | 81 // If this user has no metrics id, we fall back to a purely random value per |
82 // per browser session. | 82 // browser session. |
83 const size_t kLength = 16; | 83 const size_t kLength = 16; |
84 std::string random_value(metrics_id.empty() ? base::RandBytesAsString(kLength) | 84 std::string random_value(metrics_id.empty() ? base::RandBytesAsString(kLength) |
85 : metrics_id); | 85 : metrics_id); |
86 | 86 |
87 // To interpret the value as a random number we hash it and read the first 8 | 87 // To interpret the value as a random number we hash it and read the first 8 |
88 // bytes of the hash as a unit-interval representing a die-toss for being in | 88 // bytes of the hash as a unit-interval representing a die-toss for being in |
89 // the experiment population and the second 8 bytes as a die-toss for being | 89 // the experiment population and the second 8 bytes as a die-toss for being |
90 // in various experiment groups. | 90 // in various experiment groups. |
91 unsigned char sha1_hash[base::kSHA1Length]; | 91 unsigned char sha1_hash[base::kSHA1Length]; |
92 base::SHA1HashBytes( | 92 base::SHA1HashBytes( |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 } | 362 } |
363 }; | 363 }; |
364 | 364 |
365 MainDllLoader* MakeMainDllLoader() { | 365 MainDllLoader* MakeMainDllLoader() { |
366 #if defined(GOOGLE_CHROME_BUILD) | 366 #if defined(GOOGLE_CHROME_BUILD) |
367 return new ChromeDllLoader(); | 367 return new ChromeDllLoader(); |
368 #else | 368 #else |
369 return new ChromiumDllLoader(); | 369 return new ChromiumDllLoader(); |
370 #endif | 370 #endif |
371 } | 371 } |
OLD | NEW |