Wrap Pepper CDM Content Settings code in defined(ENABLE_PEPPER_CDMS).
[chromium-blink-merge.git] / content / shell / paths_mac.mm
bloba2a29930b34a57f4f928fd30c57630f8d625ec26
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
3 // found in the LICENSE file.
5 #include "content/shell/paths_mac.h"
7 #include "base/mac/bundle_locations.h"
8 #include "base/mac/foundation_util.h"
9 #include "base/path_service.h"
10 #include "content/public/common/content_paths.h"
12 namespace {
14 base::FilePath GetFrameworksPath() {
15   // Start out with the path to the running executable.
16   base::FilePath path;
17   PathService::Get(base::FILE_EXE, &path);
19   // Up to Contents.
20   if (base::mac::IsBackgroundOnlyProcess()) {
21     // The running executable is the helper. Go up five steps:
22     // Contents/Frameworks/Helper.app/Contents/MacOS/Helper
23     // ^ to here                                     ^ from here
24     path = path.DirName().DirName().DirName().DirName().DirName();
25   } else {
26     // One step up to MacOS, another to Contents.
27     path = path.DirName().DirName();
28   }
29   DCHECK_EQ(path.BaseName().value(), "Contents");
31   // Go into the frameworks directory.
32   return path.Append("Frameworks");
35 }  // namespace
37 void OverrideFrameworkBundlePath() {
38   base::FilePath helper_path =
39       GetFrameworksPath().Append("Content Shell Framework.framework");
41   base::mac::SetOverrideFrameworkBundlePath(helper_path);
44 void OverrideChildProcessPath() {
45   base::FilePath helper_path =
46       GetFrameworksPath().Append("Content Shell Helper.app")
47                                             .Append("Contents")
48                                             .Append("MacOS")
49                                             .Append("Content Shell Helper");
51   PathService::Override(content::CHILD_PROCESS_EXE, helper_path);
54 base::FilePath GetResourcesPakFilePath() {
55   NSString* pak_path =
56       [base::mac::FrameworkBundle() pathForResource:@"content_shell"
57                                              ofType:@"pak"];
59   return base::FilePath([pak_path fileSystemRepresentation]);