| OLD | NEW |
| 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/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/chromeos/login/default_user_images.h" | 10 #include "chrome/browser/chromeos/login/default_user_images.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 explicit PublicAccountUser(const std::string& email); | 104 explicit PublicAccountUser(const std::string& email); |
| 105 virtual ~PublicAccountUser(); | 105 virtual ~PublicAccountUser(); |
| 106 | 106 |
| 107 // Overridden from User: | 107 // Overridden from User: |
| 108 virtual UserType GetType() const OVERRIDE; | 108 virtual UserType GetType() const OVERRIDE; |
| 109 | 109 |
| 110 private: | 110 private: |
| 111 DISALLOW_COPY_AND_ASSIGN(PublicAccountUser); | 111 DISALLOW_COPY_AND_ASSIGN(PublicAccountUser); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 UserCredentials::UserCredentials() { |
| 115 } |
| 116 |
| 117 UserCredentials::UserCredentials(const std::string& username, |
| 118 const std::string& password, |
| 119 const std::string& auth_code) |
| 120 : username(username), |
| 121 password(password), |
| 122 auth_code(auth_code) { |
| 123 } |
| 124 |
| 125 bool UserCredentials::operator==(const UserCredentials& cred) const { |
| 126 return cred.username == username && |
| 127 cred.password == password && |
| 128 cred.auth_code == auth_code; |
| 129 } |
| 130 |
| 114 string16 User::GetDisplayName() const { | 131 string16 User::GetDisplayName() const { |
| 115 // Fallback to the email account name in case display name haven't been set. | 132 // Fallback to the email account name in case display name haven't been set. |
| 116 return display_name_.empty() ? | 133 return display_name_.empty() ? |
| 117 UTF8ToUTF16(GetAccountName(true)) : | 134 UTF8ToUTF16(GetAccountName(true)) : |
| 118 display_name_; | 135 display_name_; |
| 119 } | 136 } |
| 120 | 137 |
| 121 std::string User::GetAccountName(bool use_display_email) const { | 138 std::string User::GetAccountName(bool use_display_email) const { |
| 122 if (use_display_email && !display_email_.empty()) | 139 if (use_display_email && !display_email_.empty()) |
| 123 return GetUserName(display_email_); | 140 return GetUserName(display_email_); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 PublicAccountUser::PublicAccountUser(const std::string& email) : User(email) { | 275 PublicAccountUser::PublicAccountUser(const std::string& email) : User(email) { |
| 259 } | 276 } |
| 260 | 277 |
| 261 PublicAccountUser::~PublicAccountUser() {} | 278 PublicAccountUser::~PublicAccountUser() {} |
| 262 | 279 |
| 263 User::UserType PublicAccountUser::GetType() const { | 280 User::UserType PublicAccountUser::GetType() const { |
| 264 return USER_TYPE_PUBLIC_ACCOUNT; | 281 return USER_TYPE_PUBLIC_ACCOUNT; |
| 265 } | 282 } |
| 266 | 283 |
| 267 } // namespace chromeos | 284 } // namespace chromeos |
| OLD | NEW |