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

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

Issue 11231060: [Chromoting] The desktop process now creates a pre-connected pipe and passes (with some help of the… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 1 month 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/desktop_session_agent_posix.cc ('k') | remoting/host/desktop_session_connector.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "remoting/host/desktop_session_agent.h"
6
7 #include "base/logging.h"
8 #include "base/single_thread_task_runner.h"
9 #include "base/stringprintf.h"
10 #include "base/utf_string_conversions.h"
11 #include "base/win/scoped_handle.h"
12 #include "base/win/win_util.h"
13 #include "ipc/ipc_channel.h"
14 #include "ipc/ipc_channel_proxy.h"
15 #include "remoting/base/auto_thread_task_runner.h"
16 #include "remoting/host/win/launch_process_with_token.h"
17
18 using base::win::ScopedHandle;
19
20 namespace remoting {
21
22 // Provides screen/audio capturing and input injection services for
23 // the network process.
24 class DesktopSessionAgentWin : public DesktopSessionAgent {
25 public:
26 DesktopSessionAgentWin(
27 scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
28 scoped_refptr<AutoThreadTaskRunner> io_task_runner);
29 virtual ~DesktopSessionAgentWin();
30
31 protected:
32 virtual bool DoCreateNetworkChannel(
33 IPC::PlatformFileForTransit* client_out,
34 scoped_ptr<IPC::ChannelProxy>* server_out) OVERRIDE;
35
36 private:
37 DISALLOW_COPY_AND_ASSIGN(DesktopSessionAgentWin);
38 };
39
40 DesktopSessionAgentWin::DesktopSessionAgentWin(
41 scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
42 scoped_refptr<AutoThreadTaskRunner> io_task_runner)
43 : DesktopSessionAgent(caller_task_runner, io_task_runner) {
44 }
45
46 DesktopSessionAgentWin::~DesktopSessionAgentWin() {
47 }
48
49 bool DesktopSessionAgentWin::DoCreateNetworkChannel(
50 IPC::PlatformFileForTransit* client_out,
51 scoped_ptr<IPC::ChannelProxy>* server_out) {
52 // Generate a unique name for the channel.
53 std::string channel_name = IPC::Channel::GenerateUniqueRandomChannelID();
54
55 // presubmit: allow wstring
56 std::wstring user_sid;
57 if (!base::win::GetUserSidString(&user_sid)) {
58 LOG(ERROR) << "Failed to query the current user SID.";
59 return false;
60 }
61
62 // Create a security descriptor that will be used to protect the named pipe in
63 // between CreateNamedPipe() and CreateFile() calls before it will be passed
64 // to the network process. It gives full access to the account that
65 // the calling code is running under and denies access by anyone else.
66 std::string security_descriptor = base::StringPrintf(
67 "O:%1$sG:%1$sD:(A;;GA;;;%1$s)", WideToUTF8(user_sid).c_str());
68
69 // Create a connected IPC channel.
70 ScopedHandle client;
71 scoped_ptr<IPC::ChannelProxy> server;
72 if (!CreateConnectedIpcChannel(channel_name, security_descriptor,
73 io_task_runner(), this, &client, &server)) {
74 return false;
75 }
76
77 *client_out = client.Take();
78 *server_out = server.Pass();
79 return true;
80 }
81
82 // static
83 scoped_ptr<DesktopSessionAgent> DesktopSessionAgent::Create(
84 scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
85 scoped_refptr<AutoThreadTaskRunner> io_task_runner) {
86 return scoped_ptr<DesktopSessionAgent>(new DesktopSessionAgentWin(
87 caller_task_runner, io_task_runner));
88 }
89
90 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/desktop_session_agent_posix.cc ('k') | remoting/host/desktop_session_connector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698