| 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/common/sandbox_mac.h" | 5 #include "content/common/sandbox_mac.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 if (!compiler.InsertStringParam("USER_HOMEDIR_AS_LITERAL", quoted_home_dir)) | 484 if (!compiler.InsertStringParam("USER_HOMEDIR_AS_LITERAL", quoted_home_dir)) |
| 485 return false; | 485 return false; |
| 486 | 486 |
| 487 bool lion_or_later = base::mac::IsOSLionOrLater(); | 487 bool lion_or_later = base::mac::IsOSLionOrLater(); |
| 488 if (!compiler.InsertBooleanParam("LION_OR_LATER", lion_or_later)) | 488 if (!compiler.InsertBooleanParam("LION_OR_LATER", lion_or_later)) |
| 489 return false; | 489 return false; |
| 490 bool elcap_or_later = base::mac::IsOSElCapitanOrLater(); | 490 bool elcap_or_later = base::mac::IsOSElCapitanOrLater(); |
| 491 if (!compiler.InsertBooleanParam("ELCAP_OR_LATER", elcap_or_later)) | 491 if (!compiler.InsertBooleanParam("ELCAP_OR_LATER", elcap_or_later)) |
| 492 return false; | 492 return false; |
| 493 | 493 |
| 494 #if defined(COMPONENT_BUILD) | |
| 495 // dlopen() fails without file-read-metadata access if the executable image | |
| 496 // contains LC_RPATH load commands. The components build uses those. | |
| 497 // See http://crbug.com/127465 | |
| 498 if (base::mac::IsOSSnowLeopard()) { | |
| 499 if (!compiler.InsertBooleanParam("COMPONENT_BUILD_WORKAROUND", true)) | |
| 500 return false; | |
| 501 } | |
| 502 #endif | |
| 503 | |
| 504 // Initialize sandbox. | 494 // Initialize sandbox. |
| 505 std::string error_str; | 495 std::string error_str; |
| 506 bool success = compiler.CompileAndApplyProfile(&error_str); | 496 bool success = compiler.CompileAndApplyProfile(&error_str); |
| 507 DLOG_IF(FATAL, !success) << "Failed to initialize sandbox: " << error_str; | 497 DLOG_IF(FATAL, !success) << "Failed to initialize sandbox: " << error_str; |
| 508 gSandboxIsActive = success; | 498 gSandboxIsActive = success; |
| 509 return success; | 499 return success; |
| 510 } | 500 } |
| 511 | 501 |
| 512 // static | 502 // static |
| 513 bool Sandbox::SandboxIsCurrentlyActive() { | 503 bool Sandbox::SandboxIsCurrentlyActive() { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 527 if (HANDLE_EINTR(fcntl(fd.get(), F_GETPATH, canonical_path)) != 0) { | 517 if (HANDLE_EINTR(fcntl(fd.get(), F_GETPATH, canonical_path)) != 0) { |
| 528 DPLOG(FATAL) << "GetCanonicalSandboxPath() failed for: " | 518 DPLOG(FATAL) << "GetCanonicalSandboxPath() failed for: " |
| 529 << path.value(); | 519 << path.value(); |
| 530 return path; | 520 return path; |
| 531 } | 521 } |
| 532 | 522 |
| 533 return base::FilePath(canonical_path); | 523 return base::FilePath(canonical_path); |
| 534 } | 524 } |
| 535 | 525 |
| 536 } // namespace content | 526 } // namespace content |
| OLD | NEW |