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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 | 467 |
468 std::string quoted_home_dir; | 468 std::string quoted_home_dir; |
469 if (!QuotePlainString(home_dir_canonical.value(), "ed_home_dir)) { | 469 if (!QuotePlainString(home_dir_canonical.value(), "ed_home_dir)) { |
470 FatalStringQuoteException(home_dir_canonical.value()); | 470 FatalStringQuoteException(home_dir_canonical.value()); |
471 return false; | 471 return false; |
472 } | 472 } |
473 | 473 |
474 if (!compiler.InsertStringParam("USER_HOMEDIR_AS_LITERAL", quoted_home_dir)) | 474 if (!compiler.InsertStringParam("USER_HOMEDIR_AS_LITERAL", quoted_home_dir)) |
475 return false; | 475 return false; |
476 | 476 |
477 bool lion_or_later = base::mac::IsOSLionOrLater(); | |
478 if (!compiler.InsertBooleanParam("LION_OR_LATER", lion_or_later)) | |
479 return false; | |
480 bool elcap_or_later = base::mac::IsOSElCapitanOrLater(); | 477 bool elcap_or_later = base::mac::IsOSElCapitanOrLater(); |
481 if (!compiler.InsertBooleanParam("ELCAP_OR_LATER", elcap_or_later)) | 478 if (!compiler.InsertBooleanParam("ELCAP_OR_LATER", elcap_or_later)) |
482 return false; | 479 return false; |
483 | 480 |
484 // Initialize sandbox. | 481 // Initialize sandbox. |
485 std::string error_str; | 482 std::string error_str; |
486 bool success = compiler.CompileAndApplyProfile(&error_str); | 483 bool success = compiler.CompileAndApplyProfile(&error_str); |
487 DLOG_IF(FATAL, !success) << "Failed to initialize sandbox: " << error_str; | 484 DLOG_IF(FATAL, !success) << "Failed to initialize sandbox: " << error_str; |
488 gSandboxIsActive = success; | 485 gSandboxIsActive = success; |
489 return success; | 486 return success; |
(...skipping 17 matching lines...) Expand all Loading... |
507 if (HANDLE_EINTR(fcntl(fd.get(), F_GETPATH, canonical_path)) != 0) { | 504 if (HANDLE_EINTR(fcntl(fd.get(), F_GETPATH, canonical_path)) != 0) { |
508 DPLOG(FATAL) << "GetCanonicalSandboxPath() failed for: " | 505 DPLOG(FATAL) << "GetCanonicalSandboxPath() failed for: " |
509 << path.value(); | 506 << path.value(); |
510 return path; | 507 return path; |
511 } | 508 } |
512 | 509 |
513 return base::FilePath(canonical_path); | 510 return base::FilePath(canonical_path); |
514 } | 511 } |
515 | 512 |
516 } // namespace content | 513 } // namespace content |
OLD | NEW |