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

Side by Side Diff: chrome/browser/renderer_host/pepper/device_id_fetcher.cc

Issue 448853002: Move StringToLowerASCII to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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/browser/profiles/profile_io_data.cc ('k') | chrome/browser/search/hotword_service.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/renderer_host/pepper/device_id_fetcher.h" 5 #include "chrome/browser/renderer_host/pepper/device_id_fetcher.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 LOG(ERROR) << "Unexpected salt bytes length: " << salt_bytes.size(); 155 LOG(ERROR) << "Unexpected salt bytes length: " << salt_bytes.size();
156 RunCallbackOnIOThread(std::string(), PP_ERROR_FAILED); 156 RunCallbackOnIOThread(std::string(), PP_ERROR_FAILED);
157 return; 157 return;
158 } 158 }
159 159
160 char id_buf[256 / 8]; // 256-bits for SHA256 160 char id_buf[256 / 8]; // 256-bits for SHA256
161 std::string input = machine_id; 161 std::string input = machine_id;
162 input.append(kDRMIdentifierFile); 162 input.append(kDRMIdentifierFile);
163 input.append(salt_bytes.begin(), salt_bytes.end()); 163 input.append(salt_bytes.begin(), salt_bytes.end());
164 crypto::SHA256HashString(input, &id_buf, sizeof(id_buf)); 164 crypto::SHA256HashString(input, &id_buf, sizeof(id_buf));
165 std::string id = StringToLowerASCII( 165 std::string id = base::StringToLowerASCII(
166 base::HexEncode(reinterpret_cast<const void*>(id_buf), sizeof(id_buf))); 166 base::HexEncode(reinterpret_cast<const void*>(id_buf), sizeof(id_buf)));
167 input = machine_id; 167 input = machine_id;
168 input.append(kDRMIdentifierFile); 168 input.append(kDRMIdentifierFile);
169 input.append(id); 169 input.append(id);
170 crypto::SHA256HashString(input, &id_buf, sizeof(id_buf)); 170 crypto::SHA256HashString(input, &id_buf, sizeof(id_buf));
171 id = StringToLowerASCII( 171 id = base::StringToLowerASCII(
172 base::HexEncode(reinterpret_cast<const void*>(id_buf), sizeof(id_buf))); 172 base::HexEncode(reinterpret_cast<const void*>(id_buf), sizeof(id_buf)));
173 173
174 RunCallbackOnIOThread(id, PP_OK); 174 RunCallbackOnIOThread(id, PP_OK);
175 } 175 }
176 176
177 // TODO(raymes): This is temporary code to migrate ChromeOS devices to the new 177 // TODO(raymes): This is temporary code to migrate ChromeOS devices to the new
178 // scheme for generating device IDs. Delete this once we are sure most ChromeOS 178 // scheme for generating device IDs. Delete this once we are sure most ChromeOS
179 // devices have been migrated. 179 // devices have been migrated.
180 void DeviceIDFetcher::LegacyComputeOnBlockingPool( 180 void DeviceIDFetcher::LegacyComputeOnBlockingPool(
181 const base::FilePath& profile_path, 181 const base::FilePath& profile_path,
(...skipping 24 matching lines...) Expand all
206 BrowserThread::IO, 206 BrowserThread::IO,
207 FROM_HERE, 207 FROM_HERE,
208 base::Bind(&DeviceIDFetcher::RunCallbackOnIOThread, this, id, result)); 208 base::Bind(&DeviceIDFetcher::RunCallbackOnIOThread, this, id, result));
209 return; 209 return;
210 } 210 }
211 in_progress_ = false; 211 in_progress_ = false;
212 callback_.Run(id, result); 212 callback_.Run(id, result);
213 } 213 }
214 214
215 } // namespace chrome 215 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_io_data.cc ('k') | chrome/browser/search/hotword_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698