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/chromoting_host_context.h" | 5 #include "remoting/host/chromoting_host_context.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| 11 #include "ipc/ipc_channel.h" |
| 12 #include "ipc/ipc_channel_proxy.h" |
11 #include "remoting/host/url_request_context.h" | 13 #include "remoting/host/url_request_context.h" |
12 | 14 |
13 namespace remoting { | 15 namespace remoting { |
14 | 16 |
15 ChromotingHostContext::ChromotingHostContext( | 17 ChromotingHostContext::ChromotingHostContext( |
16 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) | 18 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) |
17 : network_thread_("ChromotingNetworkThread"), | 19 : network_thread_("ChromotingNetworkThread"), |
18 capture_thread_("ChromotingCaptureThread"), | 20 capture_thread_("ChromotingCaptureThread"), |
19 encode_thread_("ChromotingEncodeThread"), | 21 encode_thread_("ChromotingEncodeThread"), |
20 desktop_thread_("ChromotingDesktopThread"), | 22 desktop_thread_("ChromotingDesktopThread"), |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 61 } |
60 | 62 |
61 base::SingleThreadTaskRunner* ChromotingHostContext::ui_task_runner() { | 63 base::SingleThreadTaskRunner* ChromotingHostContext::ui_task_runner() { |
62 return ui_task_runner_; | 64 return ui_task_runner_; |
63 } | 65 } |
64 | 66 |
65 base::SingleThreadTaskRunner* ChromotingHostContext::file_task_runner() { | 67 base::SingleThreadTaskRunner* ChromotingHostContext::file_task_runner() { |
66 return file_thread_.message_loop_proxy(); | 68 return file_thread_.message_loop_proxy(); |
67 } | 69 } |
68 | 70 |
| 71 IPC::ChannelProxy* ChromotingHostContext::daemon_channel() { |
| 72 return daemon_channel_.get(); |
| 73 } |
| 74 |
| 75 void ChromotingHostContext::ConnectToDaemon(const std::string& channel_name, |
| 76 IPC::Listener* listener) { |
| 77 daemon_channel_.reset(new IPC::ChannelProxy( |
| 78 channel_name, IPC::Channel::MODE_CLIENT, listener, |
| 79 network_task_runner())); |
| 80 } |
| 81 |
| 82 void ChromotingHostContext::DisconnectFromDaemon() { |
| 83 daemon_channel_.reset(NULL); |
| 84 } |
| 85 |
69 const scoped_refptr<net::URLRequestContextGetter>& | 86 const scoped_refptr<net::URLRequestContextGetter>& |
70 ChromotingHostContext::url_request_context_getter() { | 87 ChromotingHostContext::url_request_context_getter() { |
71 DCHECK(url_request_context_getter_.get()); | 88 DCHECK(url_request_context_getter_.get()); |
72 return url_request_context_getter_; | 89 return url_request_context_getter_; |
73 } | 90 } |
74 | 91 |
75 } // namespace remoting | 92 } // namespace remoting |
OLD | NEW |