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

Unified Diff: chrome/installer/setup/user_hive_visitor.cc

Issue 2017123002: Adds a base32 component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Migrates installer/setup/user_hive_visitor.cc to use base32 component Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/installer/setup/DEPS ('k') | chrome/installer/util/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/setup/user_hive_visitor.cc
diff --git a/chrome/installer/setup/user_hive_visitor.cc b/chrome/installer/setup/user_hive_visitor.cc
index ca2d7fe9c1cedf6f71b3a214dbd9f71be1600813..e26f7c904fc67c3d5535eaff20aa0cc8bf4110e3 100644
--- a/chrome/installer/setup/user_hive_visitor.cc
+++ b/chrome/installer/setup/user_hive_visitor.cc
@@ -4,6 +4,7 @@
#include "chrome/installer/setup/user_hive_visitor.h"
+#include <string>
#include <utility>
#include "base/bind.h"
@@ -15,9 +16,10 @@
#include "base/rand_util.h"
#include "base/strings/string16.h"
#include "base/strings/string_piece.h"
+#include "base/strings/utf_string_conversions.h"
#include "base/win/registry.h"
#include "chrome/installer/setup/setup_util.h"
-#include "chrome/installer/util/shell_util.h"
+#include "components/base32/base32.h"
namespace installer {
@@ -49,9 +51,9 @@ class ScopedUserHive {
ScopedUserHive::ScopedUserHive(const base::FilePath& hive_file) {
// Generate a random name for the key at which the file will be loaded.
- uint8_t buffer[10] = {};
- base::RandBytes(&buffer[0], arraysize(buffer));
- subkey_name_ = ShellUtil::ByteArrayToBase32(&buffer[0], arraysize(buffer));
+ std::string buffer = base::RandBytesAsString(10);
+ subkey_name_ = base::ASCIIToUTF16(
+ base32::Base32Encode(buffer, base32::Base32EncodePolicy::OMIT_PADDING));
DCHECK_EQ(16U, subkey_name_.size());
LONG result = ::RegLoadKey(HKEY_LOCAL_MACHINE, subkey_name_.c_str(),
« no previous file with comments | « chrome/installer/setup/DEPS ('k') | chrome/installer/util/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698