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

Side by Side Diff: chrome/browser/supervised_user/child_accounts/child_account_service.cc

Issue 866763002: User class update made independent of profile state update. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resetting user status to same as existing one prevented. Created 5 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
« no previous file with comments | « no previous file | components/user_manager/user_manager_base.cc » ('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 "chrome/browser/supervised_user/child_accounts/child_account_service.h" 5 #include "chrome/browser/supervised_user/child_accounts/child_account_service.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 }; 67 };
68 68
69 ChildAccountService::ChildAccountService(Profile* profile) 69 ChildAccountService::ChildAccountService(Profile* profile)
70 : profile_(profile), active_(false), 70 : profile_(profile), active_(false),
71 flag_fetch_backoff_(&kFlagFetchBackoffPolicy), 71 flag_fetch_backoff_(&kFlagFetchBackoffPolicy),
72 weak_ptr_factory_(this) {} 72 weak_ptr_factory_(this) {}
73 73
74 ChildAccountService::~ChildAccountService() {} 74 ChildAccountService::~ChildAccountService() {}
75 75
76 void ChildAccountService::SetIsChildAccount(bool is_child_account) { 76 void ChildAccountService::SetIsChildAccount(bool is_child_account) {
77 PropagateChildStatusToUser(is_child_account);
77 if (profile_->IsChild() == is_child_account) 78 if (profile_->IsChild() == is_child_account)
78 return; 79 return;
79 80
80 if (is_child_account) { 81 if (is_child_account) {
81 profile_->GetPrefs()->SetString(prefs::kSupervisedUserId, 82 profile_->GetPrefs()->SetString(prefs::kSupervisedUserId,
82 supervised_users::kChildAccountSUID); 83 supervised_users::kChildAccountSUID);
83 } else { 84 } else {
84 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserId); 85 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserId);
85 } 86 }
86 PropagateChildStatusToUser(is_child_account);
87 } 87 }
88 88
89 void ChildAccountService::Init() { 89 void ChildAccountService::Init() {
90 SigninManagerFactory::GetForProfile(profile_)->AddObserver(this); 90 SigninManagerFactory::GetForProfile(profile_)->AddObserver(this);
91 SupervisedUserServiceFactory::GetForProfile(profile_)->SetDelegate(this); 91 SupervisedUserServiceFactory::GetForProfile(profile_)->SetDelegate(this);
92 92
93 PropagateChildStatusToUser(profile_->IsChild()); 93 PropagateChildStatusToUser(profile_->IsChild());
94 94
95 // If we're already signed in, fetch the flag again just to be sure. 95 // If we're already signed in, fetch the flag again just to be sure.
96 // (Previously, the browser might have been closed before we got the flag. 96 // (Previously, the browser might have been closed before we got the flag.
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 command_line->AppendSwitch(switches::kEnableSupervisedUserBlacklist); 360 command_line->AppendSwitch(switches::kEnableSupervisedUserBlacklist);
361 361
362 // Query-based filtering also defaults to enabled. 362 // Query-based filtering also defaults to enabled.
363 bool has_enable_safesites = 363 bool has_enable_safesites =
364 command_line->HasSwitch(switches::kEnableSupervisedUserSafeSites); 364 command_line->HasSwitch(switches::kEnableSupervisedUserSafeSites);
365 bool has_disable_safesites = 365 bool has_disable_safesites =
366 command_line->HasSwitch(switches::kDisableSupervisedUserSafeSites); 366 command_line->HasSwitch(switches::kDisableSupervisedUserSafeSites);
367 if (!has_enable_safesites && !has_disable_safesites) 367 if (!has_enable_safesites && !has_disable_safesites)
368 command_line->AppendSwitch(switches::kEnableSupervisedUserSafeSites); 368 command_line->AppendSwitch(switches::kEnableSupervisedUserSafeSites);
369 } 369 }
OLDNEW
« no previous file with comments | « no previous file | components/user_manager/user_manager_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698