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