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

Side by Side Diff: chromeos/login/auth/stub_authenticator.cc

Issue 1412813003: This CL replaces user_manager::UserID with AccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@468875--Chrome-OS-handles-deletion-of-Gmail-account-poorly--Create-AccountID-structure-part2--user_names
Patch Set: Rebased. Created 5 years, 2 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 "chromeos/login/auth/stub_authenticator.h" 5 #include "chromeos/login/auth/stub_authenticator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 FROM_HERE, base::Bind(&StubAuthenticator::OnAuthFailure, this, 50 FROM_HERE, base::Bind(&StubAuthenticator::OnAuthFailure, this,
51 AuthFailure::FromNetworkAuthFailure(error))); 51 AuthFailure::FromNetworkAuthFailure(error)));
52 } 52 }
53 53
54 void StubAuthenticator::AuthenticateToUnlock(const UserContext& user_context) { 54 void StubAuthenticator::AuthenticateToUnlock(const UserContext& user_context) {
55 AuthenticateToLogin(NULL /* not used */, user_context); 55 AuthenticateToLogin(NULL /* not used */, user_context);
56 } 56 }
57 57
58 void StubAuthenticator::LoginAsSupervisedUser(const UserContext& user_context) { 58 void StubAuthenticator::LoginAsSupervisedUser(const UserContext& user_context) {
59 UserContext new_user_context = user_context; 59 UserContext new_user_context = user_context;
60 new_user_context.SetUserIDHash(user_context.GetUserID() + kUserIdHashSuffix); 60 new_user_context.SetUserIDHash(user_context.GetUserID().GetUserEmail() +
61 kUserIdHashSuffix);
61 consumer_->OnAuthSuccess(new_user_context); 62 consumer_->OnAuthSuccess(new_user_context);
62 } 63 }
63 64
64 void StubAuthenticator::LoginOffTheRecord() { 65 void StubAuthenticator::LoginOffTheRecord() {
65 consumer_->OnOffTheRecordAuthSuccess(); 66 consumer_->OnOffTheRecordAuthSuccess();
66 } 67 }
67 68
68 void StubAuthenticator::LoginAsPublicSession(const UserContext& user_context) { 69 void StubAuthenticator::LoginAsPublicSession(const UserContext& user_context) {
69 UserContext logged_in_user_context = user_context; 70 UserContext logged_in_user_context = user_context;
70 logged_in_user_context.SetIsUsingOAuth(false); 71 logged_in_user_context.SetIsUsingOAuth(false);
71 logged_in_user_context.SetUserIDHash(logged_in_user_context.GetUserID() + 72 logged_in_user_context.SetUserIDHash(
72 kUserIdHashSuffix); 73 logged_in_user_context.GetUserID().GetUserEmail() + kUserIdHashSuffix);
73 consumer_->OnAuthSuccess(logged_in_user_context); 74 consumer_->OnAuthSuccess(logged_in_user_context);
74 } 75 }
75 76
76 void StubAuthenticator::LoginAsKioskAccount(const std::string& app_user_id, 77 void StubAuthenticator::LoginAsKioskAccount(const std::string& app_user_id,
77 bool use_guest_mount) { 78 bool use_guest_mount) {
78 UserContext user_context(expected_user_context_.GetUserID()); 79 UserContext user_context(expected_user_context_.GetUserID());
79 user_context.SetIsUsingOAuth(false); 80 user_context.SetIsUsingOAuth(false);
80 user_context.SetUserIDHash(expected_user_context_.GetUserID() + 81 user_context.SetUserIDHash(expected_user_context_.GetUserID().GetUserEmail() +
81 kUserIdHashSuffix); 82 kUserIdHashSuffix);
82 consumer_->OnAuthSuccess(user_context); 83 consumer_->OnAuthSuccess(user_context);
83 } 84 }
84 85
85 void StubAuthenticator::OnAuthSuccess() { 86 void StubAuthenticator::OnAuthSuccess() {
86 // If we want to be more like the real thing, we could save the user ID 87 // If we want to be more like the real thing, we could save the user ID
87 // in AuthenticateToLogin, but there's not much of a point. 88 // in AuthenticateToLogin, but there's not much of a point.
88 UserContext user_context(expected_user_context_); 89 UserContext user_context(expected_user_context_);
89 user_context.SetUserIDHash(expected_user_context_.GetUserID() + 90 user_context.SetUserIDHash(expected_user_context_.GetUserID().GetUserEmail() +
90 kUserIdHashSuffix); 91 kUserIdHashSuffix);
91 consumer_->OnAuthSuccess(user_context); 92 consumer_->OnAuthSuccess(user_context);
92 } 93 }
93 94
94 void StubAuthenticator::OnAuthFailure(const AuthFailure& failure) { 95 void StubAuthenticator::OnAuthFailure(const AuthFailure& failure) {
95 consumer_->OnAuthFailure(failure); 96 consumer_->OnAuthFailure(failure);
96 } 97 }
97 98
98 void StubAuthenticator::RecoverEncryptedData(const std::string& old_password) { 99 void StubAuthenticator::RecoverEncryptedData(const std::string& old_password) {
99 } 100 }
100 101
101 void StubAuthenticator::ResyncEncryptedData() { 102 void StubAuthenticator::ResyncEncryptedData() {
102 } 103 }
103 104
104 void StubAuthenticator::SetExpectedCredentials( 105 void StubAuthenticator::SetExpectedCredentials(
105 const UserContext& user_context) { 106 const UserContext& user_context) {
106 expected_user_context_ = user_context; 107 expected_user_context_ = user_context;
107 } 108 }
108 109
109 StubAuthenticator::~StubAuthenticator() { 110 StubAuthenticator::~StubAuthenticator() {
110 } 111 }
111 112
112 } // namespace chromeos 113 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698