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

Unified Diff: chrome/browser/chromeos/arc/arc_auth_service.cc

Issue 1596663002: arc-bridge: Introduce the ArcService class (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Fixed Chrome OS build Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/arc/arc_auth_service.cc
diff --git a/chrome/browser/chromeos/arc/arc_auth_service_impl.cc b/chrome/browser/chromeos/arc/arc_auth_service.cc
similarity index 51%
rename from chrome/browser/chromeos/arc/arc_auth_service_impl.cc
rename to chrome/browser/chromeos/arc/arc_auth_service.cc
index 88174ff2f133d145b308ae8c8bd0281f73f7a922..d9dc53fac118a72bf982b1544926d1484ba6d7d1 100644
--- a/chrome/browser/chromeos/arc/arc_auth_service_impl.cc
+++ b/chrome/browser/chromeos/arc/arc_auth_service.cc
@@ -2,29 +2,32 @@
// 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_impl.h"
+#include "chrome/browser/chromeos/arc/arc_auth_service.h"
#include <utility>
namespace arc {
-ArcAuthServiceImpl::ArcAuthServiceImpl() : binding_(this) {}
+ArcAuthService::ArcAuthService(ArcBridgeService* arc_bridge) : binding_(this) {
+ arc_bridge->AddObserver(this);
-ArcAuthServiceImpl::~ArcAuthServiceImpl() {
- ArcBridgeService::Get()->RemoveObserver(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->auth_instance())
+ OnAuthInstanceReady();
}
-void ArcAuthServiceImpl::StartObservingBridgeServiceChanges() {
- ArcBridgeService::Get()->AddObserver(this);
+ArcAuthService::~ArcAuthService() {
+ ArcBridgeService::Get()->RemoveObserver(this);
hidehiko 2016/01/18 01:26:44 For consistency, could you keep the |arc_bridge| p
Luis Héctor Chávez 2016/01/19 17:43:54 Done.
}
-void ArcAuthServiceImpl::OnAuthInstanceReady() {
+void ArcAuthService::OnAuthInstanceReady() {
arc::AuthHostPtr host;
binding_.Bind(GetProxy(&host));
ArcBridgeService::Get()->auth_instance()->Init(std::move(host));
}
-void ArcAuthServiceImpl::GetAuthCode(const GetAuthCodeCallback& callback) {
+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"));
}

Powered by Google App Engine
This is Rietveld 408576698