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/shelf/shelf_delegate.h" | 9 #include "ash/shelf/shelf_delegate.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } // namespace | 90 } // namespace |
91 | 91 |
92 ArcAuthService::ArcAuthService(ArcBridgeService* bridge_service) | 92 ArcAuthService::ArcAuthService(ArcBridgeService* bridge_service) |
93 : ArcService(bridge_service), binding_(this), weak_ptr_factory_(this) { | 93 : ArcService(bridge_service), binding_(this), weak_ptr_factory_(this) { |
94 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 94 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
95 DCHECK(!g_arc_auth_service); | 95 DCHECK(!g_arc_auth_service); |
96 | 96 |
97 g_arc_auth_service = this; | 97 g_arc_auth_service = this; |
98 | 98 |
99 arc_bridge_service()->AddObserver(this); | 99 arc_bridge_service()->AddObserver(this); |
| 100 arc_bridge_service()->auth()->AddObserver(this); |
100 } | 101 } |
101 | 102 |
102 ArcAuthService::~ArcAuthService() { | 103 ArcAuthService::~ArcAuthService() { |
103 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 104 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
104 DCHECK_EQ(this, g_arc_auth_service); | 105 DCHECK_EQ(this, g_arc_auth_service); |
105 | 106 |
106 Shutdown(); | 107 Shutdown(); |
| 108 arc_bridge_service()->auth()->RemoveObserver(this); |
107 arc_bridge_service()->RemoveObserver(this); | 109 arc_bridge_service()->RemoveObserver(this); |
108 | 110 |
109 g_arc_auth_service = nullptr; | 111 g_arc_auth_service = nullptr; |
110 } | 112 } |
111 | 113 |
112 // static | 114 // static |
113 ArcAuthService* ArcAuthService::Get() { | 115 ArcAuthService* ArcAuthService::Get() { |
114 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 116 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
115 return g_arc_auth_service; | 117 return g_arc_auth_service; |
116 } | 118 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 180 |
179 if (user_manager::UserManager::Get() | 181 if (user_manager::UserManager::Get() |
180 ->IsCurrentUserCryptohomeDataEphemeral()) { | 182 ->IsCurrentUserCryptohomeDataEphemeral()) { |
181 VLOG(2) << "Users with ephemeral data are not supported in Arc."; | 183 VLOG(2) << "Users with ephemeral data are not supported in Arc."; |
182 return false; | 184 return false; |
183 } | 185 } |
184 | 186 |
185 return true; | 187 return true; |
186 } | 188 } |
187 | 189 |
188 void ArcAuthService::OnAuthInstanceReady() { | 190 void ArcAuthService::OnInstanceReady() { |
189 arc_bridge_service()->auth_instance()->Init( | 191 arc_bridge_service()->auth()->instance()->Init( |
190 binding_.CreateInterfacePtrAndBind()); | 192 binding_.CreateInterfacePtrAndBind()); |
191 } | 193 } |
192 | 194 |
193 void ArcAuthService::OnBridgeStopped() { | 195 void ArcAuthService::OnBridgeStopped() { |
194 if (waiting_for_reply_) { | 196 if (waiting_for_reply_) { |
195 // Using SERVICE_UNAVAILABLE instead of UNKNOWN_ERROR, since the latter | 197 // Using SERVICE_UNAVAILABLE instead of UNKNOWN_ERROR, since the latter |
196 // causes this code to not try to stop ARC, so it would retry without the | 198 // causes this code to not try to stop ARC, so it would retry without the |
197 // user noticing. | 199 // user noticing. |
198 OnSignInFailed(mojom::ArcSignInFailureReason::SERVICE_UNAVAILABLE); | 200 OnSignInFailed(mojom::ArcSignInFailureReason::SERVICE_UNAVAILABLE); |
199 } | 201 } |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 return os << kStateFetchingCode; | 750 return os << kStateFetchingCode; |
749 case ArcAuthService::State::ACTIVE: | 751 case ArcAuthService::State::ACTIVE: |
750 return os << kStateActive; | 752 return os << kStateActive; |
751 default: | 753 default: |
752 NOTREACHED(); | 754 NOTREACHED(); |
753 return os; | 755 return os; |
754 } | 756 } |
755 } | 757 } |
756 | 758 |
757 } // namespace arc | 759 } // namespace arc |
OLD | NEW |