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

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

Issue 7972024: Update SHA1_LENGTH -> kSHA1Length to match previous change to SHA256_LENGTH. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/environment.h" 10 #include "base/environment.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 return false; 138 return false;
139 139
140 // Get the MetricsId of the installation. This is only set if the user has 140 // Get the MetricsId of the installation. This is only set if the user has
141 // opted in to reporting. Doing things this way ensures that we only enable 141 // opted in to reporting. Doing things this way ensures that we only enable
142 // the experiment if its results are actually going to be reported. 142 // the experiment if its results are actually going to be reported.
143 std::wstring metrics_id; 143 std::wstring metrics_id;
144 if (!GoogleUpdateSettings::GetMetricsId(&metrics_id) || metrics_id.empty()) 144 if (!GoogleUpdateSettings::GetMetricsId(&metrics_id) || metrics_id.empty())
145 return false; 145 return false;
146 146
147 // We use the same technique as FieldTrial::HashClientId. 147 // We use the same technique as FieldTrial::HashClientId.
148 unsigned char sha1_hash[base::SHA1_LENGTH]; 148 unsigned char sha1_hash[base::kSHA1Length];
149 base::SHA1HashBytes( 149 base::SHA1HashBytes(
150 reinterpret_cast<const unsigned char*>(metrics_id.c_str()), 150 reinterpret_cast<const unsigned char*>(metrics_id.c_str()),
151 metrics_id.size() * sizeof(metrics_id[0]), 151 metrics_id.size() * sizeof(metrics_id[0]),
152 sha1_hash); 152 sha1_hash);
153 COMPILE_ASSERT(sizeof(uint64) < sizeof(sha1_hash), need_more_data); 153 COMPILE_ASSERT(sizeof(uint64) < sizeof(sha1_hash), need_more_data);
154 uint64* bits = reinterpret_cast<uint64*>(&sha1_hash[0]); 154 uint64* bits = reinterpret_cast<uint64*>(&sha1_hash[0]);
155 double rand_unit = base::BitsToOpenEndedUnitInterval(*bits); 155 double rand_unit = base::BitsToOpenEndedUnitInterval(*bits);
156 DWORD coin_toss = rand_unit > 0.5 ? 1 : 0; 156 DWORD coin_toss = rand_unit > 0.5 ? 1 : 0;
157 157
158 *pre_read = coin_toss; 158 *pre_read = coin_toss;
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 } 396 }
397 }; 397 };
398 398
399 MainDllLoader* MakeMainDllLoader() { 399 MainDllLoader* MakeMainDllLoader() {
400 #if defined(GOOGLE_CHROME_BUILD) 400 #if defined(GOOGLE_CHROME_BUILD)
401 return new ChromeDllLoader(); 401 return new ChromeDllLoader();
402 #else 402 #else
403 return new ChromiumDllLoader(); 403 return new ChromiumDllLoader();
404 #endif 404 #endif
405 } 405 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698