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

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

Issue 2190483003: arc: Revamp the ArcBridgeService interface (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@2785
Patch Set: One less diff line Created 4 years, 4 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() {
194 arc_bridge_service()->auth_instance()->Init( 196 arc_bridge_service()->auth()->instance()->Init(
195 binding_.CreateInterfacePtrAndBind()); 197 binding_.CreateInterfacePtrAndBind());
196 } 198 }
197 199
198 void ArcAuthService::OnBridgeStopped(ArcBridgeService::StopReason reason) { 200 void ArcAuthService::OnBridgeStopped(ArcBridgeService::StopReason reason) {
199 // TODO(crbug.com/625923): Use |reason| to report more detailed errors. 201 // TODO(crbug.com/625923): Use |reason| to report more detailed errors.
200 if (waiting_for_reply_) { 202 if (waiting_for_reply_) {
201 // Using SERVICE_UNAVAILABLE instead of UNKNOWN_ERROR, since the latter 203 // Using SERVICE_UNAVAILABLE instead of UNKNOWN_ERROR, since the latter
202 // causes this code to not try to stop ARC, so it would retry without the 204 // causes this code to not try to stop ARC, so it would retry without the
203 // user noticing. 205 // user noticing.
204 OnSignInFailed(arc::mojom::ArcSignInFailureReason::SERVICE_UNAVAILABLE); 206 OnSignInFailed(arc::mojom::ArcSignInFailureReason::SERVICE_UNAVAILABLE);
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 return os << kStateFetchingCode; 754 return os << kStateFetchingCode;
753 case ArcAuthService::State::ACTIVE: 755 case ArcAuthService::State::ACTIVE:
754 return os << kStateActive; 756 return os << kStateActive;
755 default: 757 default:
756 NOTREACHED(); 758 NOTREACHED();
757 return os; 759 return os;
758 } 760 }
759 } 761 }
760 762
761 } // namespace arc 763 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/arc_auth_service.h ('k') | chrome/browser/chromeos/arc/arc_downloads_watcher_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698