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 "content/browser/utility_process_host_impl.h" | 5 #include "content/browser/utility_process_host_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 : exposed_dir_(exposed_dir), | 40 : exposed_dir_(exposed_dir), |
41 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
42 launch_elevated_(launch_elevated) | 42 launch_elevated_(launch_elevated) |
43 #elif defined(OS_POSIX) | 43 #elif defined(OS_POSIX) |
44 env_(env), | 44 env_(env), |
45 no_sandbox_(no_sandbox), | 45 no_sandbox_(no_sandbox), |
46 ipc_fd_(host->TakeClientFileDescriptor()) | 46 ipc_fd_(host->TakeClientFileDescriptor()) |
47 #endif // OS_WIN | 47 #endif // OS_WIN |
48 {} | 48 {} |
49 | 49 |
50 virtual ~UtilitySandboxedProcessLauncherDelegate() {} | 50 ~UtilitySandboxedProcessLauncherDelegate() override {} |
51 | 51 |
52 #if defined(OS_WIN) | 52 #if defined(OS_WIN) |
53 virtual bool ShouldLaunchElevated() override { | 53 virtual bool ShouldLaunchElevated() override { |
54 return launch_elevated_; | 54 return launch_elevated_; |
55 } | 55 } |
56 virtual void PreSandbox(bool* disable_default_policy, | 56 virtual void PreSandbox(bool* disable_default_policy, |
57 base::FilePath* exposed_dir) override { | 57 base::FilePath* exposed_dir) override { |
58 *exposed_dir = exposed_dir_; | 58 *exposed_dir = exposed_dir_; |
59 } | 59 } |
60 #elif defined(OS_POSIX) | 60 #elif defined(OS_POSIX) |
61 | 61 |
62 virtual bool ShouldUseZygote() override { | 62 bool ShouldUseZygote() override { |
63 return !no_sandbox_ && exposed_dir_.empty(); | 63 return !no_sandbox_ && exposed_dir_.empty(); |
64 } | 64 } |
65 virtual base::EnvironmentMap GetEnvironment() override { | 65 base::EnvironmentMap GetEnvironment() override { return env_; } |
66 return env_; | 66 base::ScopedFD TakeIpcFd() override { return ipc_fd_.Pass(); } |
67 } | |
68 virtual base::ScopedFD TakeIpcFd() override { | |
69 return ipc_fd_.Pass(); | |
70 } | |
71 #endif // OS_WIN | 67 #endif // OS_WIN |
72 | 68 |
73 private: | 69 private: |
74 | 70 |
75 base::FilePath exposed_dir_; | 71 base::FilePath exposed_dir_; |
76 | 72 |
77 #if defined(OS_WIN) | 73 #if defined(OS_WIN) |
78 bool launch_elevated_; | 74 bool launch_elevated_; |
79 #elif defined(OS_POSIX) | 75 #elif defined(OS_POSIX) |
80 base::EnvironmentMap env_; | 76 base::EnvironmentMap env_; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 if (!client_.get()) | 291 if (!client_.get()) |
296 return; | 292 return; |
297 | 293 |
298 client_task_runner_->PostTask( | 294 client_task_runner_->PostTask( |
299 FROM_HERE, | 295 FROM_HERE, |
300 base::Bind(&UtilityProcessHostClient::OnProcessCrashed, client_.get(), | 296 base::Bind(&UtilityProcessHostClient::OnProcessCrashed, client_.get(), |
301 exit_code)); | 297 exit_code)); |
302 } | 298 } |
303 | 299 |
304 } // namespace content | 300 } // namespace content |
OLD | NEW |