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

Unified Diff: components/arc/arc_bridge_service.cc

Issue 1572483002: Implement OnGetNetworks for net.mojom (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
Index: components/arc/arc_bridge_service.cc
diff --git a/components/arc/arc_bridge_service.cc b/components/arc/arc_bridge_service.cc
index 41f5fd305c3ae01fac2ea912a661d809430b3a18..cb845d89047e6d111c04f91d4e2ed09a51ee39c0 100644
--- a/components/arc/arc_bridge_service.cc
+++ b/components/arc/arc_bridge_service.cc
@@ -153,6 +153,30 @@ void ArcBridgeService::CloseInputChannel() {
FOR_EACH_OBSERVER(Observer, observer_list(), OnInputInstanceClosed());
}
+void ArcBridgeService::OnNetInstanceReady(NetInstancePtr net_ptr) {
+ DCHECK(CalledOnValidThread());
+ temporary_net_ptr_ = std::move(net_ptr);
+ temporary_net_ptr_.QueryVersion(base::Bind(
+ &ArcBridgeService::OnNetVersionReady, weak_factory_.GetWeakPtr()));
+}
+
+void ArcBridgeService::OnNetVersionReady(int32_t version) {
+ DCHECK(CalledOnValidThread());
+ net_ptr_ = std::move(temporary_net_ptr_);
+ FOR_EACH_OBSERVER(Observer, observer_list(), OnNetInstanceReady());
hidehiko 2016/01/15 08:38:39 This needs to be called after set_connection_error
cernekee 2016/01/15 22:45:36 Done.
+ net_ptr_.set_connection_error_handler(base::Bind(
+ &ArcBridgeService::CloseNetChannel, weak_factory_.GetWeakPtr()));
+}
+
+void ArcBridgeService::CloseNetChannel() {
+ DCHECK(CalledOnValidThread());
+ if (!net_ptr_)
+ return;
+
+ net_ptr_.reset();
+ FOR_EACH_OBSERVER(Observer, observer_list(), OnNetInstanceClosed());
+}
+
void ArcBridgeService::OnNotificationsInstanceReady(
NotificationsInstancePtr notifications_ptr) {
DCHECK(CalledOnValidThread());

Powered by Google App Engine
This is Rietveld 408576698