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

Side by Side Diff: base/mac_util.mm

Issue 4062002: Dynamic policy refresh support for the Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/map/list/, nits. Created 10 years, 1 month 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 | « base/mac_util.h ('k') | chrome/browser/policy/config_dir_policy_provider.h » ('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 "base/mac_util.h" 5 #include "base/mac_util.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 212 }
213 213
214 OSType CreatorCodeForApplication() { 214 OSType CreatorCodeForApplication() {
215 CFBundleRef bundle = CFBundleGetMainBundle(); 215 CFBundleRef bundle = CFBundleGetMainBundle();
216 if (!bundle) 216 if (!bundle)
217 return kUnknownType; 217 return kUnknownType;
218 218
219 return CreatorCodeForCFBundleRef(bundle); 219 return CreatorCodeForCFBundleRef(bundle);
220 } 220 }
221 221
222 bool GetUserDirectory(NSSearchPathDirectory directory, FilePath* result) { 222 bool GetSearchPathDirectory(NSSearchPathDirectory directory,
223 NSSearchPathDomainMask domain_mask,
224 FilePath* result) {
223 DCHECK(result); 225 DCHECK(result);
224 NSArray* dirs = 226 NSArray* dirs =
225 NSSearchPathForDirectoriesInDomains(directory, NSUserDomainMask, YES); 227 NSSearchPathForDirectoriesInDomains(directory, domain_mask, YES);
226 if ([dirs count] < 1) { 228 if ([dirs count] < 1) {
227 return false; 229 return false;
228 } 230 }
229 NSString* path = [dirs objectAtIndex:0]; 231 NSString* path = [dirs objectAtIndex:0];
230 *result = FilePath([path fileSystemRepresentation]); 232 *result = FilePath([path fileSystemRepresentation]);
231 return true; 233 return true;
232 } 234 }
233 235
236 bool GetLocalDirectory(NSSearchPathDirectory directory, FilePath* result) {
237 return GetSearchPathDirectory(directory, NSLocalDomainMask, result);
238 }
239
240 bool GetUserDirectory(NSSearchPathDirectory directory, FilePath* result) {
241 return GetSearchPathDirectory(directory, NSUserDomainMask, result);
242 }
243
234 FilePath GetUserLibraryPath() { 244 FilePath GetUserLibraryPath() {
235 FilePath user_library_path; 245 FilePath user_library_path;
236 if (!GetUserDirectory(NSLibraryDirectory, &user_library_path)) { 246 if (!GetUserDirectory(NSLibraryDirectory, &user_library_path)) {
237 LOG(WARNING) << "Could not get user library path"; 247 LOG(WARNING) << "Could not get user library path";
238 } 248 }
239 return user_library_path; 249 return user_library_path;
240 } 250 }
241 251
242 CGColorSpaceRef GetSRGBColorSpace() { 252 CGColorSpaceRef GetSRGBColorSpace() {
243 // Leaked. That's OK, it's scoped to the lifetime of the application. 253 // Leaked. That's OK, it's scoped to the lifetime of the application.
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 id<NSObject> nsobj = static_cast<id<NSObject> >(obj); 687 id<NSObject> nsobj = static_cast<id<NSObject> >(obj);
678 [nsobj retain]; 688 [nsobj retain];
679 } 689 }
680 690
681 void NSObjectRelease(void* obj) { 691 void NSObjectRelease(void* obj) {
682 id<NSObject> nsobj = static_cast<id<NSObject> >(obj); 692 id<NSObject> nsobj = static_cast<id<NSObject> >(obj);
683 [nsobj release]; 693 [nsobj release];
684 } 694 }
685 695
686 } // namespace mac_util 696 } // namespace mac_util
OLDNEW
« no previous file with comments | « base/mac_util.h ('k') | chrome/browser/policy/config_dir_policy_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698