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

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

Issue 2885933003: arc: Consolidate IsArcAllowedForUser logic (Closed)
Patch Set: fix typo 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 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) && !IsArcKioskMode()) {
132 const bool is_arc_active_directory_user =
133 user && user->IsActiveDirectoryUser() &&
134 IsArcAllowedForActiveDirectoryUsers();
135 if (!has_gaia_account && !is_arc_active_directory_user && !IsArcKioskMode()) {
136 VLOG(1) << "Users without GAIA accounts are not supported in ARC."; 132 VLOG(1) << "Users without GAIA accounts are not supported in ARC.";
137 return false; 133 return false;
138 } 134 }
139 135
140 // Do not run ARC instance when supervised user is being created. 136 // Do not run ARC instance when supervised user is being created.
141 // Otherwise noisy notification may be displayed. 137 // Otherwise noisy notification may be displayed.
142 chromeos::UserFlow* user_flow = 138 chromeos::UserFlow* user_flow =
143 chromeos::ChromeUserManager::Get()->GetUserFlow(user->GetAccountId()); 139 chromeos::ChromeUserManager::Get()->GetUserFlow(user->GetAccountId());
144 if (!user_flow || !user_flow->CanStartArc()) { 140 if (!user_flow || !user_flow->CanStartArc()) {
145 VLOG(1) << "ARC is not allowed in the current user flow."; 141 VLOG(1) << "ARC is not allowed in the current user flow.";
146 return false; 142 return false;
147 } 143 }
148 144
149 // Do not allow for Ephemeral data user. cf) b/26402681 145 // Do not allow for Ephemeral data user. cf) b/26402681
150 if (user_manager::UserManager::Get() 146 if (user_manager::UserManager::Get()
hidehiko 2017/05/17 02:09:45 Clarification: Can this be merged into IsArcAllowe
xiyuan 2017/05/17 21:36:14 Done.
151 ->IsCurrentUserCryptohomeDataEphemeral()) { 147 ->IsCurrentUserCryptohomeDataEphemeral()) {
152 VLOG(1) << "Users with ephemeral data are not supported in ARC."; 148 VLOG(1) << "Users with ephemeral data are not supported in ARC.";
153 return false; 149 return false;
154 } 150 }
155 151
156 return true; 152 return true;
157 } 153 }
158 154
159 bool IsArcCompatibleFileSystemUsedForProfile(const Profile* profile) { 155 bool IsArcCompatibleFileSystemUsedForProfile(const Profile* profile) {
160 const user_manager::User* user = 156 const user_manager::User* user =
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 // Otherwise, check the underlying filesystem. 260 // Otherwise, check the underlying filesystem.
265 base::PostTaskWithTraitsAndReplyWithResult( 261 base::PostTaskWithTraitsAndReplyWithResult(
266 FROM_HERE, 262 FROM_HERE,
267 {base::MayBlock(), base::TaskPriority::USER_BLOCKING, 263 {base::MayBlock(), base::TaskPriority::USER_BLOCKING,
268 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, 264 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
269 base::Bind(&IsArcCompatibleFilesystem, profile_path), 265 base::Bind(&IsArcCompatibleFilesystem, profile_path),
270 base::Bind(&StoreCompatibilityCheckResult, account_id, callback)); 266 base::Bind(&StoreCompatibilityCheckResult, account_id, callback));
271 } 267 }
272 268
273 } // namespace arc 269 } // namespace arc
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/screens/user_selection_screen.cc » ('j') | components/arc/arc_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698