OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
| 6 |
| 7 #include <utility> |
| 8 |
| 9 namespace arc { |
| 10 |
| 11 ArcAuthService::ArcAuthService(ArcBridgeService* arc_bridge_service) |
| 12 : arc_bridge_service_(arc_bridge_service), binding_(this) { |
| 13 DCHECK(arc_bridge_service_); |
| 14 arc_bridge_service_->AddObserver(this); |
| 15 |
| 16 // If AuthInstance was ready before we AddObserver(), we won't get |
| 17 // OnAuthInstanceReady events. For such case, we have to call it explicitly. |
| 18 if (arc_bridge_service_->auth_instance()) |
| 19 OnAuthInstanceReady(); |
| 20 } |
| 21 |
| 22 ArcAuthService::~ArcAuthService() { |
| 23 arc_bridge_service_->RemoveObserver(this); |
| 24 } |
| 25 |
| 26 void ArcAuthService::OnAuthInstanceReady() { |
| 27 arc::AuthHostPtr host; |
| 28 binding_.Bind(GetProxy(&host)); |
| 29 arc_bridge_service_->auth_instance()->Init(std::move(host)); |
| 30 } |
| 31 |
| 32 void ArcAuthService::GetAuthCode(const GetAuthCodeCallback& callback) { |
| 33 // TODO(victorhsieh): request auth code from LSO (crbug.com/571146). |
| 34 callback.Run(mojo::String("fake auth code from ArcAuthService in Chrome")); |
| 35 } |
| 36 |
| 37 } // namespace arc |
OLD | NEW |