| OLD | NEW |
| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/chromeos/login/user_flow.h" | 8 #include "chrome/browser/chromeos/login/user_flow.h" |
| 9 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 9 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 10 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 10 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 if (profile->IsOffTheRecord()) { | 48 if (profile->IsOffTheRecord()) { |
| 49 VLOG(1) << "Incognito profile is not supported in ARC."; | 49 VLOG(1) << "Incognito profile is not supported in ARC."; |
| 50 return false; | 50 return false; |
| 51 } | 51 } |
| 52 | 52 |
| 53 if (profile->IsLegacySupervised()) { | 53 if (profile->IsLegacySupervised()) { |
| 54 VLOG(1) << "Supervised users are not supported in ARC."; | 54 VLOG(1) << "Supervised users are not supported in ARC."; |
| 55 return false; | 55 return false; |
| 56 } | 56 } |
| 57 | 57 |
| 58 // Do not allow for public session. Communicating with Play Store requires | 58 // Play Store requires an appropriate application install mechanism. Normal |
| 59 // GAIA account. An exception is Kiosk mode, which uses different application | 59 // users do this through GAIA, but Kiosk and Active Directory users use |
| 60 // install mechanism. cf) crbug.com/605545 | 60 // different application install mechanism. ARC is not allowed otherwise |
| 61 // (e.g. in public sessions). cf) crbug.com/605545 |
| 61 const user_manager::User* user = | 62 const user_manager::User* user = |
| 62 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); | 63 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); |
| 63 if ((!user || !user->HasGaiaAccount()) && !IsArcKioskMode()) { | 64 const bool has_gaia_account = user && user->HasGaiaAccount(); |
| 65 const bool is_arc_active_directory_user = |
| 66 user && user->IsActiveDirectoryUser() && |
| 67 IsArcAllowedForActiveDirectoryUsers(); |
| 68 if (!has_gaia_account && !is_arc_active_directory_user && !IsArcKioskMode()) { |
| 64 VLOG(1) << "Users without GAIA accounts are not supported in ARC."; | 69 VLOG(1) << "Users without GAIA accounts are not supported in ARC."; |
| 65 return false; | 70 return false; |
| 66 } | 71 } |
| 67 | 72 |
| 68 // Do not run ARC instance when supervised user is being created. | 73 // Do not run ARC instance when supervised user is being created. |
| 69 // Otherwise noisy notification may be displayed. | 74 // Otherwise noisy notification may be displayed. |
| 70 chromeos::UserFlow* user_flow = | 75 chromeos::UserFlow* user_flow = |
| 71 chromeos::ChromeUserManager::Get()->GetUserFlow(user->GetAccountId()); | 76 chromeos::ChromeUserManager::Get()->GetUserFlow(user->GetAccountId()); |
| 72 if (!user_flow || !user_flow->CanStartArc()) { | 77 if (!user_flow || !user_flow->CanStartArc()) { |
| 73 VLOG(1) << "ARC is not allowed in the current user flow."; | 78 VLOG(1) << "ARC is not allowed in the current user flow."; |
| 74 return false; | 79 return false; |
| 75 } | 80 } |
| 76 | 81 |
| 77 // Do not allow for Ephemeral data user. cf) b/26402681 | 82 // Do not allow for Ephemeral data user. cf) b/26402681 |
| 78 if (user_manager::UserManager::Get() | 83 if (user_manager::UserManager::Get() |
| 79 ->IsCurrentUserCryptohomeDataEphemeral()) { | 84 ->IsCurrentUserCryptohomeDataEphemeral()) { |
| 80 VLOG(1) << "Users with ephemeral data are not supported in ARC."; | 85 VLOG(1) << "Users with ephemeral data are not supported in ARC."; |
| 81 return false; | 86 return false; |
| 82 } | 87 } |
| 83 | 88 |
| 84 return true; | 89 return true; |
| 85 } | 90 } |
| 86 | 91 |
| 87 void DisallowArcForTesting() { | 92 void DisallowArcForTesting() { |
| 88 g_disallow_for_testing = true; | 93 g_disallow_for_testing = true; |
| 89 } | 94 } |
| 90 | 95 |
| 91 } // namespace arc | 96 } // namespace arc |
| OLD | NEW |