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

Unified Diff: components/arc/arc_bridge_service.cc

Issue 1495723004: Minimum implementation of ARC clipboard Bridge (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased and address review comments 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 37be7ccfcfdd89f33b1b7eaef7706d619189ef8a..41f5fd305c3ae01fac2ea912a661d809430b3a18 100644
--- a/components/arc/arc_bridge_service.cc
+++ b/components/arc/arc_bridge_service.cc
@@ -104,6 +104,31 @@ void ArcBridgeService::CloseAuthChannel() {
FOR_EACH_OBSERVER(Observer, observer_list(), OnAuthInstanceClosed());
}
+void ArcBridgeService::OnClipboardInstanceReady(
+ ClipboardInstancePtr clipboard_ptr) {
+ DCHECK(CalledOnValidThread());
+ temporary_clipboard_ptr_ = std::move(clipboard_ptr);
+ temporary_clipboard_ptr_.QueryVersion(base::Bind(
+ &ArcBridgeService::OnClipboardVersionReady, weak_factory_.GetWeakPtr()));
+}
+
+void ArcBridgeService::OnClipboardVersionReady(int32_t version) {
+ DCHECK(CalledOnValidThread());
+ clipboard_ptr_ = std::move(temporary_clipboard_ptr_);
+ FOR_EACH_OBSERVER(Observer, observer_list(), OnClipboardInstanceReady());
+ clipboard_ptr_.set_connection_error_handler(base::Bind(
+ &ArcBridgeService::CloseClipboardChannel, weak_factory_.GetWeakPtr()));
+}
+
+void ArcBridgeService::CloseClipboardChannel() {
+ DCHECK(CalledOnValidThread());
+ if (!clipboard_ptr_)
+ return;
+
+ clipboard_ptr_.reset();
+ FOR_EACH_OBSERVER(Observer, observer_list(), OnClipboardInstanceClosed());
+}
+
void ArcBridgeService::OnInputInstanceReady(InputInstancePtr input_ptr) {
DCHECK(CalledOnValidThread());
temporary_input_ptr_ = std::move(input_ptr);
@@ -251,6 +276,7 @@ void ArcBridgeService::CloseAllChannels() {
// and notify any observers that the channel is closed.
CloseAppChannel();
CloseAuthChannel();
+ CloseClipboardChannel();
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