OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/metrics/field_trial.h" | 6 #include "base/metrics/field_trial.h" |
| 7 #include "base/path_service.h" |
7 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
8 #include "base/win/scoped_handle.h" | 9 #include "base/win/scoped_handle.h" |
9 #include "base/win/win_util.h" | 10 #include "base/win/win_util.h" |
10 #include "content/browser/child_process_launcher_helper.h" | 11 #include "content/browser/child_process_launcher_helper.h" |
11 #include "content/common/sandbox_win.h" | 12 #include "content/common/sandbox_win.h" |
12 #include "content/public/common/result_codes.h" | 13 #include "content/public/common/result_codes.h" |
13 #include "content/public/common/sandbox_init.h" | 14 #include "content/public/common/sandbox_init.h" |
14 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 15 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
15 #include "mojo/edk/embedder/named_platform_channel_pair.h" | 16 #include "mojo/edk/embedder/named_platform_channel_pair.h" |
16 #include "mojo/edk/embedder/platform_channel_pair.h" | 17 #include "mojo/edk/embedder/platform_channel_pair.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 } | 109 } |
109 | 110 |
110 // static | 111 // static |
111 void ChildProcessLauncherHelper::SetProcessBackgroundedOnLauncherThread( | 112 void ChildProcessLauncherHelper::SetProcessBackgroundedOnLauncherThread( |
112 base::Process process, bool background) { | 113 base::Process process, bool background) { |
113 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); | 114 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); |
114 if (process.CanBackgroundProcesses()) | 115 if (process.CanBackgroundProcesses()) |
115 process.SetProcessBackgrounded(background); | 116 process.SetProcessBackgrounded(background); |
116 } | 117 } |
117 | 118 |
| 119 // static |
| 120 base::File ChildProcessLauncherHelper::OpenFile( |
| 121 const base::FilePath& path, |
| 122 base::MemoryMappedFile::Region* region) { |
| 123 base::FilePath exe_dir; |
| 124 bool result = base::PathService::Get(base::BasePathKey::DIR_EXE, &exe_dir); |
| 125 DCHECK(result); |
| 126 base::File file(exe_dir.Append(path), |
| 127 base::File::FLAG_OPEN | base::File::FLAG_READ); |
| 128 *region = base::MemoryMappedFile::Region::kWholeFile; |
| 129 return file; |
| 130 } |
| 131 |
118 } // namespace internal | 132 } // namespace internal |
119 } // namespace content | 133 } // namespace content |
OLD | NEW |