| 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 | 8 |
| 9 extern "C" { | 9 extern "C" { |
| 10 #include <sandbox.h> | 10 #include <sandbox.h> |
| 11 } | 11 } |
| 12 #include <signal.h> | 12 #include <signal.h> |
| 13 #include <sys/param.h> | 13 #include <sys/param.h> |
| 14 | 14 |
| 15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
| 18 #include "base/file_util.h" | 18 #include "base/file_util.h" |
| 19 #include "base/mac/mac_util.h" | 19 #include "base/mac/mac_util.h" |
| 20 #include "base/mac/scoped_cftyperef.h" | 20 #include "base/mac/scoped_cftyperef.h" |
| 21 #include "base/mac/scoped_nsautorelease_pool.h" | 21 #include "base/mac/scoped_nsautorelease_pool.h" |
| 22 #include "base/memory/scoped_nsobject.h" | 22 #include "base/memory/scoped_nsobject.h" |
| 23 #include "base/rand_util_c.h" | 23 #include "base/rand_util.h" |
| 24 #include "base/string16.h" | 24 #include "base/string16.h" |
| 25 #include "base/string_piece.h" | 25 #include "base/string_piece.h" |
| 26 #include "base/string_util.h" | 26 #include "base/string_util.h" |
| 27 #include "base/stringprintf.h" | 27 #include "base/stringprintf.h" |
| 28 #include "base/sys_info.h" | 28 #include "base/sys_info.h" |
| 29 #include "base/sys_string_conversions.h" | 29 #include "base/sys_string_conversions.h" |
| 30 #include "base/utf_string_conversions.h" | 30 #include "base/utf_string_conversions.h" |
| 31 #include "content/public/common/content_client.h" | 31 #include "content/public/common/content_client.h" |
| 32 #include "content/public/common/content_switches.h" | 32 #include "content/public/common/content_switches.h" |
| 33 #include "grit/content_resources.h" | 33 #include "grit/content_resources.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 NSData* data = [NSData dataWithBytes:png_header | 259 NSData* data = [NSData dataWithBytes:png_header |
| 260 length:arraysize(png_header)]; | 260 length:arraysize(png_header)]; |
| 261 base::mac::ScopedCFTypeRef<CGImageSourceRef> img( | 261 base::mac::ScopedCFTypeRef<CGImageSourceRef> img( |
| 262 CGImageSourceCreateWithData((CFDataRef)data, | 262 CGImageSourceCreateWithData((CFDataRef)data, |
| 263 NULL)); | 263 NULL)); |
| 264 CGImageSourceGetStatus(img); | 264 CGImageSourceGetStatus(img); |
| 265 } | 265 } |
| 266 | 266 |
| 267 { | 267 { |
| 268 // Allow access to /dev/urandom. | 268 // Allow access to /dev/urandom. |
| 269 GetUrandomFD(); | 269 base::GetUrandomFD(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 // Process-type dependent warm-up. | 272 // Process-type dependent warm-up. |
| 273 if (sandbox_type == content::SANDBOX_TYPE_GPU) { | 273 if (sandbox_type == content::SANDBOX_TYPE_GPU) { |
| 274 // Preload either the desktop GL or the osmesa so, depending on the | 274 // Preload either the desktop GL or the osmesa so, depending on the |
| 275 // --use-gl flag. | 275 // --use-gl flag. |
| 276 gfx::GLSurface::InitializeOneOff(); | 276 gfx::GLSurface::InitializeOneOff(); |
| 277 } | 277 } |
| 278 } | 278 } |
| 279 | 279 |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 if (HANDLE_EINTR(fcntl(fd, F_GETPATH, canonical_path)) != 0) { | 578 if (HANDLE_EINTR(fcntl(fd, F_GETPATH, canonical_path)) != 0) { |
| 579 DPLOG(FATAL) << "GetCanonicalSandboxPath() failed for: " | 579 DPLOG(FATAL) << "GetCanonicalSandboxPath() failed for: " |
| 580 << path->value(); | 580 << path->value(); |
| 581 return; | 581 return; |
| 582 } | 582 } |
| 583 | 583 |
| 584 *path = FilePath(canonical_path); | 584 *path = FilePath(canonical_path); |
| 585 } | 585 } |
| 586 | 586 |
| 587 } // namespace sandbox | 587 } // namespace sandbox |
| OLD | NEW |