OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/common/sandbox_init_mac.h" | 5 #include "content/common/sandbox_init_mac.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "content/common/sandbox_mac.h" | 10 #include "content/common/sandbox_mac.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 *sandbox_type = SANDBOX_TYPE_PPAPI; | 65 *sandbox_type = SANDBOX_TYPE_PPAPI; |
66 } else { | 66 } else { |
67 // This is a process which we don't know about, i.e. an embedder-defined | 67 // This is a process which we don't know about, i.e. an embedder-defined |
68 // process. If the embedder wants it sandboxed, they have a chance to return | 68 // process. If the embedder wants it sandboxed, they have a chance to return |
69 // the sandbox profile in ContentClient::GetSandboxProfileForSandboxType. | 69 // the sandbox profile in ContentClient::GetSandboxProfileForSandboxType. |
70 return false; | 70 return false; |
71 } | 71 } |
72 return true; | 72 return true; |
73 } | 73 } |
74 | 74 |
| 75 void ExplicitlyWarmupSandbox() { |
| 76 int sandbox_type = 0; |
| 77 base::FilePath allowed_dir; |
| 78 if (!GetSandboxTypeFromCommandLine(&sandbox_type, &allowed_dir)) |
| 79 return; |
| 80 Sandbox::SandboxWarmup(sandbox_type); |
| 81 } |
| 82 |
| 83 bool ExplicitlyEnableSandbox() { |
| 84 int sandbox_type = 0; |
| 85 base::FilePath allowed_dir; |
| 86 if (!GetSandboxTypeFromCommandLine(&sandbox_type, &allowed_dir)) |
| 87 return true; |
| 88 return Sandbox::EnableSandbox(sandbox_type, allowed_dir); |
| 89 } |
| 90 |
75 bool InitializeSandbox() { | 91 bool InitializeSandbox() { |
76 int sandbox_type = 0; | 92 int sandbox_type = 0; |
77 base::FilePath allowed_dir; | 93 base::FilePath allowed_dir; |
78 if (!GetSandboxTypeFromCommandLine(&sandbox_type, &allowed_dir)) | 94 if (!GetSandboxTypeFromCommandLine(&sandbox_type, &allowed_dir)) |
79 return true; | 95 return true; |
80 return InitializeSandbox(sandbox_type, allowed_dir); | 96 return InitializeSandbox(sandbox_type, allowed_dir); |
81 } | 97 } |
82 | 98 |
83 } // namespace content | 99 } // namespace content |
OLD | NEW |