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

Unified Diff: components/arc/arc_auth_service.cc

Issue 1553613002: Add ArcAuthService to handle IPC request from ARC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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: 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

Powered by Google App Engine
This is Rietveld 408576698