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

Side by Side Diff: chrome/browser/chromeos/login/easy_unlock/bootstrap_user_context_initializer.cc

Issue 1223983002: Move WriteInto to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chromeos/login/easy_unlock/bootstrap_user_context_initi alizer.h" 5 #include "chrome/browser/chromeos/login/easy_unlock/bootstrap_user_context_initi alizer.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 return; 116 return;
117 } 117 }
118 118
119 user_context_.SetKey(Key(key_secret)); 119 user_context_.SetKey(Key(key_secret));
120 user_context_.GetKey()->SetLabel(key_label); 120 user_context_.GetKey()->SetLabel(key_label);
121 Notify(true); 121 Notify(true);
122 } 122 }
123 123
124 void BootstrapUserContextInitializer::CreateRandomKey() { 124 void BootstrapUserContextInitializer::CreateRandomKey() {
125 std::string random_initial_key; 125 std::string random_initial_key;
126 crypto::RandBytes(WriteInto(&random_initial_key, kUserKeyByteSize + 1), 126 crypto::RandBytes(base::WriteInto(&random_initial_key, kUserKeyByteSize + 1),
127 kUserKeyByteSize); 127 kUserKeyByteSize);
128 user_context_.SetKey(Key(random_initial_key)); 128 user_context_.SetKey(Key(random_initial_key));
129 random_key_used_ = true; 129 random_key_used_ = true;
130 Notify(true); 130 Notify(true);
131 } 131 }
132 132
133 void BootstrapUserContextInitializer::Notify(bool success) { 133 void BootstrapUserContextInitializer::Notify(bool success) {
134 if (complete_callback_for_testing_) 134 if (complete_callback_for_testing_)
135 complete_callback_for_testing_->Run(success, user_context_); 135 complete_callback_for_testing_->Run(success, user_context_);
136 136
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 EasyUnlockService::Get(ProfileHelper::GetSigninProfile()); 202 EasyUnlockService::Get(ProfileHelper::GetSigninProfile());
203 service->RemoveObserver(this); 203 service->RemoveObserver(this);
204 204
205 service->AttemptAuth( 205 service->AttemptAuth(
206 user_context_.GetUserID(), 206 user_context_.GetUserID(),
207 base::Bind(&BootstrapUserContextInitializer::OnEasyUnlockAuthenticated, 207 base::Bind(&BootstrapUserContextInitializer::OnEasyUnlockAuthenticated,
208 weak_ptr_factory_.GetWeakPtr())); 208 weak_ptr_factory_.GetWeakPtr()));
209 } 209 }
210 210
211 } // namespace chromeos 211 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698