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

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

Issue 575653002: Revert of ash: Add checks for supervised users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « components/user_manager/user.h ('k') | components/user_manager/user_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 10 matching lines...) Expand all
21 std::string GetUserName(const std::string& email) { 21 std::string GetUserName(const std::string& email) {
22 std::string::size_type i = email.find('@'); 22 std::string::size_type i = email.find('@');
23 if (i == 0 || i == std::string::npos) { 23 if (i == 0 || i == std::string::npos) {
24 return email; 24 return email;
25 } 25 }
26 return email.substr(0, i); 26 return email.substr(0, i);
27 } 27 }
28 28
29 } // namespace 29 } // namespace
30 30
31 bool User::IsSupervised() const {
32 return false;
33 }
34
35 void User::SetIsSupervised(bool is_supervised) {
36 VLOG(1) << "Ignoring SetIsSupervised call with param " << is_supervised;
37 }
38
39 class RegularUser : public User { 31 class RegularUser : public User {
40 public: 32 public:
41 explicit RegularUser(const std::string& email); 33 explicit RegularUser(const std::string& email);
42 virtual ~RegularUser(); 34 virtual ~RegularUser();
43 35
44 // Overridden from User: 36 // Overridden from User:
45 virtual UserType GetType() const OVERRIDE; 37 virtual UserType GetType() const OVERRIDE;
46 virtual bool CanSyncImage() const OVERRIDE; 38 virtual bool CanSyncImage() const OVERRIDE;
47 virtual void SetIsSupervised(bool is_supervised) OVERRIDE {
48 VLOG(1) << "Setting user is supervised to " << is_supervised;
49 is_supervised_ = is_supervised;
50 }
51 virtual bool IsSupervised() const OVERRIDE {
52 return is_supervised_;
53 }
54 39
55 private: 40 private:
56 bool is_supervised_;
57
58 DISALLOW_COPY_AND_ASSIGN(RegularUser); 41 DISALLOW_COPY_AND_ASSIGN(RegularUser);
59 }; 42 };
60 43
61 class GuestUser : public User { 44 class GuestUser : public User {
62 public: 45 public:
63 GuestUser(); 46 GuestUser();
64 virtual ~GuestUser(); 47 virtual ~GuestUser();
65 48
66 // Overridden from User: 49 // Overridden from User:
67 virtual UserType GetType() const OVERRIDE; 50 virtual UserType GetType() const OVERRIDE;
(...skipping 14 matching lines...) Expand all
82 DISALLOW_COPY_AND_ASSIGN(KioskAppUser); 65 DISALLOW_COPY_AND_ASSIGN(KioskAppUser);
83 }; 66 };
84 67
85 class SupervisedUser : public User { 68 class SupervisedUser : public User {
86 public: 69 public:
87 explicit SupervisedUser(const std::string& username); 70 explicit SupervisedUser(const std::string& username);
88 virtual ~SupervisedUser(); 71 virtual ~SupervisedUser();
89 72
90 // Overridden from User: 73 // Overridden from User:
91 virtual UserType GetType() const OVERRIDE; 74 virtual UserType GetType() const OVERRIDE;
92 virtual bool IsSupervised() const OVERRIDE;
93 virtual std::string display_email() const OVERRIDE; 75 virtual std::string display_email() const OVERRIDE;
94 76
95 private: 77 private:
96 DISALLOW_COPY_AND_ASSIGN(SupervisedUser); 78 DISALLOW_COPY_AND_ASSIGN(SupervisedUser);
97 }; 79 };
98 80
99 class RetailModeUser : public User { 81 class RetailModeUser : public User {
100 public: 82 public:
101 RetailModeUser(); 83 RetailModeUser();
102 virtual ~RetailModeUser(); 84 virtual ~RetailModeUser();
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } 271 }
290 272
291 UserType SupervisedUser::GetType() const { 273 UserType SupervisedUser::GetType() const {
292 return user_manager::USER_TYPE_SUPERVISED; 274 return user_manager::USER_TYPE_SUPERVISED;
293 } 275 }
294 276
295 std::string SupervisedUser::display_email() const { 277 std::string SupervisedUser::display_email() const {
296 return base::UTF16ToUTF8(display_name()); 278 return base::UTF16ToUTF8(display_name());
297 } 279 }
298 280
299 bool SupervisedUser::IsSupervised() const {
300 return true;
301 }
302
303 RetailModeUser::RetailModeUser() : User(chromeos::login::kRetailModeUserName) { 281 RetailModeUser::RetailModeUser() : User(chromeos::login::kRetailModeUserName) {
304 set_display_email(std::string()); 282 set_display_email(std::string());
305 } 283 }
306 284
307 RetailModeUser::~RetailModeUser() { 285 RetailModeUser::~RetailModeUser() {
308 } 286 }
309 287
310 UserType RetailModeUser::GetType() const { 288 UserType RetailModeUser::GetType() const {
311 return user_manager::USER_TYPE_RETAIL_MODE; 289 return user_manager::USER_TYPE_RETAIL_MODE;
312 } 290 }
(...skipping 19 matching lines...) Expand all
332 case user_manager::USER_TYPE_SUPERVISED: 310 case user_manager::USER_TYPE_SUPERVISED:
333 case user_manager::USER_TYPE_KIOSK_APP: 311 case user_manager::USER_TYPE_KIOSK_APP:
334 return false; 312 return false;
335 default: 313 default:
336 NOTREACHED(); 314 NOTREACHED();
337 } 315 }
338 return false; 316 return false;
339 } 317 }
340 318
341 } // namespace user_manager 319 } // namespace user_manager
OLDNEW
« no previous file with comments | « components/user_manager/user.h ('k') | components/user_manager/user_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698