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

Unified Diff: components/arc/arc_util.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 side-by-side diff with in-line comments
Download patch
Index: components/arc/arc_util.cc
diff --git a/components/arc/arc_util.cc b/components/arc/arc_util.cc
index 6a82a7046b5eb813c2bb2f7b40a01205326194f0..3cb4ac87a0c6d6a1319c5477820c7597914e492d 100644
--- a/components/arc/arc_util.cc
+++ b/components/arc/arc_util.cc
@@ -92,6 +92,29 @@ bool IsArcKioskMode() {
user_manager::UserManager::Get()->IsLoggedInAsArcKioskApp();
}
+bool IsArcAllowedForUser(const user_manager::User* user) {
+ if (!user) {
+ VLOG(1) << "No ARC for nullptr user.";
+ return false;
+ }
+
+ if (!user->HasGaiaAccount() && !user->IsActiveDirectoryUser() &&
+ user->GetType() != user_manager::USER_TYPE_ARC_KIOSK_APP) {
hidehiko 2017/05/23 07:23:26 Could you comment that this check is compatible wi
xiyuan 2017/05/24 19:22:56 Done.
+ VLOG(1) << "Users without GAIA or AD accounts, or not ARC kiosk apps are "
+ "not supported in ARC.";
+ return false;
+ }
+
+ // Do not allow for ephemeral data user. cf) b/26402681
+ if (user_manager::UserManager::Get()->IsUserCryptohomeDataEphemeral(
+ user->GetAccountId())) {
+ VLOG(1) << "Users with ephemeral data are not supported in ARC.";
+ return false;
+ }
+
+ return true;
+}
+
bool IsArcOptInVerificationDisabled() {
const auto* command_line = base::CommandLine::ForCurrentProcess();
return command_line->HasSwitch(

Powered by Google App Engine
This is Rietveld 408576698