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

Side by Side Diff: remoting/host/clipboard_x11.cc

Issue 810133003: replace NULL->nullptr in src/remoting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « remoting/host/clipboard_win.cc ('k') | remoting/host/config_file_watcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // and owned by this class. 45 // and owned by this class.
46 Display* display_; 46 Display* display_;
47 47
48 // Watcher used to handle X11 events from |display_|. 48 // Watcher used to handle X11 events from |display_|.
49 base::MessageLoopForIO::FileDescriptorWatcher x_connection_watcher_; 49 base::MessageLoopForIO::FileDescriptorWatcher x_connection_watcher_;
50 50
51 DISALLOW_COPY_AND_ASSIGN(ClipboardX11); 51 DISALLOW_COPY_AND_ASSIGN(ClipboardX11);
52 }; 52 };
53 53
54 ClipboardX11::ClipboardX11() 54 ClipboardX11::ClipboardX11()
55 : display_(NULL) { 55 : display_(nullptr) {
56 } 56 }
57 57
58 ClipboardX11::~ClipboardX11() { 58 ClipboardX11::~ClipboardX11() {
59 Stop(); 59 Stop();
60 } 60 }
61 61
62 void ClipboardX11::Start( 62 void ClipboardX11::Start(
63 scoped_ptr<protocol::ClipboardStub> client_clipboard) { 63 scoped_ptr<protocol::ClipboardStub> client_clipboard) {
64 // TODO(lambroslambrou): Share the X connection with InputInjector. 64 // TODO(lambroslambrou): Share the X connection with InputInjector.
65 display_ = XOpenDisplay(NULL); 65 display_ = XOpenDisplay(nullptr);
66 if (!display_) { 66 if (!display_) {
67 LOG(ERROR) << "Couldn't open X display"; 67 LOG(ERROR) << "Couldn't open X display";
68 return; 68 return;
69 } 69 }
70 client_clipboard_.swap(client_clipboard); 70 client_clipboard_.swap(client_clipboard);
71 71
72 x_server_clipboard_.Init(display_, 72 x_server_clipboard_.Init(display_,
73 base::Bind(&ClipboardX11::OnClipboardChanged, 73 base::Bind(&ClipboardX11::OnClipboardChanged,
74 base::Unretained(this))); 74 base::Unretained(this)));
75 75
(...skipping 10 matching lines...) Expand all
86 const protocol::ClipboardEvent& event) { 86 const protocol::ClipboardEvent& event) {
87 x_server_clipboard_.SetClipboard(event.mime_type(), event.data()); 87 x_server_clipboard_.SetClipboard(event.mime_type(), event.data());
88 } 88 }
89 89
90 void ClipboardX11::Stop() { 90 void ClipboardX11::Stop() {
91 client_clipboard_.reset(); 91 client_clipboard_.reset();
92 x_connection_watcher_.StopWatchingFileDescriptor(); 92 x_connection_watcher_.StopWatchingFileDescriptor();
93 93
94 if (display_) { 94 if (display_) {
95 XCloseDisplay(display_); 95 XCloseDisplay(display_);
96 display_ = NULL; 96 display_ = nullptr;
97 } 97 }
98 } 98 }
99 99
100 void ClipboardX11::OnFileCanReadWithoutBlocking(int fd) { 100 void ClipboardX11::OnFileCanReadWithoutBlocking(int fd) {
101 PumpXEvents(); 101 PumpXEvents();
102 } 102 }
103 103
104 void ClipboardX11::OnFileCanWriteWithoutBlocking(int fd) { 104 void ClipboardX11::OnFileCanWriteWithoutBlocking(int fd) {
105 } 105 }
106 106
(...skipping 16 matching lines...) Expand all
123 XNextEvent(display_, &event); 123 XNextEvent(display_, &event);
124 x_server_clipboard_.ProcessXEvent(&event); 124 x_server_clipboard_.ProcessXEvent(&event);
125 } 125 }
126 } 126 }
127 127
128 scoped_ptr<Clipboard> Clipboard::Create() { 128 scoped_ptr<Clipboard> Clipboard::Create() {
129 return make_scoped_ptr(new ClipboardX11()); 129 return make_scoped_ptr(new ClipboardX11());
130 } 130 }
131 131
132 } // namespace remoting 132 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/clipboard_win.cc ('k') | remoting/host/config_file_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698