OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_auth_service.h" | 5 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "ash/common/shelf/shelf_delegate.h" | 9 #include "ash/common/shelf/shelf_delegate.h" |
10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 // The Android management check is disabled by default, it's used only for | 63 // The Android management check is disabled by default, it's used only for |
64 // testing. | 64 // testing. |
65 bool g_enable_check_android_management_for_testing = false; | 65 bool g_enable_check_android_management_for_testing = false; |
66 | 66 |
67 const char kStateNotInitialized[] = "NOT_INITIALIZED"; | 67 const char kStateNotInitialized[] = "NOT_INITIALIZED"; |
68 const char kStateStopped[] = "STOPPED"; | 68 const char kStateStopped[] = "STOPPED"; |
69 const char kStateFetchingCode[] = "FETCHING_CODE"; | 69 const char kStateFetchingCode[] = "FETCHING_CODE"; |
70 const char kStateActive[] = "ACTIVE"; | 70 const char kStateActive[] = "ACTIVE"; |
71 | 71 |
72 bool IsAccountManaged(Profile* profile) { | |
73 return policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile) | |
74 ->IsManaged(); | |
75 } | |
76 | |
77 bool IsArcDisabledForEnterprise() { | 72 bool IsArcDisabledForEnterprise() { |
78 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 73 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
79 chromeos::switches::kEnterpriseDisableArc); | 74 chromeos::switches::kEnterpriseDisableArc); |
80 } | 75 } |
81 | 76 |
82 ash::ShelfDelegate* GetShelfDelegate() { | 77 ash::ShelfDelegate* GetShelfDelegate() { |
83 if (g_shelf_delegate_for_testing) | 78 if (g_shelf_delegate_for_testing) |
84 return g_shelf_delegate_for_testing; | 79 return g_shelf_delegate_for_testing; |
85 if (ash::WmShell::HasInstance()) { | 80 if (ash::WmShell::HasInstance()) { |
86 DCHECK(ash::WmShell::Get()->shelf_delegate()); | 81 DCHECK(ash::WmShell::Get()->shelf_delegate()); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 172 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
178 chromeos::switches::kDisableArcOptInVerification); | 173 chromeos::switches::kDisableArcOptInVerification); |
179 } | 174 } |
180 | 175 |
181 // static | 176 // static |
182 void ArcAuthService::EnableCheckAndroidManagementForTesting() { | 177 void ArcAuthService::EnableCheckAndroidManagementForTesting() { |
183 g_enable_check_android_management_for_testing = true; | 178 g_enable_check_android_management_for_testing = true; |
184 } | 179 } |
185 | 180 |
186 // static | 181 // static |
| 182 bool ArcAuthService::IsAccountManaged(Profile* profile) { |
| 183 return policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile) |
| 184 ->IsManaged(); |
| 185 } |
| 186 |
| 187 // static |
187 bool ArcAuthService::IsAllowedForProfile(const Profile* profile) { | 188 bool ArcAuthService::IsAllowedForProfile(const Profile* profile) { |
188 if (!ArcBridgeService::GetEnabled(base::CommandLine::ForCurrentProcess())) { | 189 if (!ArcBridgeService::GetEnabled(base::CommandLine::ForCurrentProcess())) { |
189 VLOG(1) << "Arc is not enabled."; | 190 VLOG(1) << "Arc is not enabled."; |
190 return false; | 191 return false; |
191 } | 192 } |
192 | 193 |
193 if (!profile) { | 194 if (!profile) { |
194 VLOG(1) << "ARC is not supported for systems without profile."; | 195 VLOG(1) << "ARC is not supported for systems without profile."; |
195 return false; | 196 return false; |
196 } | 197 } |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 return os << kStateFetchingCode; | 807 return os << kStateFetchingCode; |
807 case ArcAuthService::State::ACTIVE: | 808 case ArcAuthService::State::ACTIVE: |
808 return os << kStateActive; | 809 return os << kStateActive; |
809 default: | 810 default: |
810 NOTREACHED(); | 811 NOTREACHED(); |
811 return os; | 812 return os; |
812 } | 813 } |
813 } | 814 } |
814 | 815 |
815 } // namespace arc | 816 } // namespace arc |
OLD | NEW |