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

Side by Side Diff: chrome/browser/chromeos/login/user.cc

Issue 145073003: Indicate which authentication flow was used in UserContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Speculative fix for telemetry. Created 6 years, 11 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 #include "chrome/browser/chromeos/login/user.h" 5 #include "chrome/browser/chromeos/login/user.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 explicit PublicAccountUser(const std::string& email); 101 explicit PublicAccountUser(const std::string& email);
102 virtual ~PublicAccountUser(); 102 virtual ~PublicAccountUser();
103 103
104 // Overridden from User: 104 // Overridden from User:
105 virtual UserType GetType() const OVERRIDE; 105 virtual UserType GetType() const OVERRIDE;
106 106
107 private: 107 private:
108 DISALLOW_COPY_AND_ASSIGN(PublicAccountUser); 108 DISALLOW_COPY_AND_ASSIGN(PublicAccountUser);
109 }; 109 };
110 110
111 UserContext::UserContext() : using_oauth(true) { 111 UserContext::UserContext() : using_oauth(true), auth_flow(AUTH_FLOW_OFFLINE) {
112 } 112 }
113 113
114 UserContext::UserContext(const std::string& username, 114 UserContext::UserContext(const std::string& username,
115 const std::string& password, 115 const std::string& password,
116 const std::string& auth_code) 116 const std::string& auth_code)
117 : username(username), 117 : username(username),
118 password(password), 118 password(password),
119 auth_code(auth_code), 119 auth_code(auth_code),
120 using_oauth(true) { 120 using_oauth(true),
121 auth_flow(AUTH_FLOW_OFFLINE) {
121 } 122 }
122 123
123 UserContext::UserContext(const std::string& username, 124 UserContext::UserContext(const std::string& username,
124 const std::string& password, 125 const std::string& password,
125 const std::string& auth_code, 126 const std::string& auth_code,
126 const std::string& username_hash) 127 const std::string& username_hash)
127 : username(username), 128 : username(username),
128 password(password), 129 password(password),
129 auth_code(auth_code), 130 auth_code(auth_code),
130 username_hash(username_hash), 131 username_hash(username_hash),
131 using_oauth(true) { 132 using_oauth(true),
133 auth_flow(AUTH_FLOW_OFFLINE) {
132 } 134 }
133 135
134 UserContext::UserContext(const std::string& username, 136 UserContext::UserContext(const std::string& username,
135 const std::string& password, 137 const std::string& password,
136 const std::string& auth_code, 138 const std::string& auth_code,
137 const std::string& username_hash, 139 const std::string& username_hash,
138 bool using_oauth) 140 bool using_oauth,
141 AuthFlow auth_flow)
139 : username(username), 142 : username(username),
140 password(password), 143 password(password),
141 auth_code(auth_code), 144 auth_code(auth_code),
142 username_hash(username_hash), 145 username_hash(username_hash),
143 using_oauth(using_oauth) { 146 using_oauth(using_oauth),
147 auth_flow(auth_flow) {
144 } 148 }
145 149
146 UserContext::~UserContext() { 150 UserContext::~UserContext() {
147 } 151 }
148 152
149 bool UserContext::operator==(const UserContext& context) const { 153 bool UserContext::operator==(const UserContext& context) const {
150 return context.username == username && 154 return context.username == username &&
151 context.password == password && 155 context.password == password &&
152 context.auth_code == auth_code && 156 context.auth_code == auth_code &&
153 context.username_hash == username_hash && 157 context.username_hash == username_hash &&
154 context.using_oauth == using_oauth; 158 context.using_oauth == using_oauth &&
159 context.auth_flow == auth_flow;
155 } 160 }
156 161
157 base::string16 User::GetDisplayName() const { 162 base::string16 User::GetDisplayName() const {
158 // Fallback to the email account name in case display name haven't been set. 163 // Fallback to the email account name in case display name haven't been set.
159 return display_name_.empty() ? 164 return display_name_.empty() ?
160 base::UTF8ToUTF16(GetAccountName(true)) : 165 base::UTF8ToUTF16(GetAccountName(true)) :
161 display_name_; 166 display_name_;
162 } 167 }
163 168
164 std::string User::GetAccountName(bool use_display_email) const { 169 std::string User::GetAccountName(bool use_display_email) const {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 case USER_TYPE_LOCALLY_MANAGED: 350 case USER_TYPE_LOCALLY_MANAGED:
346 case USER_TYPE_KIOSK_APP: 351 case USER_TYPE_KIOSK_APP:
347 return false; 352 return false;
348 default: 353 default:
349 NOTREACHED(); 354 NOTREACHED();
350 } 355 }
351 return false; 356 return false;
352 } 357 }
353 358
354 } // namespace chromeos 359 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user.h ('k') | chrome/browser/chromeos/login/user_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698