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

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

Issue 2655873002: Get enrollment token from DMServer when an Active Directory user uses ARC (Closed)
Patch Set: Add ClientId to DMServer request. Created 3 years, 10 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 "base/command_line.h"
7 #include "base/logging.h" 8 #include "base/logging.h"
8 #include "chrome/browser/chromeos/login/user_flow.h" 9 #include "chrome/browser/chromeos/login/user_flow.h"
9 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" 10 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
10 #include "chrome/browser/chromeos/profiles/profile_helper.h" 11 #include "chrome/browser/chromeos/profiles/profile_helper.h"
11 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/common/chrome_switches.h"
12 #include "components/arc/arc_util.h" 14 #include "components/arc/arc_util.h"
13 #include "components/user_manager/user.h" 15 #include "components/user_manager/user.h"
14 #include "components/user_manager/user_manager.h" 16 #include "components/user_manager/user_manager.h"
15 17
16 namespace arc { 18 namespace arc {
17 19
18 namespace { 20 namespace {
19 21
20 // Let IsAllowedForProfile() return "false" for any profile. 22 // Let IsAllowedForProfile() return "false" for any profile.
21 bool g_disallow_for_testing = false; 23 bool g_disallow_for_testing = false;
(...skipping 27 matching lines...) Expand all
49 VLOG(1) << "Incognito profile is not supported in ARC."; 51 VLOG(1) << "Incognito profile is not supported in ARC.";
50 return false; 52 return false;
51 } 53 }
52 54
53 if (profile->IsLegacySupervised()) { 55 if (profile->IsLegacySupervised()) {
54 VLOG(1) << "Supervised users are not supported in ARC."; 56 VLOG(1) << "Supervised users are not supported in ARC.";
55 return false; 57 return false;
56 } 58 }
57 59
58 // Do not allow for public session. Communicating with Play Store requires 60 // Do not allow for public session. Communicating with Play Store requires
59 // GAIA account. An exception is Kiosk mode, which uses different application 61 // GAIA account. An exception is Kiosk mode and Active Directory users, which
Luis Héctor Chávez 2017/02/06 22:00:15 nit: reword to "Play Store requires either an appr
Marton Hunyady 2017/02/07 14:53:42 Done.
60 // install mechanism. cf) crbug.com/605545 62 // use different application install mechanism. cf) crbug.com/605545
61 const user_manager::User* user = 63 const user_manager::User* user =
62 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); 64 chromeos::ProfileHelper::Get()->GetUserByProfile(profile);
63 if ((!user || !user->HasGaiaAccount()) && !IsArcKioskMode()) { 65 // Arc is allowed if we have either...
Luis Héctor Chávez 2017/02/06 22:00:15 nit: s/Arc/ARC/ also, can we split off this huge
Marton Hunyady 2017/02/07 14:53:42 Done (without standalone functions).
66 if (!( // .. a GAIA account,
67 (user && user->HasGaiaAccount()) ||
68 // .. an AD user and using ARC with AD is allowed,
69 (user && user->IsActiveDirectoryUser() &&
70 base::CommandLine::ForCurrentProcess()->HasSwitch(
Luis Héctor Chávez 2017/02/06 22:00:15 Please move all flag-related logic to components/a
Marton Hunyady 2017/02/07 14:53:42 Done.
71 switches::kEnableAndroidWithActiveDirectory)) ||
72 // .. or if it's a kiosk.
73 IsArcKioskMode())) {
74 // Otherwise fail.
64 VLOG(1) << "Users without GAIA accounts are not supported in ARC."; 75 VLOG(1) << "Users without GAIA accounts are not supported in ARC.";
65 return false; 76 return false;
66 } 77 }
67 78
68 // Do not run ARC instance when supervised user is being created. 79 // Do not run ARC instance when supervised user is being created.
69 // Otherwise noisy notification may be displayed. 80 // Otherwise noisy notification may be displayed.
70 chromeos::UserFlow* user_flow = 81 chromeos::UserFlow* user_flow =
71 chromeos::ChromeUserManager::Get()->GetUserFlow(user->GetAccountId()); 82 chromeos::ChromeUserManager::Get()->GetUserFlow(user->GetAccountId());
72 if (!user_flow || !user_flow->CanStartArc()) { 83 if (!user_flow || !user_flow->CanStartArc()) {
73 VLOG(1) << "ARC is not allowed in the current user flow."; 84 VLOG(1) << "ARC is not allowed in the current user flow.";
74 return false; 85 return false;
75 } 86 }
76 87
77 // Do not allow for Ephemeral data user. cf) b/26402681 88 // Do not allow for Ephemeral data user. cf) b/26402681
78 if (user_manager::UserManager::Get() 89 if (user_manager::UserManager::Get()
79 ->IsCurrentUserCryptohomeDataEphemeral()) { 90 ->IsCurrentUserCryptohomeDataEphemeral()) {
80 VLOG(1) << "Users with ephemeral data are not supported in ARC."; 91 VLOG(1) << "Users with ephemeral data are not supported in ARC.";
81 return false; 92 return false;
82 } 93 }
83 94
84 return true; 95 return true;
85 } 96 }
86 97
87 void DisallowArcForTesting() { 98 void DisallowArcForTesting() {
88 g_disallow_for_testing = true; 99 g_disallow_for_testing = true;
89 } 100 }
90 101
91 } // namespace arc 102 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698