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

Side by Side Diff: chrome/browser/chromeos/login/screens/user_selection_screen.cc

Issue 2885933003: arc: Consolidate IsArcAllowedForUser logic (Closed)
Patch Set: rebase & address #4 comments Created 3 years, 7 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 "chrome/browser/chromeos/login/screens/user_selection_screen.h" 5 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 // Returns true if dircrypto migration check should be performed. 145 // Returns true if dircrypto migration check should be performed.
146 bool ShouldCheckNeedDircryptoMigration() { 146 bool ShouldCheckNeedDircryptoMigration() {
147 return !base::CommandLine::ForCurrentProcess()->HasSwitch( 147 return !base::CommandLine::ForCurrentProcess()->HasSwitch(
148 switches::kDisableEncryptionMigration) && 148 switches::kDisableEncryptionMigration) &&
149 arc::IsArcAvailable(); 149 arc::IsArcAvailable();
150 } 150 }
151 151
152 // Returns true if the user can run ARC based on the user type. 152 // Returns true if the user can run ARC based on the user type.
153 bool IsUserAllowedForARC(const AccountId& account_id) { 153 bool IsUserAllowedForARC(const AccountId& account_id) {
154 if (!user_manager::UserManager::IsInitialized()) 154 return user_manager::UserManager::IsInitialized() &&
155 return false; 155 arc::IsArcAllowedForUser(
156 156 user_manager::UserManager::Get()->FindUser(account_id));
hidehiko 2017/05/23 07:23:26 Clarification: Just in case, this change make beha
xiyuan 2017/05/24 19:22:56 It is okay because the function is called for user
157 const user_manager::User* user =
158 user_manager::UserManager::Get()->FindUser(account_id);
159 if (!user)
160 return false;
161
162 return user->HasGaiaAccount() || user->IsActiveDirectoryUser();
163 } 157 }
164 158
165 } // namespace 159 } // namespace
166 160
167 // Helper class to call cryptohome to check whether a user needs dircrypto 161 // Helper class to call cryptohome to check whether a user needs dircrypto
168 // migration. The check results are cached to limit calls to cryptohome. 162 // migration. The check results are cached to limit calls to cryptohome.
169 class UserSelectionScreen::DircryptoMigrationChecker { 163 class UserSelectionScreen::DircryptoMigrationChecker {
170 public: 164 public:
171 explicit DircryptoMigrationChecker(UserSelectionScreen* owner) 165 explicit DircryptoMigrationChecker(UserSelectionScreen* owner)
172 : owner_(owner), weak_ptr_factory_(this) {} 166 : owner_(owner), weak_ptr_factory_(this) {}
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 // The user profile should exist if and only if this is the lock screen. 706 // The user profile should exist if and only if this is the lock screen.
713 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); 707 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN);
714 708
715 if (!profile) 709 if (!profile)
716 profile = profile_helper->GetSigninProfile(); 710 profile = profile_helper->GetSigninProfile();
717 711
718 return EasyUnlockService::Get(profile); 712 return EasyUnlockService::Get(profile);
719 } 713 }
720 714
721 } // namespace chromeos 715 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698