| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 // The Android management check is disabled by default, it's used only for | 66 // The Android management check is disabled by default, it's used only for |
| 67 // testing. | 67 // testing. |
| 68 bool g_enable_check_android_management_for_testing = false; | 68 bool g_enable_check_android_management_for_testing = false; |
| 69 | 69 |
| 70 // Maximum amount of time we'll wait for ARC to finish booting up. Once this | 70 // Maximum amount of time we'll wait for ARC to finish booting up. Once this |
| 71 // timeout expires, keep ARC running in case the user wants to file feedback, | 71 // timeout expires, keep ARC running in case the user wants to file feedback, |
| 72 // but present the UI to try again. | 72 // but present the UI to try again. |
| 73 constexpr base::TimeDelta kArcSignInTimeout = base::TimeDelta::FromMinutes(5); | 73 constexpr base::TimeDelta kArcSignInTimeout = base::TimeDelta::FromMinutes(5); |
| 74 | 74 |
| 75 const char kStateNotInitialized[] = "NOT_INITIALIZED"; | |
| 76 const char kStateStopped[] = "STOPPED"; | |
| 77 const char kStateFetchingCode[] = "FETCHING_CODE"; | |
| 78 const char kStateActive[] = "ACTIVE"; | |
| 79 | |
| 80 ash::ShelfDelegate* GetShelfDelegate() { | 75 ash::ShelfDelegate* GetShelfDelegate() { |
| 81 if (g_shelf_delegate_for_testing) | 76 if (g_shelf_delegate_for_testing) |
| 82 return g_shelf_delegate_for_testing; | 77 return g_shelf_delegate_for_testing; |
| 83 if (ash::WmShell::HasInstance()) { | 78 if (ash::WmShell::HasInstance()) { |
| 84 DCHECK(ash::WmShell::Get()->shelf_delegate()); | 79 DCHECK(ash::WmShell::Get()->shelf_delegate()); |
| 85 return ash::WmShell::Get()->shelf_delegate(); | 80 return ash::WmShell::Get()->shelf_delegate(); |
| 86 } | 81 } |
| 87 return nullptr; | 82 return nullptr; |
| 88 } | 83 } |
| 89 | 84 |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 IsOptInVerificationDisabled()) { | 946 IsOptInVerificationDisabled()) { |
| 952 StartArc(); | 947 StartArc(); |
| 953 } else { | 948 } else { |
| 954 FetchAuthCode(); | 949 FetchAuthCode(); |
| 955 } | 950 } |
| 956 } | 951 } |
| 957 | 952 |
| 958 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state) { | 953 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state) { |
| 959 switch (state) { | 954 switch (state) { |
| 960 case ArcAuthService::State::NOT_INITIALIZED: | 955 case ArcAuthService::State::NOT_INITIALIZED: |
| 961 return os << kStateNotInitialized; | 956 return os << "NOT_INITIALIZED"; |
| 962 case ArcAuthService::State::STOPPED: | 957 case ArcAuthService::State::STOPPED: |
| 963 return os << kStateStopped; | 958 return os << "STOPPED"; |
| 964 case ArcAuthService::State::FETCHING_CODE: | 959 case ArcAuthService::State::FETCHING_CODE: |
| 965 return os << kStateFetchingCode; | 960 return os << "FETCHING_CODE"; |
| 966 case ArcAuthService::State::ACTIVE: | 961 case ArcAuthService::State::ACTIVE: |
| 967 return os << kStateActive; | 962 return os << "ACTIVE"; |
| 968 default: | 963 default: |
| 969 NOTREACHED(); | 964 NOTREACHED(); |
| 970 return os; | 965 return os; |
| 971 } | 966 } |
| 972 } | 967 } |
| 973 | 968 |
| 974 } // namespace arc | 969 } // namespace arc |
| OLD | NEW |