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

Side by Side Diff: chrome/browser/chromeos/arc/arc_auth_service.cc

Issue 2133503002: arc: Revamp the ArcBridgeService interface (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Fix ui_arc_unittests Created 4 years, 5 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 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } // namespace 94 } // namespace
95 95
96 ArcAuthService::ArcAuthService(ArcBridgeService* bridge_service) 96 ArcAuthService::ArcAuthService(ArcBridgeService* bridge_service)
97 : ArcService(bridge_service), binding_(this), weak_ptr_factory_(this) { 97 : ArcService(bridge_service), binding_(this), weak_ptr_factory_(this) {
98 DCHECK(!arc_auth_service); 98 DCHECK(!arc_auth_service);
99 DCHECK(thread_checker.Get().CalledOnValidThread()); 99 DCHECK(thread_checker.Get().CalledOnValidThread());
100 100
101 arc_auth_service = this; 101 arc_auth_service = this;
102 102
103 arc_bridge_service()->AddObserver(this); 103 arc_bridge_service()->AddObserver(this);
104 arc_bridge_service()->auth()->AddObserver(this);
104 } 105 }
105 106
106 ArcAuthService::~ArcAuthService() { 107 ArcAuthService::~ArcAuthService() {
107 DCHECK(thread_checker.Get().CalledOnValidThread()); 108 DCHECK(thread_checker.Get().CalledOnValidThread());
108 DCHECK(arc_auth_service == this); 109 DCHECK(arc_auth_service == this);
109 110
110 Shutdown(); 111 Shutdown();
112 arc_bridge_service()->auth()->RemoveObserver(this);
111 arc_bridge_service()->RemoveObserver(this); 113 arc_bridge_service()->RemoveObserver(this);
112 114
113 arc_auth_service = nullptr; 115 arc_auth_service = nullptr;
114 } 116 }
115 117
116 // static 118 // static
117 ArcAuthService* ArcAuthService::Get() { 119 ArcAuthService* ArcAuthService::Get() {
118 DCHECK(thread_checker.Get().CalledOnValidThread()); 120 DCHECK(thread_checker.Get().CalledOnValidThread());
119 return arc_auth_service; 121 return arc_auth_service;
120 } 122 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 185
184 if (user_manager::UserManager::Get() 186 if (user_manager::UserManager::Get()
185 ->IsCurrentUserCryptohomeDataEphemeral()) { 187 ->IsCurrentUserCryptohomeDataEphemeral()) {
186 VLOG(2) << "Users with ephemeral data are not supported in Arc."; 188 VLOG(2) << "Users with ephemeral data are not supported in Arc.";
187 return false; 189 return false;
188 } 190 }
189 191
190 return true; 192 return true;
191 } 193 }
192 194
193 void ArcAuthService::OnAuthInstanceReady() { 195 void ArcAuthService::OnInstanceReady(mojom::AuthInstance* auth_instance,
194 arc_bridge_service()->auth_instance()->Init( 196 uint32_t version) {
195 binding_.CreateInterfacePtrAndBind()); 197 auth_instance->Init(binding_.CreateInterfacePtrAndBind());
196 } 198 }
197 199
198 void ArcAuthService::OnBridgeStopped() { 200 void ArcAuthService::OnBridgeStopped() {
199 if (waiting_for_reply_) { 201 if (waiting_for_reply_) {
200 // Using SERVICE_UNAVAILABLE instead of UNKNOWN_ERROR, since the latter 202 // Using SERVICE_UNAVAILABLE instead of UNKNOWN_ERROR, since the latter
201 // causes this code to not try to stop ARC, so it would retry without the 203 // causes this code to not try to stop ARC, so it would retry without the
202 // user noticing. 204 // user noticing.
203 OnSignInFailed(arc::mojom::ArcSignInFailureReason::SERVICE_UNAVAILABLE); 205 OnSignInFailed(arc::mojom::ArcSignInFailureReason::SERVICE_UNAVAILABLE);
204 } 206 }
205 if (!clear_required_) 207 if (!clear_required_)
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 return os << kStateFetchingCode; 753 return os << kStateFetchingCode;
752 case ArcAuthService::State::ACTIVE: 754 case ArcAuthService::State::ACTIVE:
753 return os << kStateActive; 755 return os << kStateActive;
754 default: 756 default:
755 NOTREACHED(); 757 NOTREACHED();
756 return os; 758 return os;
757 } 759 }
758 } 760 }
759 761
760 } // namespace arc 762 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698