| Index: chrome/browser/chromeos/arc/arc_auth_service.cc
|
| diff --git a/chrome/browser/chromeos/arc/arc_auth_service.cc b/chrome/browser/chromeos/arc/arc_auth_service.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5379a788e654ef1c88e6c4235aa888b8209485a6
|
| --- /dev/null
|
| +++ b/chrome/browser/chromeos/arc/arc_auth_service.cc
|
| @@ -0,0 +1,37 @@
|
| +// 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 "chrome/browser/chromeos/arc/arc_auth_service.h"
|
| +
|
| +#include <utility>
|
| +
|
| +namespace arc {
|
| +
|
| +ArcAuthService::ArcAuthService(ArcBridgeService* arc_bridge_service)
|
| + : arc_bridge_service_(arc_bridge_service), binding_(this) {
|
| + DCHECK(arc_bridge_service_);
|
| + arc_bridge_service_->AddObserver(this);
|
| +
|
| + // If AuthInstance was ready before we AddObserver(), we won't get
|
| + // OnAuthInstanceReady events. For such case, we have to call it explicitly.
|
| + if (arc_bridge_service_->auth_instance())
|
| + OnAuthInstanceReady();
|
| +}
|
| +
|
| +ArcAuthService::~ArcAuthService() {
|
| + arc_bridge_service_->RemoveObserver(this);
|
| +}
|
| +
|
| +void ArcAuthService::OnAuthInstanceReady() {
|
| + arc::AuthHostPtr host;
|
| + binding_.Bind(GetProxy(&host));
|
| + arc_bridge_service_->auth_instance()->Init(std::move(host));
|
| +}
|
| +
|
| +void ArcAuthService::GetAuthCode(const GetAuthCodeCallback& callback) {
|
| + // TODO(victorhsieh): request auth code from LSO (crbug.com/571146).
|
| + callback.Run(mojo::String("fake auth code from ArcAuthService in Chrome"));
|
| +}
|
| +
|
| +} // namespace arc
|
|
|