OLD | NEW |
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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 explicit KioskAppUser(const AccountId& kiosk_app_account_id); | 90 explicit KioskAppUser(const AccountId& kiosk_app_account_id); |
91 ~KioskAppUser() override; | 91 ~KioskAppUser() override; |
92 | 92 |
93 // Overridden from User: | 93 // Overridden from User: |
94 UserType GetType() const override; | 94 UserType GetType() const override; |
95 | 95 |
96 private: | 96 private: |
97 DISALLOW_COPY_AND_ASSIGN(KioskAppUser); | 97 DISALLOW_COPY_AND_ASSIGN(KioskAppUser); |
98 }; | 98 }; |
99 | 99 |
| 100 class ArcKioskAppUser : public DeviceLocalAccountUserBase { |
| 101 public: |
| 102 explicit ArcKioskAppUser(const AccountId& arc_kiosk_account_id); |
| 103 ~ArcKioskAppUser() override; |
| 104 |
| 105 // Overridden from User: |
| 106 UserType GetType() const override; |
| 107 |
| 108 private: |
| 109 DISALLOW_COPY_AND_ASSIGN(ArcKioskAppUser); |
| 110 }; |
| 111 |
100 class SupervisedUser : public User { | 112 class SupervisedUser : public User { |
101 public: | 113 public: |
102 explicit SupervisedUser(const AccountId& account_id); | 114 explicit SupervisedUser(const AccountId& account_id); |
103 ~SupervisedUser() override; | 115 ~SupervisedUser() override; |
104 | 116 |
105 // Overridden from User: | 117 // Overridden from User: |
106 UserType GetType() const override; | 118 UserType GetType() const override; |
107 std::string display_email() const override; | 119 std::string display_email() const override; |
108 | 120 |
109 private: | 121 private: |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 } | 231 } |
220 | 232 |
221 User* User::CreateGuestUser(const AccountId& guest_account_id) { | 233 User* User::CreateGuestUser(const AccountId& guest_account_id) { |
222 return new GuestUser(guest_account_id); | 234 return new GuestUser(guest_account_id); |
223 } | 235 } |
224 | 236 |
225 User* User::CreateKioskAppUser(const AccountId& kiosk_app_account_id) { | 237 User* User::CreateKioskAppUser(const AccountId& kiosk_app_account_id) { |
226 return new KioskAppUser(kiosk_app_account_id); | 238 return new KioskAppUser(kiosk_app_account_id); |
227 } | 239 } |
228 | 240 |
| 241 User* User::CreateArcKioskAppUser(const AccountId& arc_kiosk_account_id) { |
| 242 return new ArcKioskAppUser(arc_kiosk_account_id); |
| 243 } |
| 244 |
229 User* User::CreateSupervisedUser(const AccountId& account_id) { | 245 User* User::CreateSupervisedUser(const AccountId& account_id) { |
230 return new SupervisedUser(account_id); | 246 return new SupervisedUser(account_id); |
231 } | 247 } |
232 | 248 |
233 User* User::CreatePublicAccountUser(const AccountId& account_id) { | 249 User* User::CreatePublicAccountUser(const AccountId& account_id) { |
234 return new PublicAccountUser(account_id); | 250 return new PublicAccountUser(account_id); |
235 } | 251 } |
236 | 252 |
237 void User::SetAccountLocale(const std::string& resolved_account_locale) { | 253 void User::SetAccountLocale(const std::string& resolved_account_locale) { |
238 account_locale_.reset(new std::string(resolved_account_locale)); | 254 account_locale_.reset(new std::string(resolved_account_locale)); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 set_display_email(kiosk_app_account_id.GetUserEmail()); | 335 set_display_email(kiosk_app_account_id.GetUserEmail()); |
320 } | 336 } |
321 | 337 |
322 KioskAppUser::~KioskAppUser() { | 338 KioskAppUser::~KioskAppUser() { |
323 } | 339 } |
324 | 340 |
325 UserType KioskAppUser::GetType() const { | 341 UserType KioskAppUser::GetType() const { |
326 return user_manager::USER_TYPE_KIOSK_APP; | 342 return user_manager::USER_TYPE_KIOSK_APP; |
327 } | 343 } |
328 | 344 |
| 345 ArcKioskAppUser::ArcKioskAppUser(const AccountId& arc_kiosk_account_id) |
| 346 : DeviceLocalAccountUserBase(arc_kiosk_account_id) { |
| 347 set_display_email(arc_kiosk_account_id.GetUserEmail()); |
| 348 } |
| 349 |
| 350 ArcKioskAppUser::~ArcKioskAppUser() { |
| 351 } |
| 352 |
| 353 UserType ArcKioskAppUser::GetType() const { |
| 354 return user_manager::USER_TYPE_ARC_KIOSK_APP; |
| 355 } |
| 356 |
329 SupervisedUser::SupervisedUser(const AccountId& account_id) : User(account_id) { | 357 SupervisedUser::SupervisedUser(const AccountId& account_id) : User(account_id) { |
330 set_can_lock(true); | 358 set_can_lock(true); |
331 } | 359 } |
332 | 360 |
333 SupervisedUser::~SupervisedUser() { | 361 SupervisedUser::~SupervisedUser() { |
334 } | 362 } |
335 | 363 |
336 UserType SupervisedUser::GetType() const { | 364 UserType SupervisedUser::GetType() const { |
337 return user_manager::USER_TYPE_SUPERVISED; | 365 return user_manager::USER_TYPE_SUPERVISED; |
338 } | 366 } |
339 | 367 |
340 std::string SupervisedUser::display_email() const { | 368 std::string SupervisedUser::display_email() const { |
341 return base::UTF16ToUTF8(display_name()); | 369 return base::UTF16ToUTF8(display_name()); |
342 } | 370 } |
343 | 371 |
344 PublicAccountUser::PublicAccountUser(const AccountId& account_id) | 372 PublicAccountUser::PublicAccountUser(const AccountId& account_id) |
345 : DeviceLocalAccountUserBase(account_id) {} | 373 : DeviceLocalAccountUserBase(account_id) {} |
346 | 374 |
347 PublicAccountUser::~PublicAccountUser() { | 375 PublicAccountUser::~PublicAccountUser() { |
348 } | 376 } |
349 | 377 |
350 UserType PublicAccountUser::GetType() const { | 378 UserType PublicAccountUser::GetType() const { |
351 return user_manager::USER_TYPE_PUBLIC_ACCOUNT; | 379 return user_manager::USER_TYPE_PUBLIC_ACCOUNT; |
352 } | 380 } |
353 | 381 |
354 bool User::has_gaia_account() const { | 382 bool User::has_gaia_account() const { |
355 static_assert(user_manager::NUM_USER_TYPES == 7, | 383 static_assert(user_manager::NUM_USER_TYPES == 8, |
356 "NUM_USER_TYPES should equal 7"); | 384 "NUM_USER_TYPES should equal 8"); |
357 switch (GetType()) { | 385 switch (GetType()) { |
358 case user_manager::USER_TYPE_REGULAR: | 386 case user_manager::USER_TYPE_REGULAR: |
359 case user_manager::USER_TYPE_CHILD: | 387 case user_manager::USER_TYPE_CHILD: |
360 return true; | 388 return true; |
361 case user_manager::USER_TYPE_GUEST: | 389 case user_manager::USER_TYPE_GUEST: |
362 case user_manager::USER_TYPE_PUBLIC_ACCOUNT: | 390 case user_manager::USER_TYPE_PUBLIC_ACCOUNT: |
363 case user_manager::USER_TYPE_SUPERVISED: | 391 case user_manager::USER_TYPE_SUPERVISED: |
364 case user_manager::USER_TYPE_KIOSK_APP: | 392 case user_manager::USER_TYPE_KIOSK_APP: |
| 393 case user_manager::USER_TYPE_ARC_KIOSK_APP: |
365 return false; | 394 return false; |
366 default: | 395 default: |
367 NOTREACHED(); | 396 NOTREACHED(); |
368 } | 397 } |
369 return false; | 398 return false; |
370 } | 399 } |
371 | 400 |
372 } // namespace user_manager | 401 } // namespace user_manager |
OLD | NEW |