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

Side by Side Diff: components/user_manager/user.cc

Issue 608283003: Remove retail mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 "components/user_manager/user.h" 5 #include "components/user_manager/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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 // Overridden from User: 90 // Overridden from User:
91 virtual UserType GetType() const OVERRIDE; 91 virtual UserType GetType() const OVERRIDE;
92 virtual bool IsSupervised() const OVERRIDE; 92 virtual bool IsSupervised() const OVERRIDE;
93 virtual std::string display_email() const OVERRIDE; 93 virtual std::string display_email() const OVERRIDE;
94 94
95 private: 95 private:
96 DISALLOW_COPY_AND_ASSIGN(SupervisedUser); 96 DISALLOW_COPY_AND_ASSIGN(SupervisedUser);
97 }; 97 };
98 98
99 class RetailModeUser : public User {
100 public:
101 RetailModeUser();
102 virtual ~RetailModeUser();
103
104 // Overridden from User:
105 virtual UserType GetType() const OVERRIDE;
106
107 private:
108 DISALLOW_COPY_AND_ASSIGN(RetailModeUser);
109 };
110
111 class PublicAccountUser : public User { 99 class PublicAccountUser : public User {
112 public: 100 public:
113 explicit PublicAccountUser(const std::string& email); 101 explicit PublicAccountUser(const std::string& email);
114 virtual ~PublicAccountUser(); 102 virtual ~PublicAccountUser();
115 103
116 // Overridden from User: 104 // Overridden from User:
117 virtual UserType GetType() const OVERRIDE; 105 virtual UserType GetType() const OVERRIDE;
118 106
119 private: 107 private:
120 DISALLOW_COPY_AND_ASSIGN(PublicAccountUser); 108 DISALLOW_COPY_AND_ASSIGN(PublicAccountUser);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } 174 }
187 175
188 User* User::CreateKioskAppUser(const std::string& kiosk_app_username) { 176 User* User::CreateKioskAppUser(const std::string& kiosk_app_username) {
189 return new KioskAppUser(kiosk_app_username); 177 return new KioskAppUser(kiosk_app_username);
190 } 178 }
191 179
192 User* User::CreateSupervisedUser(const std::string& username) { 180 User* User::CreateSupervisedUser(const std::string& username) {
193 return new SupervisedUser(username); 181 return new SupervisedUser(username);
194 } 182 }
195 183
196 User* User::CreateRetailModeUser() {
197 return new RetailModeUser;
198 }
199
200 User* User::CreatePublicAccountUser(const std::string& email) { 184 User* User::CreatePublicAccountUser(const std::string& email) {
201 return new PublicAccountUser(email); 185 return new PublicAccountUser(email);
202 } 186 }
203 187
204 User::User(const std::string& email) 188 User::User(const std::string& email)
205 : email_(email), 189 : email_(email),
206 oauth_token_status_(OAUTH_TOKEN_STATUS_UNKNOWN), 190 oauth_token_status_(OAUTH_TOKEN_STATUS_UNKNOWN),
207 force_online_signin_(false), 191 force_online_signin_(false),
208 image_index_(USER_IMAGE_INVALID), 192 image_index_(USER_IMAGE_INVALID),
209 image_is_stub_(false), 193 image_is_stub_(false),
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 } 278 }
295 279
296 std::string SupervisedUser::display_email() const { 280 std::string SupervisedUser::display_email() const {
297 return base::UTF16ToUTF8(display_name()); 281 return base::UTF16ToUTF8(display_name());
298 } 282 }
299 283
300 bool SupervisedUser::IsSupervised() const { 284 bool SupervisedUser::IsSupervised() const {
301 return true; 285 return true;
302 } 286 }
303 287
304 RetailModeUser::RetailModeUser() : User(chromeos::login::kRetailModeUserName) {
305 set_display_email(std::string());
306 }
307
308 RetailModeUser::~RetailModeUser() {
309 }
310
311 UserType RetailModeUser::GetType() const {
312 return user_manager::USER_TYPE_RETAIL_MODE;
313 }
314
315 PublicAccountUser::PublicAccountUser(const std::string& email) : User(email) { 288 PublicAccountUser::PublicAccountUser(const std::string& email) : User(email) {
316 } 289 }
317 290
318 PublicAccountUser::~PublicAccountUser() { 291 PublicAccountUser::~PublicAccountUser() {
319 } 292 }
320 293
321 UserType PublicAccountUser::GetType() const { 294 UserType PublicAccountUser::GetType() const {
322 return user_manager::USER_TYPE_PUBLIC_ACCOUNT; 295 return user_manager::USER_TYPE_PUBLIC_ACCOUNT;
323 } 296 }
324 297
325 bool User::has_gaia_account() const { 298 bool User::has_gaia_account() const {
326 COMPILE_ASSERT(user_manager::NUM_USER_TYPES == 6, num_user_types_unexpected); 299 COMPILE_ASSERT(user_manager::NUM_USER_TYPES == 5, num_user_types_unexpected);
327 switch (GetType()) { 300 switch (GetType()) {
328 case user_manager::USER_TYPE_REGULAR: 301 case user_manager::USER_TYPE_REGULAR:
329 return true; 302 return true;
330 case user_manager::USER_TYPE_GUEST: 303 case user_manager::USER_TYPE_GUEST:
331 case user_manager::USER_TYPE_RETAIL_MODE:
332 case user_manager::USER_TYPE_PUBLIC_ACCOUNT: 304 case user_manager::USER_TYPE_PUBLIC_ACCOUNT:
333 case user_manager::USER_TYPE_SUPERVISED: 305 case user_manager::USER_TYPE_SUPERVISED:
334 case user_manager::USER_TYPE_KIOSK_APP: 306 case user_manager::USER_TYPE_KIOSK_APP:
335 return false; 307 return false;
336 default: 308 default:
337 NOTREACHED(); 309 NOTREACHED();
338 } 310 }
339 return false; 311 return false;
340 } 312 }
341 313
342 } // namespace user_manager 314 } // namespace user_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698