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

Side by Side Diff: content/shell/paths_mac.mm

Issue 12208057: Add explicit base to FilePath. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | « content/shell/paths_mac.h ('k') | content/shell/shell_browser_context.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 "content/shell/paths_mac.h" 5 #include "content/shell/paths_mac.h"
6 6
7 #include "base/mac/bundle_locations.h" 7 #include "base/mac/bundle_locations.h"
8 #include "base/mac/foundation_util.h" 8 #include "base/mac/foundation_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "content/public/common/content_paths.h" 10 #include "content/public/common/content_paths.h"
11 11
12 namespace { 12 namespace {
13 13
14 FilePath GetFrameworksPath() { 14 base::FilePath GetFrameworksPath() {
15 // Start out with the path to the running executable. 15 // Start out with the path to the running executable.
16 FilePath path; 16 base::FilePath path;
17 PathService::Get(base::FILE_EXE, &path); 17 PathService::Get(base::FILE_EXE, &path);
18 18
19 // Up to Contents. 19 // Up to Contents.
20 if (base::mac::IsBackgroundOnlyProcess()) { 20 if (base::mac::IsBackgroundOnlyProcess()) {
21 // The running executable is the helper. Go up five steps: 21 // The running executable is the helper. Go up five steps:
22 // Contents/Frameworks/Helper.app/Contents/MacOS/Helper 22 // Contents/Frameworks/Helper.app/Contents/MacOS/Helper
23 // ^ to here ^ from here 23 // ^ to here ^ from here
24 path = path.DirName().DirName().DirName().DirName().DirName(); 24 path = path.DirName().DirName().DirName().DirName().DirName();
25 } else { 25 } else {
26 // One step up to MacOS, another to Contents. 26 // One step up to MacOS, another to Contents.
27 path = path.DirName().DirName(); 27 path = path.DirName().DirName();
28 } 28 }
29 DCHECK_EQ(path.BaseName().value(), "Contents"); 29 DCHECK_EQ(path.BaseName().value(), "Contents");
30 30
31 // Go into the frameworks directory. 31 // Go into the frameworks directory.
32 return path.Append("Frameworks"); 32 return path.Append("Frameworks");
33 } 33 }
34 34
35 } // namespace 35 } // namespace
36 36
37 void OverrideFrameworkBundlePath() { 37 void OverrideFrameworkBundlePath() {
38 FilePath helper_path = 38 base::FilePath helper_path =
39 GetFrameworksPath().Append("Content Shell Framework.framework"); 39 GetFrameworksPath().Append("Content Shell Framework.framework");
40 40
41 base::mac::SetOverrideFrameworkBundlePath(helper_path); 41 base::mac::SetOverrideFrameworkBundlePath(helper_path);
42 } 42 }
43 43
44 void OverrideChildProcessPath() { 44 void OverrideChildProcessPath() {
45 FilePath helper_path = GetFrameworksPath().Append("Content Shell Helper.app") 45 base::FilePath helper_path =
46 GetFrameworksPath().Append("Content Shell Helper.app")
46 .Append("Contents") 47 .Append("Contents")
47 .Append("MacOS") 48 .Append("MacOS")
48 .Append("Content Shell Helper"); 49 .Append("Content Shell Helper");
49 50
50 PathService::Override(content::CHILD_PROCESS_EXE, helper_path); 51 PathService::Override(content::CHILD_PROCESS_EXE, helper_path);
51 } 52 }
52 53
53 FilePath GetResourcesPakFilePath() { 54 base::FilePath GetResourcesPakFilePath() {
54 NSString* pak_path = 55 NSString* pak_path =
55 [base::mac::FrameworkBundle() pathForResource:@"content_shell" 56 [base::mac::FrameworkBundle() pathForResource:@"content_shell"
56 ofType:@"pak"]; 57 ofType:@"pak"];
57 58
58 return FilePath([pak_path fileSystemRepresentation]); 59 return FilePath([pak_path fileSystemRepresentation]);
59 } 60 }
OLDNEW
« no previous file with comments | « content/shell/paths_mac.h ('k') | content/shell/shell_browser_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698