| 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 "content/browser/sandbox_parameters_mac.h" | 5 #include "content/browser/sandbox_parameters_mac.h" |
| 6 | 6 |
| 7 #include <unistd.h> | 7 #include <unistd.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 CHECK(client->SetBooleanParameter(Sandbox::kSandboxEnableLogging, | 29 CHECK(client->SetBooleanParameter(Sandbox::kSandboxEnableLogging, |
| 30 enable_logging)); | 30 enable_logging)); |
| 31 CHECK(client->SetBooleanParameter(Sandbox::kSandboxDisableDenialLogging, | 31 CHECK(client->SetBooleanParameter(Sandbox::kSandboxDisableDenialLogging, |
| 32 !enable_logging)); | 32 !enable_logging)); |
| 33 | 33 |
| 34 std::string homedir = | 34 std::string homedir = |
| 35 Sandbox::GetCanonicalSandboxPath(base::GetHomeDir()).value(); | 35 Sandbox::GetCanonicalSandboxPath(base::GetHomeDir()).value(); |
| 36 CHECK(client->SetParameter(Sandbox::kSandboxHomedirAsLiteral, homedir)); | 36 CHECK(client->SetParameter(Sandbox::kSandboxHomedirAsLiteral, homedir)); |
| 37 | 37 |
| 38 CHECK(client->SetBooleanParameter(Sandbox::kSandboxMavericks, |
| 39 base::mac::IsOS10_9())); |
| 40 |
| 38 bool elcap_or_later = base::mac::IsAtLeastOS10_11(); | 41 bool elcap_or_later = base::mac::IsAtLeastOS10_11(); |
| 39 CHECK(client->SetBooleanParameter(Sandbox::kSandboxElCapOrLater, | 42 CHECK(client->SetBooleanParameter(Sandbox::kSandboxElCapOrLater, |
| 40 elcap_or_later)); | 43 elcap_or_later)); |
| 41 | 44 |
| 42 std::string bundle_path = | 45 std::string bundle_path = |
| 43 Sandbox::GetCanonicalSandboxPath(base::mac::MainBundlePath()).value(); | 46 Sandbox::GetCanonicalSandboxPath(base::mac::MainBundlePath()).value(); |
| 44 CHECK(client->SetParameter(Sandbox::kSandboxBundlePath, bundle_path)); | 47 CHECK(client->SetParameter(Sandbox::kSandboxBundlePath, bundle_path)); |
| 45 | 48 |
| 46 NSBundle* bundle = base::mac::OuterBundle(); | 49 NSBundle* bundle = base::mac::OuterBundle(); |
| 47 std::string bundle_id = base::SysNSStringToUTF8([bundle bundleIdentifier]); | 50 std::string bundle_id = base::SysNSStringToUTF8([bundle bundleIdentifier]); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 60 // the dylibs live. | 63 // the dylibs live. |
| 61 base::FilePath component_path = base::mac::MainBundlePath().Append(".."); | 64 base::FilePath component_path = base::mac::MainBundlePath().Append(".."); |
| 62 std::string component_path_canonical = | 65 std::string component_path_canonical = |
| 63 Sandbox::GetCanonicalSandboxPath(component_path).value(); | 66 Sandbox::GetCanonicalSandboxPath(component_path).value(); |
| 64 CHECK(client->SetParameter(Sandbox::kSandboxComponentPath, | 67 CHECK(client->SetParameter(Sandbox::kSandboxComponentPath, |
| 65 component_path_canonical)); | 68 component_path_canonical)); |
| 66 #endif | 69 #endif |
| 67 } | 70 } |
| 68 | 71 |
| 69 } // namespace content | 72 } // namespace content |
| OLD | NEW |