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

Side by Side Diff: components/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 "components/arc/arc_util.h" 5 #include "components/arc/arc_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 void SetArcAvailableCommandLineForTesting(base::CommandLine* command_line) { 87 void SetArcAvailableCommandLineForTesting(base::CommandLine* command_line) {
88 command_line->AppendSwitchASCII(chromeos::switches::kArcAvailability, 88 command_line->AppendSwitchASCII(chromeos::switches::kArcAvailability,
89 kAvailabilityOfficiallySupported); 89 kAvailabilityOfficiallySupported);
90 } 90 }
91 91
92 bool IsArcKioskMode() { 92 bool IsArcKioskMode() {
93 return user_manager::UserManager::IsInitialized() && 93 return user_manager::UserManager::IsInitialized() &&
94 user_manager::UserManager::Get()->IsLoggedInAsArcKioskApp(); 94 user_manager::UserManager::Get()->IsLoggedInAsArcKioskApp();
95 } 95 }
96 96
97 bool IsArcAllowedForUser(const user_manager::User* user) {
98 return user &&
hidehiko 2017/05/17 02:09:45 Instead of oneline, could you use if-stmt, and vlo
xiyuan 2017/05/17 21:36:14 Done.
99 (user->HasGaiaAccount() || (user->IsActiveDirectoryUser() &&
100 IsArcAllowedForActiveDirectoryUsers()));
101 }
102
97 bool IsArcAllowedForActiveDirectoryUsers() { 103 bool IsArcAllowedForActiveDirectoryUsers() {
98 const auto* command_line = base::CommandLine::ForCurrentProcess(); 104 const auto* command_line = base::CommandLine::ForCurrentProcess();
99 105
100 if (!command_line->HasSwitch(chromeos::switches::kArcAvailability)) 106 if (!command_line->HasSwitch(chromeos::switches::kArcAvailability))
101 return false; 107 return false;
102 108
103 return command_line->GetSwitchValueASCII( 109 return command_line->GetSwitchValueASCII(
104 chromeos::switches::kArcAvailability) == 110 chromeos::switches::kArcAvailability) ==
105 kAvailabilityOfficiallySupportedWithActiveDirectory; 111 kAvailabilityOfficiallySupportedWithActiveDirectory;
106 } 112 }
107 113
108 bool IsArcOptInVerificationDisabled() { 114 bool IsArcOptInVerificationDisabled() {
109 const auto* command_line = base::CommandLine::ForCurrentProcess(); 115 const auto* command_line = base::CommandLine::ForCurrentProcess();
110 return command_line->HasSwitch( 116 return command_line->HasSwitch(
111 chromeos::switches::kDisableArcOptInVerification); 117 chromeos::switches::kDisableArcOptInVerification);
112 } 118 }
113 119
114 } // namespace arc 120 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698