| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 // The Android management check is disabled by default, it's used only for | 65 // The Android management check is disabled by default, it's used only for |
| 66 // testing. | 66 // testing. |
| 67 bool g_enable_check_android_management_for_testing = false; | 67 bool g_enable_check_android_management_for_testing = false; |
| 68 | 68 |
| 69 // Maximum amount of time we'll wait for ARC to finish booting up. Once this | 69 // Maximum amount of time we'll wait for ARC to finish booting up. Once this |
| 70 // timeout expires, keep ARC running in case the user wants to file feedback, | 70 // timeout expires, keep ARC running in case the user wants to file feedback, |
| 71 // but present the UI to try again. | 71 // but present the UI to try again. |
| 72 constexpr base::TimeDelta kArcSignInTimeout = base::TimeDelta::FromMinutes(5); | 72 constexpr base::TimeDelta kArcSignInTimeout = base::TimeDelta::FromMinutes(5); |
| 73 | 73 |
| 74 const char kStateNotInitialized[] = "NOT_INITIALIZED"; | |
| 75 const char kStateStopped[] = "STOPPED"; | |
| 76 const char kStateFetchingCode[] = "FETCHING_CODE"; | |
| 77 const char kStateActive[] = "ACTIVE"; | |
| 78 | |
| 79 bool IsAccountManaged(Profile* profile) { | 74 bool IsAccountManaged(Profile* profile) { |
| 80 return policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile) | 75 return policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile) |
| 81 ->IsManaged(); | 76 ->IsManaged(); |
| 82 } | 77 } |
| 83 | 78 |
| 84 bool IsArcDisabledForEnterprise() { | 79 bool IsArcDisabledForEnterprise() { |
| 85 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 80 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 86 chromeos::switches::kEnterpriseDisableArc); | 81 chromeos::switches::kEnterpriseDisableArc); |
| 87 } | 82 } |
| 88 | 83 |
| (...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 IsOptInVerificationDisabled()) { | 954 IsOptInVerificationDisabled()) { |
| 960 StartArc(); | 955 StartArc(); |
| 961 } else { | 956 } else { |
| 962 FetchAuthCode(); | 957 FetchAuthCode(); |
| 963 } | 958 } |
| 964 } | 959 } |
| 965 | 960 |
| 966 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state) { | 961 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state) { |
| 967 switch (state) { | 962 switch (state) { |
| 968 case ArcAuthService::State::NOT_INITIALIZED: | 963 case ArcAuthService::State::NOT_INITIALIZED: |
| 969 return os << kStateNotInitialized; | 964 return os << "NOT_INITIALIZED"; |
| 970 case ArcAuthService::State::STOPPED: | 965 case ArcAuthService::State::STOPPED: |
| 971 return os << kStateStopped; | 966 return os << "STOPPED"; |
| 972 case ArcAuthService::State::FETCHING_CODE: | 967 case ArcAuthService::State::FETCHING_CODE: |
| 973 return os << kStateFetchingCode; | 968 return os << "FETCHING_CODE"; |
| 974 case ArcAuthService::State::ACTIVE: | 969 case ArcAuthService::State::ACTIVE: |
| 975 return os << kStateActive; | 970 return os << "ACTIVE"; |
| 976 default: | 971 default: |
| 977 NOTREACHED(); | 972 NOTREACHED(); |
| 978 return os; | 973 return os; |
| 979 } | 974 } |
| 980 } | 975 } |
| 981 | 976 |
| 982 } // namespace arc | 977 } // namespace arc |
| OLD | NEW |