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

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

Issue 13212009: Made DesktopEnvironment responsible for creation of the disconnect window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Mac Created 7 years, 8 months 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/chromoting_host_unittest.cc ('k') | remoting/host/desktop_process_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) 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 // This file implements the Windows service controlling Me2Me host processes 5 // This file implements the Windows service controlling Me2Me host processes
6 // running within user sessions. 6 // running within user sessions.
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "remoting/base/auto_thread.h" 14 #include "remoting/base/auto_thread.h"
15 #include "remoting/base/auto_thread_task_runner.h" 15 #include "remoting/base/auto_thread_task_runner.h"
16 #include "remoting/host/desktop_process.h" 16 #include "remoting/host/desktop_process.h"
17 #include "remoting/host/host_exit_codes.h" 17 #include "remoting/host/host_exit_codes.h"
18 #include "remoting/host/host_main.h" 18 #include "remoting/host/host_main.h"
19 #include "remoting/host/ipc_constants.h" 19 #include "remoting/host/ipc_constants.h"
20 #include "remoting/host/me2me_desktop_environment.h" 20 #include "remoting/host/me2me_desktop_environment.h"
21 #include "remoting/host/ui_strings.h"
21 #include "remoting/host/win/session_desktop_environment.h" 22 #include "remoting/host/win/session_desktop_environment.h"
22 23
23 namespace remoting { 24 namespace remoting {
24 25
25 int DesktopProcessMain() { 26 int DesktopProcessMain() {
26 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 27 const CommandLine* command_line = CommandLine::ForCurrentProcess();
27 std::string channel_name = 28 std::string channel_name =
28 command_line->GetSwitchValueASCII(kDaemonPipeSwitchName); 29 command_line->GetSwitchValueASCII(kDaemonPipeSwitchName);
29 30
30 if (channel_name.empty()) 31 if (channel_name.empty())
31 return kUsageExitCode; 32 return kUsageExitCode;
32 33
33 MessageLoop message_loop(MessageLoop::TYPE_UI); 34 MessageLoop message_loop(MessageLoop::TYPE_UI);
34 base::RunLoop run_loop; 35 base::RunLoop run_loop;
35 scoped_refptr<AutoThreadTaskRunner> ui_task_runner = 36 scoped_refptr<AutoThreadTaskRunner> ui_task_runner =
36 new AutoThreadTaskRunner(message_loop.message_loop_proxy(), 37 new AutoThreadTaskRunner(message_loop.message_loop_proxy(),
37 run_loop.QuitClosure()); 38 run_loop.QuitClosure());
38 39
39 // Launch the input thread. 40 // Launch the input thread.
40 scoped_refptr<AutoThreadTaskRunner> input_task_runner = 41 scoped_refptr<AutoThreadTaskRunner> input_task_runner =
41 AutoThread::CreateWithType("Input thread", ui_task_runner, 42 AutoThread::CreateWithType("Input thread", ui_task_runner,
42 MessageLoop::TYPE_IO); 43 MessageLoop::TYPE_IO);
43 44
44 DesktopProcess desktop_process(ui_task_runner, 45 DesktopProcess desktop_process(ui_task_runner,
45 input_task_runner, 46 input_task_runner,
46 channel_name); 47 channel_name);
47 48
49 // TODO(alexeypa): Localize the UI strings. See http://crbug.com/155204.
50 UiStrings ui_string;
51
48 // Create a platform-dependent environment factory. 52 // Create a platform-dependent environment factory.
49 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory; 53 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory;
50 #if defined(OS_WIN) 54 #if defined(OS_WIN)
51 desktop_environment_factory.reset( 55 desktop_environment_factory.reset(
52 new SessionDesktopEnvironmentFactory( 56 new SessionDesktopEnvironmentFactory(
53 ui_task_runner, 57 ui_task_runner,
54 input_task_runner, 58 input_task_runner,
55 ui_task_runner, 59 ui_task_runner,
60 ui_string,
56 base::Bind(&DesktopProcess::InjectSas, 61 base::Bind(&DesktopProcess::InjectSas,
57 desktop_process.AsWeakPtr()))); 62 desktop_process.AsWeakPtr())));
58 #else // !defined(OS_WIN) 63 #else // !defined(OS_WIN)
59 desktop_environment_factory.reset(new Me2MeDesktopEnvironmentFactory( 64 desktop_environment_factory.reset(new Me2MeDesktopEnvironmentFactory(
60 ui_task_runner, 65 ui_task_runner,
61 input_task_runner, 66 input_task_runner,
62 ui_task_runner)); 67 ui_task_runner,
68 ui_string));
63 #endif // !defined(OS_WIN) 69 #endif // !defined(OS_WIN)
64 70
65 if (!desktop_process.Start(desktop_environment_factory.Pass())) 71 if (!desktop_process.Start(desktop_environment_factory.Pass()))
66 return kInitializationFailed; 72 return kInitializationFailed;
67 73
68 // Run the UI message loop. 74 // Run the UI message loop.
69 ui_task_runner = NULL; 75 ui_task_runner = NULL;
70 run_loop.Run(); 76 run_loop.Run();
71 77
72 return kSuccessExitCode; 78 return kSuccessExitCode;
73 } 79 }
74 80
75 } // namespace remoting 81 } // namespace remoting
76 82
77 #if !defined(OS_WIN) 83 #if !defined(OS_WIN)
78 int main(int argc, char** argv) { 84 int main(int argc, char** argv) {
79 return remoting::HostMain(argc, argv); 85 return remoting::HostMain(argc, argv);
80 } 86 }
81 #endif // !defined(OS_WIN) 87 #endif // !defined(OS_WIN)
OLDNEW
« no previous file with comments | « remoting/host/chromoting_host_unittest.cc ('k') | remoting/host/desktop_process_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698