Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: chrome/common/sandbox_mac.mm

Issue 6046009: Move base/mac_util.h to base/mac and use the base::mac namespace.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/font_loader_mac.mm ('k') | chrome/plugin/plugin_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/common/sandbox_mac.h" 5 #include "chrome/common/sandbox_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #import <OpenGL/OpenGL.h> 8 #import <OpenGL/OpenGL.h>
9 9
10 extern "C" { 10 extern "C" {
11 #include <sandbox.h> 11 #include <sandbox.h>
12 } 12 }
13 #include <signal.h> 13 #include <signal.h>
14 #include <sys/param.h> 14 #include <sys/param.h>
15 15
16 #include "app/gfx/gl/gl_context.h" 16 #include "app/gfx/gl/gl_context.h"
17 #include "base/basictypes.h" 17 #include "base/basictypes.h"
18 #include "base/command_line.h" 18 #include "base/command_line.h"
19 #include "base/file_util.h" 19 #include "base/file_util.h"
20 #include "base/mac_util.h" 20 #include "base/mac/mac_util.h"
21 #include "base/rand_util_c.h" 21 #include "base/rand_util_c.h"
22 #include "base/mac/scoped_cftyperef.h" 22 #include "base/mac/scoped_cftyperef.h"
23 #include "base/mac/scoped_nsautorelease_pool.h" 23 #include "base/mac/scoped_nsautorelease_pool.h"
24 #include "base/string16.h" 24 #include "base/string16.h"
25 #include "base/string_util.h" 25 #include "base/string_util.h"
26 #include "base/sys_info.h" 26 #include "base/sys_info.h"
27 #include "base/sys_string_conversions.h" 27 #include "base/sys_string_conversions.h"
28 #include "base/utf_string_conversions.h" 28 #include "base/utf_string_conversions.h"
29 #include "chrome/common/chrome_application_mac.h" 29 #include "chrome/common/chrome_application_mac.h"
30 #include "chrome/common/chrome_switches.h" 30 #include "chrome/common/chrome_switches.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 // Allocate a 1x1 image. 190 // Allocate a 1x1 image.
191 char data[4]; 191 char data[4];
192 base::mac::ScopedCFTypeRef<CGContextRef> context( 192 base::mac::ScopedCFTypeRef<CGContextRef> context(
193 CGBitmapContextCreate(data, 1, 1, 8, 1 * 4, 193 CGBitmapContextCreate(data, 1, 1, 8, 1 * 4,
194 rgb_colorspace, 194 rgb_colorspace,
195 kCGImageAlphaPremultipliedFirst | 195 kCGImageAlphaPremultipliedFirst |
196 kCGBitmapByteOrder32Host)); 196 kCGBitmapByteOrder32Host));
197 197
198 // Load in the color profiles we'll need (as a side effect). 198 // Load in the color profiles we'll need (as a side effect).
199 (void) mac_util::GetSRGBColorSpace(); 199 (void) base::mac::GetSRGBColorSpace();
200 (void) mac_util::GetSystemColorSpace(); 200 (void) base::mac::GetSystemColorSpace();
201 201
202 // CGColorSpaceCreateSystemDefaultCMYK - 10.6 202 // CGColorSpaceCreateSystemDefaultCMYK - 10.6
203 base::mac::ScopedCFTypeRef<CGColorSpaceRef> cmyk_colorspace( 203 base::mac::ScopedCFTypeRef<CGColorSpaceRef> cmyk_colorspace(
204 CGColorSpaceCreateWithName(kCGColorSpaceGenericCMYK)); 204 CGColorSpaceCreateWithName(kCGColorSpaceGenericCMYK));
205 } 205 }
206 206
207 { // [-NSColor colorUsingColorSpaceName] - 10.5.6 207 { // [-NSColor colorUsingColorSpaceName] - 10.5.6
208 NSColor* color = [NSColor controlTextColor]; 208 NSColor* color = [NSColor controlTextColor];
209 [color colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; 209 [color colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
210 } 210 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 case Sandbox::SANDBOX_TYPE_GPU: 353 case Sandbox::SANDBOX_TYPE_GPU:
354 sandbox_config_filename = @"gpu"; 354 sandbox_config_filename = @"gpu";
355 break; 355 break;
356 default: 356 default:
357 NOTREACHED(); 357 NOTREACHED();
358 return nil; 358 return nil;
359 } 359 }
360 360
361 // Read in the sandbox profile and the common prefix file. 361 // Read in the sandbox profile and the common prefix file.
362 NSString* common_sandbox_prefix_path = 362 NSString* common_sandbox_prefix_path =
363 [mac_util::MainAppBundle() pathForResource:@"common" 363 [base::mac::MainAppBundle() pathForResource:@"common"
364 ofType:@"sb"]; 364 ofType:@"sb"];
365 NSString* common_sandbox_prefix_data = 365 NSString* common_sandbox_prefix_data =
366 [NSString stringWithContentsOfFile:common_sandbox_prefix_path 366 [NSString stringWithContentsOfFile:common_sandbox_prefix_path
367 encoding:NSUTF8StringEncoding 367 encoding:NSUTF8StringEncoding
368 error:NULL]; 368 error:NULL];
369 369
370 if (!common_sandbox_prefix_data) { 370 if (!common_sandbox_prefix_data) {
371 LOG(FATAL) << "Failed to find the sandbox profile on disk " 371 LOG(FATAL) << "Failed to find the sandbox profile on disk "
372 << [common_sandbox_prefix_path fileSystemRepresentation]; 372 << [common_sandbox_prefix_path fileSystemRepresentation];
373 return nil; 373 return nil;
374 } 374 }
375 375
376 NSString* sandbox_profile_path = 376 NSString* sandbox_profile_path =
377 [mac_util::MainAppBundle() pathForResource:sandbox_config_filename 377 [base::mac::MainAppBundle() pathForResource:sandbox_config_filename
378 ofType:@"sb"]; 378 ofType:@"sb"];
379 NSString* sandbox_data = 379 NSString* sandbox_data =
380 [NSString stringWithContentsOfFile:sandbox_profile_path 380 [NSString stringWithContentsOfFile:sandbox_profile_path
381 encoding:NSUTF8StringEncoding 381 encoding:NSUTF8StringEncoding
382 error:NULL]; 382 error:NULL];
383 383
384 if (!sandbox_data) { 384 if (!sandbox_data) {
385 LOG(FATAL) << "Failed to find the sandbox profile on disk " 385 LOG(FATAL) << "Failed to find the sandbox profile on disk "
386 << [sandbox_profile_path fileSystemRepresentation]; 386 << [sandbox_profile_path fileSystemRepresentation];
387 return nil; 387 return nil;
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 if (HANDLE_EINTR(fcntl(fd, F_GETPATH, canonical_path)) != 0) { 577 if (HANDLE_EINTR(fcntl(fd, F_GETPATH, canonical_path)) != 0) {
578 PLOG(FATAL) << "GetCanonicalSandboxPath() failed for: " 578 PLOG(FATAL) << "GetCanonicalSandboxPath() failed for: "
579 << path->value(); 579 << path->value();
580 return; 580 return;
581 } 581 }
582 582
583 *path = FilePath(canonical_path); 583 *path = FilePath(canonical_path);
584 } 584 }
585 585
586 } // namespace sandbox 586 } // namespace sandbox
OLDNEW
« no previous file with comments | « chrome/common/font_loader_mac.mm ('k') | chrome/plugin/plugin_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698