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

Side by Side Diff: base/mac/bundle_locations.mm

Issue 9346013: Publish app shortcuts on Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win build Created 8 years, 10 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 | « base/file_util_mac.mm ('k') | base/mac/foundation_util.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) 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 "base/mac/bundle_locations.h" 5 #include "base/mac/bundle_locations.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/foundation_util.h"
8 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
9 10
10 namespace base { 11 namespace base {
11 namespace mac { 12 namespace mac {
12 13
13 // NSBundle isn't threadsafe, all functions in this file must be called on the 14 // NSBundle isn't threadsafe, all functions in this file must be called on the
14 // main thread. 15 // main thread.
15 static NSBundle* g_override_framework_bundle = nil; 16 static NSBundle* g_override_framework_bundle = nil;
16 static NSBundle* g_override_outer_bundle = nil; 17 static NSBundle* g_override_outer_bundle = nil;
17 18
18 NSBundle* MainBundle() { 19 NSBundle* MainBundle() {
19 return [NSBundle mainBundle]; 20 return [NSBundle mainBundle];
20 } 21 }
21 22
22 FilePath MainBundlePath() { 23 FilePath MainBundlePath() {
23 NSBundle* bundle = MainBundle(); 24 NSBundle* bundle = MainBundle();
24 return FilePath([[bundle bundlePath] fileSystemRepresentation]); 25 return NSStringToFilePath([bundle bundlePath]);
25 } 26 }
26 27
27 NSBundle* OuterBundle() { 28 NSBundle* OuterBundle() {
28 if (g_override_outer_bundle) 29 if (g_override_outer_bundle)
29 return g_override_outer_bundle; 30 return g_override_outer_bundle;
30 return [NSBundle mainBundle]; 31 return [NSBundle mainBundle];
31 } 32 }
32 33
33 FilePath OuterBundlePath() { 34 FilePath OuterBundlePath() {
34 NSBundle* bundle = OuterBundle(); 35 NSBundle* bundle = OuterBundle();
35 return FilePath([[bundle bundlePath] fileSystemRepresentation]); 36 return NSStringToFilePath([bundle bundlePath]);
36 } 37 }
37 38
38 NSBundle* FrameworkBundle() { 39 NSBundle* FrameworkBundle() {
39 if (g_override_framework_bundle) 40 if (g_override_framework_bundle)
40 return g_override_framework_bundle; 41 return g_override_framework_bundle;
41 return [NSBundle mainBundle]; 42 return [NSBundle mainBundle];
42 } 43 }
43 44
44 FilePath FrameworkBundlePath() { 45 FilePath FrameworkBundlePath() {
45 NSBundle* bundle = FrameworkBundle(); 46 NSBundle* bundle = FrameworkBundle();
46 return FilePath([[bundle bundlePath] fileSystemRepresentation]); 47 return NSStringToFilePath([bundle bundlePath]);
47 } 48 }
48 49
49 static void AssignOverrideBundle(NSBundle* new_bundle, 50 static void AssignOverrideBundle(NSBundle* new_bundle,
50 NSBundle** override_bundle) { 51 NSBundle** override_bundle) {
51 if (new_bundle != *override_bundle) { 52 if (new_bundle != *override_bundle) {
52 [*override_bundle release]; 53 [*override_bundle release];
53 *override_bundle = [new_bundle retain]; 54 *override_bundle = [new_bundle retain];
54 } 55 }
55 } 56 }
56 57
(...skipping 16 matching lines...) Expand all
73 void SetOverrideOuterBundlePath(const FilePath& file_path) { 74 void SetOverrideOuterBundlePath(const FilePath& file_path) {
74 AssignOverridePath(file_path, &g_override_outer_bundle); 75 AssignOverridePath(file_path, &g_override_outer_bundle);
75 } 76 }
76 77
77 void SetOverrideFrameworkBundlePath(const FilePath& file_path) { 78 void SetOverrideFrameworkBundlePath(const FilePath& file_path) {
78 AssignOverridePath(file_path, &g_override_framework_bundle); 79 AssignOverridePath(file_path, &g_override_framework_bundle);
79 } 80 }
80 81
81 } // namespace mac 82 } // namespace mac
82 } // namespace base 83 } // namespace base
OLDNEW
« no previous file with comments | « base/file_util_mac.mm ('k') | base/mac/foundation_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698