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

Side by Side Diff: chrome/browser/chromeos/arc/arc_util.cc

Issue 2885933003: arc: Consolidate IsArcAllowedForUser logic (Closed)
Patch Set: add comment for arc kiosk user check 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/screens/user_selection_screen.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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/arc/arc_util.h" 5 #include "chrome/browser/chromeos/arc/arc_util.h"
6 6
7 #include <linux/magic.h> 7 #include <linux/magic.h>
8 #include <sys/statfs.h> 8 #include <sys/statfs.h>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 VLOG(1) << "Supervised users are not supported in ARC."; 121 VLOG(1) << "Supervised users are not supported in ARC.";
122 return false; 122 return false;
123 } 123 }
124 124
125 // Play Store requires an appropriate application install mechanism. Normal 125 // Play Store requires an appropriate application install mechanism. Normal
126 // users do this through GAIA, but Kiosk and Active Directory users use 126 // users do this through GAIA, but Kiosk and Active Directory users use
127 // different application install mechanism. ARC is not allowed otherwise 127 // different application install mechanism. ARC is not allowed otherwise
128 // (e.g. in public sessions). cf) crbug.com/605545 128 // (e.g. in public sessions). cf) crbug.com/605545
129 const user_manager::User* user = 129 const user_manager::User* user =
130 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); 130 chromeos::ProfileHelper::Get()->GetUserByProfile(profile);
131 const bool has_gaia_account = user && user->HasGaiaAccount(); 131 if (!IsArcAllowedForUser(user)) {
132 const bool is_active_directory_user = user && user->IsActiveDirectoryUser(); 132 VLOG(1) << "ARC is not allowed for the user.";
133 if (!has_gaia_account && !is_active_directory_user && !IsArcKioskMode()) {
134 VLOG(1) << "Users without GAIA or AD accounts are not supported in ARC.";
135 return false; 133 return false;
136 } 134 }
137 135
138 // Do not run ARC instance when supervised user is being created. 136 // Do not run ARC instance when supervised user is being created.
139 // Otherwise noisy notification may be displayed. 137 // Otherwise noisy notification may be displayed.
140 chromeos::UserFlow* user_flow = 138 chromeos::UserFlow* user_flow =
141 chromeos::ChromeUserManager::Get()->GetUserFlow(user->GetAccountId()); 139 chromeos::ChromeUserManager::Get()->GetUserFlow(user->GetAccountId());
142 if (!user_flow || !user_flow->CanStartArc()) { 140 if (!user_flow || !user_flow->CanStartArc()) {
143 VLOG(1) << "ARC is not allowed in the current user flow."; 141 VLOG(1) << "ARC is not allowed in the current user flow.";
144 return false; 142 return false;
145 } 143 }
146 144
147 // Do not allow for Ephemeral data user. cf) b/26402681
148 if (user_manager::UserManager::Get()
149 ->IsCurrentUserCryptohomeDataEphemeral()) {
150 VLOG(1) << "Users with ephemeral data are not supported in ARC.";
151 return false;
152 }
153
154 return true; 145 return true;
155 } 146 }
156 147
157 bool IsArcCompatibleFileSystemUsedForProfile(const Profile* profile) { 148 bool IsArcCompatibleFileSystemUsedForProfile(const Profile* profile) {
158 const user_manager::User* user = 149 const user_manager::User* user =
159 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); 150 chromeos::ProfileHelper::Get()->GetUserByProfile(profile);
160 151
161 // Returns false for profiles not associated with users (like sign-in profile) 152 // Returns false for profiles not associated with users (like sign-in profile)
162 if (!user) 153 if (!user)
163 return false; 154 return false;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 // Otherwise, check the underlying filesystem. 253 // Otherwise, check the underlying filesystem.
263 base::PostTaskWithTraitsAndReplyWithResult( 254 base::PostTaskWithTraitsAndReplyWithResult(
264 FROM_HERE, 255 FROM_HERE,
265 {base::MayBlock(), base::TaskPriority::USER_BLOCKING, 256 {base::MayBlock(), base::TaskPriority::USER_BLOCKING,
266 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, 257 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
267 base::Bind(&IsArcCompatibleFilesystem, profile_path), 258 base::Bind(&IsArcCompatibleFilesystem, profile_path),
268 base::Bind(&StoreCompatibilityCheckResult, account_id, callback)); 259 base::Bind(&StoreCompatibilityCheckResult, account_id, callback));
269 } 260 }
270 261
271 } // namespace arc 262 } // namespace arc
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/screens/user_selection_screen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698