Chromium Code Reviews| Index: components/arc/arc_auth_service.cc |
| diff --git a/components/arc/arc_auth_service.cc b/components/arc/arc_auth_service.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0fd42b0802d28b500457514d7a3e8ff4c8938897 |
| --- /dev/null |
| +++ b/components/arc/arc_auth_service.cc |
| @@ -0,0 +1,38 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "components/arc/arc_auth_service.h" |
| + |
| +namespace arc { |
| + |
| +ArcAuthService::ArcAuthService() : binding_(this) { |
| +} |
| + |
| +ArcAuthService::~ArcAuthService() { |
| + ArcBridgeService* bridge_service = ArcBridgeService::Get(); |
| + DCHECK(bridge_service); |
| + bridge_service->RemoveObserver(this); |
| +} |
| + |
| +void ArcAuthService::StartObservingBridgeServiceChanges() { |
|
Luis Héctor Chávez
2015/12/30 00:02:37
Can this be done in the constructor?
victorhsieh
2015/12/30 00:32:34
No, ABS is not available when this is instantiated
lhc(google)
2015/12/30 01:06:47
Right, but does as the code stands there is no nee
victorhsieh
2016/01/04 21:20:02
Since we need to get a profile to store a pref, th
|
| + ArcBridgeService* bridge_service = ArcBridgeService::Get(); |
| + DCHECK(bridge_service); |
| + bridge_service->AddObserver(this); |
| +} |
| + |
| +void ArcAuthService::OnAuthInstanceReady() { |
| + ArcBridgeService* bridge_service = ArcBridgeService::Get(); |
| + DCHECK(bridge_service); |
| + |
| + arc::AuthHostPtr host; |
| + binding_.Bind(GetProxy(&host)); |
| + bridge_service->auth_instance()->Init(std::move(host)); |
| +} |
| + |
| +void ArcAuthService::GetAuthCode(const GetAuthCodeCallback& callback) { |
| + // TODO(victorhsieh): request auth code from LSO. |
| + callback.Run(mojo::String("fake auth code from ArcAuthService in Chrome")); |
| +} |
| + |
| +} // namespace arc |