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); |
| 30 |
| 31 protected: |
29 virtual ~DesktopSessionAgentWin(); | 32 virtual ~DesktopSessionAgentWin(); |
30 | 33 |
31 protected: | 34 virtual bool CreateChannelForNetworkProcess( |
32 virtual bool DoCreateNetworkChannel( | |
33 IPC::PlatformFileForTransit* client_out, | 35 IPC::PlatformFileForTransit* client_out, |
34 scoped_ptr<IPC::ChannelProxy>* server_out) OVERRIDE; | 36 scoped_ptr<IPC::ChannelProxy>* server_out) OVERRIDE; |
35 | 37 |
36 private: | 38 private: |
37 DISALLOW_COPY_AND_ASSIGN(DesktopSessionAgentWin); | 39 DISALLOW_COPY_AND_ASSIGN(DesktopSessionAgentWin); |
38 }; | 40 }; |
39 | 41 |
40 DesktopSessionAgentWin::DesktopSessionAgentWin( | 42 DesktopSessionAgentWin::DesktopSessionAgentWin( |
41 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 43 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
42 scoped_refptr<AutoThreadTaskRunner> io_task_runner) | 44 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
43 : DesktopSessionAgent(caller_task_runner, io_task_runner) { | 45 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner) |
| 46 : DesktopSessionAgent(caller_task_runner, |
| 47 io_task_runner, |
| 48 video_capture_task_runner) { |
44 } | 49 } |
45 | 50 |
46 DesktopSessionAgentWin::~DesktopSessionAgentWin() { | 51 DesktopSessionAgentWin::~DesktopSessionAgentWin() { |
47 } | 52 } |
48 | 53 |
49 bool DesktopSessionAgentWin::DoCreateNetworkChannel( | 54 bool DesktopSessionAgentWin::CreateChannelForNetworkProcess( |
50 IPC::PlatformFileForTransit* client_out, | 55 IPC::PlatformFileForTransit* client_out, |
51 scoped_ptr<IPC::ChannelProxy>* server_out) { | 56 scoped_ptr<IPC::ChannelProxy>* server_out) { |
52 // Generate a unique name for the channel. | 57 // Generate a unique name for the channel. |
53 std::string channel_name = IPC::Channel::GenerateUniqueRandomChannelID(); | 58 std::string channel_name = IPC::Channel::GenerateUniqueRandomChannelID(); |
54 | 59 |
55 // presubmit: allow wstring | 60 // presubmit: allow wstring |
56 std::wstring user_sid; | 61 std::wstring user_sid; |
57 if (!base::win::GetUserSidString(&user_sid)) { | 62 if (!base::win::GetUserSidString(&user_sid)) { |
58 LOG(ERROR) << "Failed to query the current user SID."; | 63 LOG(ERROR) << "Failed to query the current user SID."; |
59 return false; | 64 return false; |
(...skipping 13 matching lines...) Expand all Loading... |
73 io_task_runner(), this, &client, &server)) { | 78 io_task_runner(), this, &client, &server)) { |
74 return false; | 79 return false; |
75 } | 80 } |
76 | 81 |
77 *client_out = client.Take(); | 82 *client_out = client.Take(); |
78 *server_out = server.Pass(); | 83 *server_out = server.Pass(); |
79 return true; | 84 return true; |
80 } | 85 } |
81 | 86 |
82 // static | 87 // static |
83 scoped_ptr<DesktopSessionAgent> DesktopSessionAgent::Create( | 88 scoped_refptr<DesktopSessionAgent> DesktopSessionAgent::Create( |
84 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 89 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
85 scoped_refptr<AutoThreadTaskRunner> io_task_runner) { | 90 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
86 return scoped_ptr<DesktopSessionAgent>(new DesktopSessionAgentWin( | 91 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner) { |
87 caller_task_runner, io_task_runner)); | 92 return scoped_refptr<DesktopSessionAgent>(new DesktopSessionAgentWin( |
| 93 caller_task_runner, io_task_runner, video_capture_task_runner)); |
88 } | 94 } |
89 | 95 |
90 } // namespace remoting | 96 } // namespace remoting |
OLD | NEW |