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/renderer/renderer_main_platform_delegate.h" | 5 #include "content/renderer/renderer_main_platform_delegate.h" |
6 | 6 |
7 #include <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 #include <objc/runtime.h> | 9 #include <objc/runtime.h> |
| 10 #include <stdint.h> |
10 | 11 |
11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/mac/mac_util.h" | 14 #include "base/mac/mac_util.h" |
14 #include "base/mac/scoped_cftyperef.h" | 15 #include "base/mac/scoped_cftyperef.h" |
15 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/sys_string_conversions.h" | 17 #include "base/strings/sys_string_conversions.h" |
17 #include "content/common/sandbox_init_mac.h" | 18 #include "content/common/sandbox_init_mac.h" |
18 #include "content/common/sandbox_mac.h" | 19 #include "content/common/sandbox_mac.h" |
19 #include "content/public/common/content_switches.h" | 20 #include "content/public/common/content_switches.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 base::ScopedCFTypeRef<CFStringRef> port_address_string( | 65 base::ScopedCFTypeRef<CFStringRef> port_address_string( |
65 CFStringCreateWithSubstring(NULL, run_loop_description, | 66 CFStringCreateWithSubstring(NULL, run_loop_description, |
66 port_address_range)); | 67 port_address_range)); |
67 if (!port_address_string) | 68 if (!port_address_string) |
68 continue; | 69 continue; |
69 | 70 |
70 // Convert the string to an address. | 71 // Convert the string to an address. |
71 std::string port_address_std_string = | 72 std::string port_address_std_string = |
72 base::SysCFStringRefToUTF8(port_address_string); | 73 base::SysCFStringRefToUTF8(port_address_string); |
73 #if __LP64__ | 74 #if __LP64__ |
74 uint64 port_address = 0; | 75 uint64_t port_address = 0; |
75 if (!base::HexStringToUInt64(port_address_std_string, &port_address)) | 76 if (!base::HexStringToUInt64(port_address_std_string, &port_address)) |
76 continue; | 77 continue; |
77 #else | 78 #else |
78 uint32 port_address = 0; | 79 uint32_t port_address = 0; |
79 if (!base::HexStringToUInt(port_address_std_string, &port_address)) | 80 if (!base::HexStringToUInt(port_address_std_string, &port_address)) |
80 continue; | 81 continue; |
81 #endif | 82 #endif |
82 | 83 |
83 // Cast the address to an object. | 84 // Cast the address to an object. |
84 CFMachPortRef mach_port = reinterpret_cast<CFMachPortRef>(port_address); | 85 CFMachPortRef mach_port = reinterpret_cast<CFMachPortRef>(port_address); |
85 if (CFGetTypeID(mach_port) != CFMachPortGetTypeID()) | 86 if (CFGetTypeID(mach_port) != CFMachPortGetTypeID()) |
86 continue; | 87 continue; |
87 | 88 |
88 // Verify that this is the Mach port that needs to be disconnected by the | 89 // Verify that this is the Mach port that needs to be disconnected by the |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // The sandbox is now engaged. Make sure that the renderer has not connected | 143 // The sandbox is now engaged. Make sure that the renderer has not connected |
143 // itself to Cocoa. | 144 // itself to Cocoa. |
144 CHECK(NSApp == nil); | 145 CHECK(NSApp == nil); |
145 | 146 |
146 DisconnectCFNotificationCenter(); | 147 DisconnectCFNotificationCenter(); |
147 | 148 |
148 return sandbox_initialized; | 149 return sandbox_initialized; |
149 } | 150 } |
150 | 151 |
151 } // namespace content | 152 } // namespace content |
OLD | NEW |