OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/renderer/renderer_main_platform_delegate.h" | 5 #include "chrome/renderer/renderer_main_platform_delegate.h" |
6 | 6 |
7 #include "base/debug_util.h" | 7 #include "base/debug_util.h" |
8 | 8 |
9 #import <Foundation/Foundation.h> | 9 #import <Foundation/Foundation.h> |
10 #import <ApplicationServices/ApplicationServices.h> | 10 #import <ApplicationServices/ApplicationServices.h> |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 LOG(ERROR) << "Failed to find the sandbox profile on disk"; | 124 LOG(ERROR) << "Failed to find the sandbox profile on disk"; |
125 return false; | 125 return false; |
126 } | 126 } |
127 | 127 |
128 // Splice the path of the user's home directory into the sandbox profile | 128 // Splice the path of the user's home directory into the sandbox profile |
129 // (see renderer.sb for details). | 129 // (see renderer.sb for details). |
130 sandbox_data = [sandbox_data | 130 sandbox_data = [sandbox_data |
131 stringByReplacingOccurrencesOfString:@"USER_HOMEDIR" | 131 stringByReplacingOccurrencesOfString:@"USER_HOMEDIR" |
132 withString:NSHomeDirectory()]; | 132 withString:NSHomeDirectory()]; |
133 | 133 |
| 134 // Enable 10.5 only sandbox syntax. |
| 135 int32 major_version = 0; |
| 136 int32 minor_version = 0; |
| 137 int32 bugfix_version = 0; |
| 138 base::SysInfo::OperatingSystemVersionNumbers(&major_version, |
| 139 &minor_version, |
| 140 &bugfix_version); |
| 141 |
| 142 if (major_version == 10 && minor_version == 5) { |
| 143 sandbox_data = [sandbox_data |
| 144 stringByReplacingOccurrencesOfString:@";10.5_ONLY" |
| 145 withString:@""]; |
| 146 } |
| 147 |
134 char* error_buff = NULL; | 148 char* error_buff = NULL; |
135 int error = sandbox_init([sandbox_data UTF8String], 0, &error_buff); | 149 int error = sandbox_init([sandbox_data UTF8String], 0, &error_buff); |
136 bool success = (error == 0 && error_buff == NULL); | 150 bool success = (error == 0 && error_buff == NULL); |
137 if (error == -1) { | 151 if (error == -1) { |
138 LOG(ERROR) << "Failed to Initialize Sandbox: " << error_buff; | 152 LOG(ERROR) << "Failed to Initialize Sandbox: " << error_buff; |
139 } | 153 } |
140 sandbox_free_error(error_buff); | 154 sandbox_free_error(error_buff); |
141 return success; | 155 return success; |
142 } | 156 } |
143 | 157 |
144 void RendererMainPlatformDelegate::RunSandboxTests() { | 158 void RendererMainPlatformDelegate::RunSandboxTests() { |
145 // TODO(port): Run sandbox unit test here. | 159 // TODO(port): Run sandbox unit test here. |
146 } | 160 } |
OLD | NEW |