OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/debug_util.h" |
5 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
6 #include "base/path_service.h" | 7 #include "base/path_service.h" |
7 #include "chrome/common/chrome_paths.h" | 8 #include "chrome/common/chrome_paths.h" |
8 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
9 #include "chrome/common/main_function_params.h" | 10 #include "chrome/common/main_function_params.h" |
10 #include "chrome/common/sandbox_policy.h" | 11 #include "chrome/common/sandbox_policy.h" |
11 #include "chrome/service/cloud_print/cloud_print_proxy.h" | 12 #include "chrome/service/cloud_print/cloud_print_proxy.h" |
12 #include "chrome/service/service_process.h" | 13 #include "chrome/service/service_process.h" |
13 | 14 |
14 // Mainline routine for running as the service process. | 15 // Mainline routine for running as the service process. |
15 int ServiceProcessMain(const MainFunctionParams& parameters) { | 16 int ServiceProcessMain(const MainFunctionParams& parameters) { |
16 MessageLoopForUI main_message_loop; | 17 MessageLoopForUI main_message_loop; |
| 18 if (parameters.command_line_.HasSwitch(switches::kWaitForDebugger)) { |
| 19 DebugUtil::WaitForDebugger(60, true); |
| 20 } |
| 21 |
17 PlatformThread::SetName("CrServiceMain"); | 22 PlatformThread::SetName("CrServiceMain"); |
18 | 23 |
19 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
20 sandbox::BrokerServices* broker_services = | 25 sandbox::BrokerServices* broker_services = |
21 parameters.sandbox_info_.BrokerServices(); | 26 parameters.sandbox_info_.BrokerServices(); |
22 if (broker_services) | 27 if (broker_services) |
23 sandbox::InitBrokerServices(broker_services); | 28 sandbox::InitBrokerServices(broker_services); |
24 #endif // defined(OS_WIN) | 29 #endif // defined(OS_WIN) |
25 | 30 |
26 ServiceProcess service_process; | 31 ServiceProcess service_process; |
27 service_process.Initialize(&main_message_loop); | 32 service_process.Initialize(&main_message_loop); |
28 | 33 |
29 // Enable Cloud Print if needed. | 34 // Enable Cloud Print if needed. |
30 if (parameters.command_line_.HasSwitch(switches::kEnableCloudPrintProxy)) { | 35 if (parameters.command_line_.HasSwitch(switches::kEnableCloudPrintProxy)) { |
31 std::string lsid = | 36 std::string lsid = |
32 parameters.command_line_.GetSwitchValueASCII( | 37 parameters.command_line_.GetSwitchValueASCII( |
33 switches::kServiceAccountLsid); | 38 switches::kServiceAccountLsid); |
34 service_process.GetCloudPrintProxy()->EnableForUser(lsid); | 39 service_process.GetCloudPrintProxy()->EnableForUser(lsid); |
35 } | 40 } |
36 | 41 |
37 MessageLoop::current()->Run(); | 42 MessageLoop::current()->Run(); |
38 service_process.Teardown(); | 43 service_process.Teardown(); |
39 return 0; | 44 return 0; |
40 } | 45 } |
OLD | NEW |