| 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 "base/debug/debugger.h" | 5 #include "base/debug/debugger.h" |
| 6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "chrome/common/chrome_switches.h" | 7 #include "chrome/common/chrome_switches.h" |
| 8 #include "chrome/common/service_process_util.h" | 8 #include "chrome/common/service_process_util.h" |
| 9 #include "chrome/service/service_process.h" | 9 #include "chrome/service/service_process.h" |
| 10 #include "content/public/common/main_function_params.h" | 10 #include "content/public/common/main_function_params.h" |
| 11 #include "net/url_request/url_request.h" | 11 #include "net/url_request/url_request.h" |
| 12 | 12 |
| 13 #if defined(OS_WIN) | 13 #if defined(OS_WIN) |
| 14 #include "content/common/sandbox_policy.h" | 14 #include "content/public/common/sandbox_init.h" |
| 15 #include "sandbox/src/sandbox_types.h" | 15 #include "sandbox/src/sandbox_types.h" |
| 16 #elif defined(OS_MACOSX) | 16 #elif defined(OS_MACOSX) |
| 17 #include "chrome/service/chrome_service_application_mac.h" | 17 #include "chrome/service/chrome_service_application_mac.h" |
| 18 #endif // defined(OS_WIN) | 18 #endif // defined(OS_WIN) |
| 19 | 19 |
| 20 // Mainline routine for running as the service process. | 20 // Mainline routine for running as the service process. |
| 21 int ServiceProcessMain(const content::MainFunctionParams& parameters) { | 21 int ServiceProcessMain(const content::MainFunctionParams& parameters) { |
| 22 // Chrome disallows cookies by default. All code paths that want to use | 22 // Chrome disallows cookies by default. All code paths that want to use |
| 23 // cookies should go through the browser process. | 23 // cookies should go through the browser process. |
| 24 net::URLRequest::SetDefaultCookiePolicyToBlock(); | 24 net::URLRequest::SetDefaultCookiePolicyToBlock(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 37 << parameters.command_line.GetCommandLineString(); | 37 << parameters.command_line.GetCommandLineString(); |
| 38 | 38 |
| 39 base::PlatformThread::SetName("CrServiceMain"); | 39 base::PlatformThread::SetName("CrServiceMain"); |
| 40 | 40 |
| 41 // If there is already a service process running, quit now. | 41 // If there is already a service process running, quit now. |
| 42 scoped_ptr<ServiceProcessState> state(new ServiceProcessState); | 42 scoped_ptr<ServiceProcessState> state(new ServiceProcessState); |
| 43 if (!state->Initialize()) | 43 if (!state->Initialize()) |
| 44 return 0; | 44 return 0; |
| 45 | 45 |
| 46 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
| 47 sandbox::BrokerServices* broker_services = | 47 content::InitializeSandbox(parameters.sandbox_info); |
| 48 parameters.sandbox_info->broker_services; | |
| 49 if (broker_services) | |
| 50 sandbox::InitBrokerServices(broker_services); | |
| 51 #endif // defined(OS_WIN) | 48 #endif // defined(OS_WIN) |
| 52 | 49 |
| 53 ServiceProcess service_process; | 50 ServiceProcess service_process; |
| 54 if (service_process.Initialize(&main_message_loop, | 51 if (service_process.Initialize(&main_message_loop, |
| 55 parameters.command_line, | 52 parameters.command_line, |
| 56 state.release())) { | 53 state.release())) { |
| 57 MessageLoop::current()->Run(); | 54 MessageLoop::current()->Run(); |
| 58 } else { | 55 } else { |
| 59 LOG(ERROR) << "Service process failed to initialize"; | 56 LOG(ERROR) << "Service process failed to initialize"; |
| 60 } | 57 } |
| 61 service_process.Teardown(); | 58 service_process.Teardown(); |
| 62 return 0; | 59 return 0; |
| 63 } | 60 } |
| OLD | NEW |