| 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/desktop_session_agent.h" | 5 #include "remoting/host/desktop_session_agent.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "base/win/scoped_handle.h" | 11 #include "base/win/scoped_handle.h" |
| 12 #include "base/win/win_util.h" | 12 #include "base/win/win_util.h" |
| 13 #include "ipc/ipc_channel.h" | 13 #include "ipc/ipc_channel.h" |
| 14 #include "ipc/ipc_channel_proxy.h" | 14 #include "ipc/ipc_channel_proxy.h" |
| 15 #include "remoting/base/auto_thread_task_runner.h" | 15 #include "remoting/base/auto_thread_task_runner.h" |
| 16 #include "remoting/host/win/launch_process_with_token.h" | 16 #include "remoting/host/win/launch_process_with_token.h" |
| 17 | 17 |
| 18 using base::win::ScopedHandle; | 18 using base::win::ScopedHandle; |
| 19 | 19 |
| 20 namespace remoting { | 20 namespace remoting { |
| 21 | 21 |
| 22 // Provides screen/audio capturing and input injection services for | 22 // Provides screen/audio capturing and input injection services for |
| 23 // the network process. | 23 // the network process. |
| 24 class DesktopSessionAgentWin : public DesktopSessionAgent { | 24 class DesktopSessionAgentWin : public DesktopSessionAgent { |
| 25 public: | 25 public: |
| 26 DesktopSessionAgentWin( | 26 DesktopSessionAgentWin( |
| 27 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 27 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
| 28 scoped_refptr<AutoThreadTaskRunner> io_task_runner); | 28 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
| 29 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner); |
| 29 virtual ~DesktopSessionAgentWin(); | 30 virtual ~DesktopSessionAgentWin(); |
| 30 | 31 |
| 31 protected: | 32 protected: |
| 32 virtual bool DoCreateNetworkChannel( | 33 virtual bool DoCreateNetworkChannel( |
| 33 IPC::PlatformFileForTransit* client_out, | 34 IPC::PlatformFileForTransit* client_out, |
| 34 scoped_ptr<IPC::ChannelProxy>* server_out) OVERRIDE; | 35 scoped_ptr<IPC::ChannelProxy>* server_out) OVERRIDE; |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 DISALLOW_COPY_AND_ASSIGN(DesktopSessionAgentWin); | 38 DISALLOW_COPY_AND_ASSIGN(DesktopSessionAgentWin); |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 DesktopSessionAgentWin::DesktopSessionAgentWin( | 41 DesktopSessionAgentWin::DesktopSessionAgentWin( |
| 41 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 42 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
| 42 scoped_refptr<AutoThreadTaskRunner> io_task_runner) | 43 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
| 43 : DesktopSessionAgent(caller_task_runner, io_task_runner) { | 44 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner) |
| 45 : DesktopSessionAgent(caller_task_runner, |
| 46 io_task_runner, |
| 47 video_capture_task_runner) { |
| 44 } | 48 } |
| 45 | 49 |
| 46 DesktopSessionAgentWin::~DesktopSessionAgentWin() { | 50 DesktopSessionAgentWin::~DesktopSessionAgentWin() { |
| 47 } | 51 } |
| 48 | 52 |
| 49 bool DesktopSessionAgentWin::DoCreateNetworkChannel( | 53 bool DesktopSessionAgentWin::DoCreateNetworkChannel( |
| 50 IPC::PlatformFileForTransit* client_out, | 54 IPC::PlatformFileForTransit* client_out, |
| 51 scoped_ptr<IPC::ChannelProxy>* server_out) { | 55 scoped_ptr<IPC::ChannelProxy>* server_out) { |
| 52 // Generate a unique name for the channel. | 56 // Generate a unique name for the channel. |
| 53 std::string channel_name = IPC::Channel::GenerateUniqueRandomChannelID(); | 57 std::string channel_name = IPC::Channel::GenerateUniqueRandomChannelID(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 73 io_task_runner(), this, &client, &server)) { | 77 io_task_runner(), this, &client, &server)) { |
| 74 return false; | 78 return false; |
| 75 } | 79 } |
| 76 | 80 |
| 77 *client_out = client.Take(); | 81 *client_out = client.Take(); |
| 78 *server_out = server.Pass(); | 82 *server_out = server.Pass(); |
| 79 return true; | 83 return true; |
| 80 } | 84 } |
| 81 | 85 |
| 82 // static | 86 // static |
| 83 scoped_ptr<DesktopSessionAgent> DesktopSessionAgent::Create( | 87 scoped_refptr<DesktopSessionAgent> DesktopSessionAgent::Create( |
| 84 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 88 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
| 85 scoped_refptr<AutoThreadTaskRunner> io_task_runner) { | 89 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
| 86 return scoped_ptr<DesktopSessionAgent>(new DesktopSessionAgentWin( | 90 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner) { |
| 87 caller_task_runner, io_task_runner)); | 91 return scoped_refptr<DesktopSessionAgent>(new DesktopSessionAgentWin( |
| 92 caller_task_runner, io_task_runner, video_capture_task_runner)); |
| 88 } | 93 } |
| 89 | 94 |
| 90 } // namespace remoting | 95 } // namespace remoting |
| OLD | NEW |