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

Side by Side Diff: chrome/installer/util/shell_util.cc

Issue 176843022: Move UTF16ToASCII, remove WideToASCII. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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) 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 // This file defines functions that integrate Chrome in Windows shell. These 5 // This file defines functions that integrate Chrome in Windows shell. These
6 // functions can be used by Chrome as well as Chrome installer. All of the 6 // functions can be used by Chrome as well as Chrome installer. All of the
7 // work is done by the local functions defined in anonymous namespace in 7 // work is done by the local functions defined in anonymous namespace in
8 // this class. 8 // this class.
9 9
10 #include "chrome/installer/util/shell_util.h" 10 #include "chrome/installer/util/shell_util.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 }; // class UserSpecificRegistrySuffix 145 }; // class UserSpecificRegistrySuffix
146 146
147 UserSpecificRegistrySuffix::UserSpecificRegistrySuffix() { 147 UserSpecificRegistrySuffix::UserSpecificRegistrySuffix() {
148 base::string16 user_sid; 148 base::string16 user_sid;
149 if (!base::win::GetUserSidString(&user_sid)) { 149 if (!base::win::GetUserSidString(&user_sid)) {
150 NOTREACHED(); 150 NOTREACHED();
151 return; 151 return;
152 } 152 }
153 COMPILE_ASSERT(sizeof(base::MD5Digest) == 16, size_of_MD5_not_as_expected_); 153 COMPILE_ASSERT(sizeof(base::MD5Digest) == 16, size_of_MD5_not_as_expected_);
154 base::MD5Digest md5_digest; 154 base::MD5Digest md5_digest;
155 std::string user_sid_ascii(UTF16ToASCII(user_sid)); 155 std::string user_sid_ascii(base::UTF16ToASCII(user_sid));
156 base::MD5Sum(user_sid_ascii.c_str(), user_sid_ascii.length(), &md5_digest); 156 base::MD5Sum(user_sid_ascii.c_str(), user_sid_ascii.length(), &md5_digest);
157 const base::string16 base32_md5( 157 const base::string16 base32_md5(
158 ShellUtil::ByteArrayToBase32(md5_digest.a, arraysize(md5_digest.a))); 158 ShellUtil::ByteArrayToBase32(md5_digest.a, arraysize(md5_digest.a)));
159 // The value returned by the base32 algorithm above must never change and 159 // The value returned by the base32 algorithm above must never change and
160 // must always be 26 characters long (i.e. if someone ever moves this to 160 // must always be 26 characters long (i.e. if someone ever moves this to
161 // base and implements the full base32 algorithm (i.e. with appended '=' 161 // base and implements the full base32 algorithm (i.e. with appended '='
162 // signs in the output), they must provide a flag to allow this method to 162 // signs in the output), they must provide a flag to allow this method to
163 // still request the output with no appended '=' signs). 163 // still request the output with no appended '=' signs).
164 DCHECK_EQ(base32_md5.length(), 26U); 164 DCHECK_EQ(base32_md5.length(), 26U);
165 suffix_.reserve(base32_md5.length() + 1); 165 suffix_.reserve(base32_md5.length() + 1);
(...skipping 2098 matching lines...) Expand 10 before | Expand all | Expand 10 after
2264 // are any left...). 2264 // are any left...).
2265 if (free_bits >= 8 && next_byte_index < size) { 2265 if (free_bits >= 8 && next_byte_index < size) {
2266 free_bits -= 8; 2266 free_bits -= 8;
2267 bit_stream += bytes[next_byte_index++] << free_bits; 2267 bit_stream += bytes[next_byte_index++] << free_bits;
2268 } 2268 }
2269 } 2269 }
2270 2270
2271 DCHECK_EQ(ret.length(), encoded_length); 2271 DCHECK_EQ(ret.length(), encoded_length);
2272 return ret; 2272 return ret;
2273 } 2273 }
OLDNEW
« no previous file with comments | « chrome/installer/util/move_tree_work_item_unittest.cc ('k') | chrome/installer/util/user_experiment.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698