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

Unified Diff: components/arc/arc_bridge_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 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
« no previous file with comments | « components/arc/arc_bridge_service.h ('k') | components/arc/arc_service_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/arc_bridge_service.cc
diff --git a/components/arc/arc_bridge_service.cc b/components/arc/arc_bridge_service.cc
index 2d10d8a468d1e9ed5c41ae273a15c436f1e980ce..37be7ccfcfdd89f33b1b7eaef7706d619189ef8a 100644
--- a/components/arc/arc_bridge_service.cc
+++ b/components/arc/arc_bridge_service.cc
@@ -80,6 +80,30 @@ void ArcBridgeService::CloseAppChannel() {
FOR_EACH_OBSERVER(Observer, observer_list(), OnAppInstanceClosed());
}
+void ArcBridgeService::OnAuthInstanceReady(AuthInstancePtr auth_ptr) {
+ DCHECK(CalledOnValidThread());
+ temporary_auth_ptr_ = std::move(auth_ptr);
+ temporary_auth_ptr_.QueryVersion(base::Bind(
+ &ArcBridgeService::OnAuthVersionReady, weak_factory_.GetWeakPtr()));
+}
+
+void ArcBridgeService::OnAuthVersionReady(int32_t version) {
+ DCHECK(CalledOnValidThread());
+ auth_ptr_ = std::move(temporary_auth_ptr_);
+ FOR_EACH_OBSERVER(Observer, observer_list(), OnAuthInstanceReady());
+ auth_ptr_.set_connection_error_handler(base::Bind(
+ &ArcBridgeService::CloseAuthChannel, weak_factory_.GetWeakPtr()));
+}
+
+void ArcBridgeService::CloseAuthChannel() {
+ DCHECK(CalledOnValidThread());
+ if (!input_ptr_)
+ return;
+
+ auth_ptr_.reset();
+ FOR_EACH_OBSERVER(Observer, observer_list(), OnAuthInstanceClosed());
+}
+
void ArcBridgeService::OnInputInstanceReady(InputInstancePtr input_ptr) {
DCHECK(CalledOnValidThread());
temporary_input_ptr_ = std::move(input_ptr);
@@ -226,6 +250,7 @@ void ArcBridgeService::CloseAllChannels() {
// Call all the error handlers of all the channels to both close the channel
// and notify any observers that the channel is closed.
CloseAppChannel();
+ CloseAuthChannel();
CloseInputChannel();
CloseNotificationsChannel();
ClosePowerChannel();
« no previous file with comments | « components/arc/arc_bridge_service.h ('k') | components/arc/arc_service_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698