Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/chromeos/arc/arc_util.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "chrome/browser/chromeos/login/user_flow.h" | |
| 9 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | |
| 10 #include "chrome/browser/chromeos/profiles/profile_helper.h" | |
| 11 #include "chrome/browser/profiles/profile.h" | |
| 12 #include "components/arc/arc_util.h" | |
| 13 #include "components/user_manager/user.h" | |
| 14 #include "components/user_manager/user_manager.h" | |
| 15 | |
| 16 namespace arc { | |
| 17 namespace util { | |
| 18 | |
| 19 bool IsArcAllowedForProfile(const Profile* profile) { | |
| 20 if (!IsArcEnabled()) { | |
| 21 VLOG(1) << "Arc is not enabled."; | |
|
Luis Héctor Chávez
2017/01/19 18:09:15
nit: s/Arc/ARC/g
hidehiko
2017/01/24 17:46:11
Done.
| |
| 22 return false; | |
| 23 } | |
| 24 | |
| 25 if (!profile) { | |
| 26 VLOG(1) << "ARC is not supported for systems without profile."; | |
| 27 return false; | |
| 28 } | |
| 29 | |
| 30 if (!chromeos::ProfileHelper::IsPrimaryProfile(profile)) { | |
| 31 VLOG(1) << "Non-primary users are not supported in ARC."; | |
| 32 return false; | |
| 33 } | |
| 34 | |
| 35 // IsPrimaryProfile can return true for an incognito profile corresponding | |
|
Yusuke Sato
2017/01/19 22:39:31
This type of comment looks useful. Can you add com
hidehiko
2017/01/24 17:46:11
Added to L54. However, as for L47 and L61, I'm not
| |
| 36 // to the primary profile, but ARC does not support it. | |
| 37 if (profile->IsOffTheRecord()) { | |
| 38 VLOG(1) << "Incognito profile is not supported in ARC."; | |
| 39 return false; | |
| 40 } | |
| 41 | |
| 42 if (profile->IsLegacySupervised()) { | |
| 43 VLOG(1) << "Supervised users are not supported in ARC."; | |
| 44 return false; | |
| 45 } | |
| 46 | |
| 47 const user_manager::User* user = | |
| 48 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); | |
| 49 if ((!user || !user->HasGaiaAccount()) && !IsArcKioskMode()) { | |
| 50 VLOG(1) << "Users without GAIA accounts are not supported in ARC."; | |
| 51 return false; | |
| 52 } | |
| 53 | |
| 54 chromeos::UserFlow* user_flow = | |
| 55 chromeos::ChromeUserManager::Get()->GetUserFlow(user->GetAccountId()); | |
| 56 if (!user_flow || !user_flow->CanStartArc()) { | |
| 57 VLOG(1) << "ARC is not allowed in the current user flow."; | |
| 58 return false; | |
| 59 } | |
| 60 | |
| 61 if (user_manager::UserManager::Get() | |
| 62 ->IsCurrentUserCryptohomeDataEphemeral()) { | |
| 63 VLOG(1) << "Users with ephemeral data are not supported in Arc."; | |
| 64 return false; | |
| 65 } | |
| 66 | |
| 67 return true; | |
| 68 } | |
| 69 | |
| 70 } // namespace util | |
| 71 } // namespace arc | |
| OLD | NEW |