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

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

Issue 171040: add the InfoPlist.strings generation based on GRD strings.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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/chrome_paths_internal.h ('k') | chrome/tools/build/apply_locales.py » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #import "chrome/common/chrome_paths_internal.h" 5 #import "chrome/common/chrome_paths_internal.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #import "base/base_paths.h" 9 #import "base/base_paths.h"
10 #import "base/file_path.h"
11 #import "base/logging.h" 10 #import "base/logging.h"
12 #import "base/path_service.h" 11 #import "base/path_service.h"
13 12
14 namespace chrome { 13 namespace chrome {
15 14
16 bool GetDefaultUserDataDirectory(FilePath* result) { 15 bool GetDefaultUserDataDirectory(FilePath* result) {
17 bool success = false; 16 bool success = false;
18 NSArray* dirs = 17 NSArray* dirs =
19 NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, 18 NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,
20 NSUserDomainMask, YES); 19 NSUserDomainMask, YES);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 NSSearchPathForDirectoriesInDomains(NSDesktopDirectory, 64 NSSearchPathForDirectoriesInDomains(NSDesktopDirectory,
66 NSUserDomainMask, 65 NSUserDomainMask,
67 YES); 66 YES);
68 if ([docArray count] && result) { 67 if ([docArray count] && result) {
69 *result = FilePath([[docArray objectAtIndex:0] fileSystemRepresentation]); 68 *result = FilePath([[docArray objectAtIndex:0] fileSystemRepresentation]);
70 success = true; 69 success = true;
71 } 70 }
72 return success; 71 return success;
73 } 72 }
74 73
74 FilePath GetBrowserBundlePath() {
75 NSBundle* running_app_bundle = [NSBundle mainBundle];
76 NSString* running_app_bundle_path = [running_app_bundle bundlePath];
77 DCHECK(running_app_bundle_path) << "failed to get the main bundle path";
78
79 // Are we the helper or the browser (main bundle)?
80 if (![[[running_app_bundle infoDictionary]
81 objectForKey:@"LSUIElement"] boolValue]) {
82 // We aren't a LSUIElement, so this must be the browser, return it's path.
83 return FilePath([running_app_bundle_path fileSystemRepresentation]);
84 }
85
86 // Helper lives at ...app/Contents/Resources/...Helper.app
87 NSArray* components = [running_app_bundle_path pathComponents];
88 DCHECK_GE([components count], static_cast<NSUInteger>(4))
89 << "too few path components for this bundle to be within another bundle";
90 components =
91 [components subarrayWithRange:NSMakeRange(0, [components count] - 3)];
92
93 NSString* browser_path = [NSString pathWithComponents:components];
94 DCHECK([[browser_path pathExtension] isEqualToString:@"app"])
95 << "we weren't within another app?";
96
97 return FilePath([browser_path fileSystemRepresentation]);
98 }
99
75 } // namespace chrome 100 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/common/chrome_paths_internal.h ('k') | chrome/tools/build/apply_locales.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698