| 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 #include <CoreFoundation/CFTimeZone.h> | 9 #include <CoreFoundation/CFTimeZone.h> |
| 10 extern "C" { | 10 extern "C" { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "base/strings/stringprintf.h" | 29 #include "base/strings/stringprintf.h" |
| 30 #include "base/strings/sys_string_conversions.h" | 30 #include "base/strings/sys_string_conversions.h" |
| 31 #include "base/strings/utf_string_conversions.h" | 31 #include "base/strings/utf_string_conversions.h" |
| 32 #include "base/sys_info.h" | 32 #include "base/sys_info.h" |
| 33 #include "content/public/common/content_client.h" | 33 #include "content/public/common/content_client.h" |
| 34 #include "content/public/common/content_switches.h" | 34 #include "content/public/common/content_switches.h" |
| 35 #include "grit/content_resources.h" | 35 #include "grit/content_resources.h" |
| 36 #include "third_party/icu/source/common/unicode/uchar.h" | 36 #include "third_party/icu/source/common/unicode/uchar.h" |
| 37 #include "ui/base/layout.h" | 37 #include "ui/base/layout.h" |
| 38 #include "ui/gl/gl_surface.h" | 38 #include "ui/gl/gl_surface.h" |
| 39 #include "ui/gl/io_surface_support_mac.h" |
| 39 | 40 |
| 40 namespace content { | 41 namespace content { |
| 41 namespace { | 42 namespace { |
| 42 | 43 |
| 43 // Is the sandbox currently active. | 44 // Is the sandbox currently active. |
| 44 bool gSandboxIsActive = false; | 45 bool gSandboxIsActive = false; |
| 45 | 46 |
| 46 struct SandboxTypeToResourceIDMapping { | 47 struct SandboxTypeToResourceIDMapping { |
| 47 SandboxType sandbox_type; | 48 SandboxType sandbox_type; |
| 48 int sandbox_profile_resource_id; | 49 int sandbox_profile_resource_id; |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 base::ScopedCFTypeRef<CGImageSourceRef> img( | 301 base::ScopedCFTypeRef<CGImageSourceRef> img( |
| 301 CGImageSourceCreateWithData((CFDataRef)data, NULL)); | 302 CGImageSourceCreateWithData((CFDataRef)data, NULL)); |
| 302 CGImageSourceGetStatus(img); | 303 CGImageSourceGetStatus(img); |
| 303 } | 304 } |
| 304 | 305 |
| 305 { | 306 { |
| 306 // Allow access to /dev/urandom. | 307 // Allow access to /dev/urandom. |
| 307 base::GetUrandomFD(); | 308 base::GetUrandomFD(); |
| 308 } | 309 } |
| 309 | 310 |
| 311 { // IOSurfaceLookup() - 10.7 |
| 312 // Needed by zero-copy texture update framework - crbug.com/323338 |
| 313 IOSurfaceSupport* io_surface_support = IOSurfaceSupport::Initialize(); |
| 314 if (io_surface_support) { |
| 315 base::ScopedCFTypeRef<CFTypeRef> io_surface( |
| 316 io_surface_support->IOSurfaceLookup(0)); |
| 317 } |
| 318 } |
| 319 |
| 310 // Process-type dependent warm-up. | 320 // Process-type dependent warm-up. |
| 311 if (sandbox_type == SANDBOX_TYPE_UTILITY) { | 321 if (sandbox_type == SANDBOX_TYPE_UTILITY) { |
| 312 // CFTimeZoneCopyZone() tries to read /etc and /private/etc/localtime - 10.8 | 322 // CFTimeZoneCopyZone() tries to read /etc and /private/etc/localtime - 10.8 |
| 313 // Needed by Media Galleries API Picasa - crbug.com/151701 | 323 // Needed by Media Galleries API Picasa - crbug.com/151701 |
| 314 CFTimeZoneCopySystem(); | 324 CFTimeZoneCopySystem(); |
| 315 } | 325 } |
| 316 | 326 |
| 317 if (sandbox_type == SANDBOX_TYPE_GPU) { | 327 if (sandbox_type == SANDBOX_TYPE_GPU) { |
| 318 // Preload either the desktop GL or the osmesa so, depending on the | 328 // Preload either the desktop GL or the osmesa so, depending on the |
| 319 // --use-gl flag. | 329 // --use-gl flag. |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 if (HANDLE_EINTR(fcntl(fd, F_GETPATH, canonical_path)) != 0) { | 618 if (HANDLE_EINTR(fcntl(fd, F_GETPATH, canonical_path)) != 0) { |
| 609 DPLOG(FATAL) << "GetCanonicalSandboxPath() failed for: " | 619 DPLOG(FATAL) << "GetCanonicalSandboxPath() failed for: " |
| 610 << path.value(); | 620 << path.value(); |
| 611 return path; | 621 return path; |
| 612 } | 622 } |
| 613 | 623 |
| 614 return base::FilePath(canonical_path); | 624 return base::FilePath(canonical_path); |
| 615 } | 625 } |
| 616 | 626 |
| 617 } // namespace content | 627 } // namespace content |
| OLD | NEW |