Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: chrome/app/client_util.cc

Issue 365133005: Refactor SetClientID such that metrics rather than crash backs up the client id in Google Update set (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits:grt Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/app/chrome_breakpad_client.cc ('k') | chrome/browser/chrome_content_browser_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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::GetMetricsId(&metrics_id); 79 GoogleUpdateSettings::LoadMetricsClientId(&metrics_id);
80 80
81 // If this user has not metrics id, we fall back to a purely random value 81 // If this user has not metrics id, we fall back to a purely random value
82 // per browser session. 82 // per 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
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « chrome/app/chrome_breakpad_client.cc ('k') | chrome/browser/chrome_content_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698