OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/clipboard.h" | 5 #include "remoting/host/clipboard.h" |
6 | 6 |
7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 ClipboardLinux::ClipboardLinux() | 56 ClipboardLinux::ClipboardLinux() |
57 : display_(NULL) { | 57 : display_(NULL) { |
58 } | 58 } |
59 | 59 |
60 ClipboardLinux::~ClipboardLinux() { | 60 ClipboardLinux::~ClipboardLinux() { |
61 Stop(); | 61 Stop(); |
62 } | 62 } |
63 | 63 |
64 void ClipboardLinux::Start( | 64 void ClipboardLinux::Start( |
65 scoped_ptr<protocol::ClipboardStub> client_clipboard) { | 65 scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
66 // TODO(lambroslambrou): Share the X connection with EventExecutor. | 66 // TODO(lambroslambrou): Share the X connection with InputInjector. |
67 display_ = XOpenDisplay(NULL); | 67 display_ = XOpenDisplay(NULL); |
68 if (!display_) { | 68 if (!display_) { |
69 LOG(ERROR) << "Couldn't open X display"; | 69 LOG(ERROR) << "Couldn't open X display"; |
70 return; | 70 return; |
71 } | 71 } |
72 client_clipboard_.swap(client_clipboard); | 72 client_clipboard_.swap(client_clipboard); |
73 | 73 |
74 x_server_clipboard_.Init(display_, | 74 x_server_clipboard_.Init(display_, |
75 base::Bind(&ClipboardLinux::OnClipboardChanged, | 75 base::Bind(&ClipboardLinux::OnClipboardChanged, |
76 base::Unretained(this))); | 76 base::Unretained(this))); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 XNextEvent(display_, &event); | 122 XNextEvent(display_, &event); |
123 x_server_clipboard_.ProcessXEvent(&event); | 123 x_server_clipboard_.ProcessXEvent(&event); |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
127 scoped_ptr<Clipboard> Clipboard::Create() { | 127 scoped_ptr<Clipboard> Clipboard::Create() { |
128 return scoped_ptr<Clipboard>(new ClipboardLinux()); | 128 return scoped_ptr<Clipboard>(new ClipboardLinux()); |
129 } | 129 } |
130 | 130 |
131 } // namespace remoting | 131 } // namespace remoting |
OLD | NEW |