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

Side by Side Diff: remoting/host/win/rdp_client.cc

Issue 112453002: Remove dependency on skia from remoting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « remoting/host/win/rdp_client.h ('k') | remoting/host/win/rdp_client_unittest.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/win/rdp_client.h" 5 #include "remoting/host/win/rdp_client.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/win/registry.h" 13 #include "base/win/registry.h"
14 #include "net/base/ip_endpoint.h" 14 #include "net/base/ip_endpoint.h"
15 #include "remoting/base/typed_buffer.h" 15 #include "remoting/base/typed_buffer.h"
16 #include "remoting/host/win/rdp_client_window.h" 16 #include "remoting/host/win/rdp_client_window.h"
17 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
17 18
18 namespace remoting { 19 namespace remoting {
19 20
20 namespace { 21 namespace {
21 22
22 // 127.0.0.1 is explicitly blocked by the RDP ActiveX control, so we use 23 // 127.0.0.1 is explicitly blocked by the RDP ActiveX control, so we use
23 // 127.0.0.2 instead. 24 // 127.0.0.2 instead.
24 const unsigned char kRdpLoopbackAddress[] = { 127, 0, 0, 2 }; 25 const unsigned char kRdpLoopbackAddress[] = { 127, 0, 0, 2 };
25 26
26 const int kDefaultRdpPort = 3389; 27 const int kDefaultRdpPort = 3389;
(...skipping 11 matching lines...) Expand all
38 class RdpClient::Core 39 class RdpClient::Core
39 : public base::RefCountedThreadSafe<Core>, 40 : public base::RefCountedThreadSafe<Core>,
40 public RdpClientWindow::EventHandler { 41 public RdpClientWindow::EventHandler {
41 public: 42 public:
42 Core( 43 Core(
43 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, 44 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
44 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 45 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
45 RdpClient::EventHandler* event_handler); 46 RdpClient::EventHandler* event_handler);
46 47
47 // Initiates a loopback RDP connection. 48 // Initiates a loopback RDP connection.
48 void Connect(const SkISize& screen_size, const std::string& terminal_id); 49 void Connect(const webrtc::DesktopSize& screen_size,
50 const std::string& terminal_id);
49 51
50 // Initiates a graceful shutdown of the RDP connection. 52 // Initiates a graceful shutdown of the RDP connection.
51 void Disconnect(); 53 void Disconnect();
52 54
53 // Sends Secure Attention Sequence to the session. 55 // Sends Secure Attention Sequence to the session.
54 void InjectSas(); 56 void InjectSas();
55 57
56 // RdpClientWindow::EventHandler interface. 58 // RdpClientWindow::EventHandler interface.
57 virtual void OnConnected() OVERRIDE; 59 virtual void OnConnected() OVERRIDE;
58 virtual void OnDisconnected() OVERRIDE; 60 virtual void OnDisconnected() OVERRIDE;
(...skipping 22 matching lines...) Expand all
81 83
82 // A self-reference to keep the object alive during connection shutdown. 84 // A self-reference to keep the object alive during connection shutdown.
83 scoped_refptr<Core> self_; 85 scoped_refptr<Core> self_;
84 86
85 DISALLOW_COPY_AND_ASSIGN(Core); 87 DISALLOW_COPY_AND_ASSIGN(Core);
86 }; 88 };
87 89
88 RdpClient::RdpClient( 90 RdpClient::RdpClient(
89 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, 91 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
90 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 92 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
91 const SkISize& screen_size, 93 const webrtc::DesktopSize& screen_size,
92 const std::string& terminal_id, 94 const std::string& terminal_id,
93 EventHandler* event_handler) { 95 EventHandler* event_handler) {
94 DCHECK(caller_task_runner->BelongsToCurrentThread()); 96 DCHECK(caller_task_runner->BelongsToCurrentThread());
95 97
96 core_ = new Core(caller_task_runner, ui_task_runner, event_handler); 98 core_ = new Core(caller_task_runner, ui_task_runner, event_handler);
97 core_->Connect(screen_size, terminal_id); 99 core_->Connect(screen_size, terminal_id);
98 } 100 }
99 101
100 RdpClient::~RdpClient() { 102 RdpClient::~RdpClient() {
101 DCHECK(CalledOnValidThread()); 103 DCHECK(CalledOnValidThread());
102 104
103 core_->Disconnect(); 105 core_->Disconnect();
104 } 106 }
105 107
106 void RdpClient::InjectSas() { 108 void RdpClient::InjectSas() {
107 DCHECK(CalledOnValidThread()); 109 DCHECK(CalledOnValidThread());
108 110
109 core_->InjectSas(); 111 core_->InjectSas();
110 } 112 }
111 113
112 RdpClient::Core::Core( 114 RdpClient::Core::Core(
113 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, 115 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
114 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 116 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
115 RdpClient::EventHandler* event_handler) 117 RdpClient::EventHandler* event_handler)
116 : caller_task_runner_(caller_task_runner), 118 : caller_task_runner_(caller_task_runner),
117 ui_task_runner_(ui_task_runner), 119 ui_task_runner_(ui_task_runner),
118 event_handler_(event_handler) { 120 event_handler_(event_handler) {
119 } 121 }
120 122
121 void RdpClient::Core::Connect(const SkISize& screen_size, 123 void RdpClient::Core::Connect(const webrtc::DesktopSize& screen_size,
122 const std::string& terminal_id) { 124 const std::string& terminal_id) {
123 if (!ui_task_runner_->BelongsToCurrentThread()) { 125 if (!ui_task_runner_->BelongsToCurrentThread()) {
124 ui_task_runner_->PostTask( 126 ui_task_runner_->PostTask(
125 FROM_HERE, base::Bind(&Core::Connect, this, screen_size, terminal_id)); 127 FROM_HERE, base::Bind(&Core::Connect, this, screen_size, terminal_id));
126 return; 128 return;
127 } 129 }
128 130
129 DCHECK_EQ(base::MessageLoop::current()->type(), base::MessageLoop::TYPE_UI); 131 DCHECK_EQ(base::MessageLoop::current()->type(), base::MessageLoop::TYPE_UI);
130 DCHECK(!rdp_client_window_); 132 DCHECK(!rdp_client_window_);
131 DCHECK(!self_); 133 DCHECK(!self_);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } 225 }
224 226
225 if (event_handler_) { 227 if (event_handler_) {
226 RdpClient::EventHandler* event_handler = event_handler_; 228 RdpClient::EventHandler* event_handler = event_handler_;
227 event_handler_ = NULL; 229 event_handler_ = NULL;
228 event_handler->OnRdpClosed(); 230 event_handler->OnRdpClosed();
229 } 231 }
230 } 232 }
231 233
232 } // namespace remoting 234 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/win/rdp_client.h ('k') | remoting/host/win/rdp_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698