OLD | NEW |
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/mac/foundation_util.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 if (g_override_framework_bundle) | 40 if (g_override_framework_bundle) |
41 return g_override_framework_bundle; | 41 return g_override_framework_bundle; |
42 return [NSBundle mainBundle]; | 42 return [NSBundle mainBundle]; |
43 } | 43 } |
44 | 44 |
45 FilePath FrameworkBundlePath() { | 45 FilePath FrameworkBundlePath() { |
46 NSBundle* bundle = FrameworkBundle(); | 46 NSBundle* bundle = FrameworkBundle(); |
47 return NSStringToFilePath([bundle bundlePath]); | 47 return NSStringToFilePath([bundle bundlePath]); |
48 } | 48 } |
49 | 49 |
| 50 std::string GetOuterBundleIdentifier() { |
| 51 NSBundle* bundle = OuterBundle(); |
| 52 return base::SysNSStringToUTF8([bundle bundleIdentifier]); |
| 53 } |
| 54 |
50 static void AssignOverrideBundle(NSBundle* new_bundle, | 55 static void AssignOverrideBundle(NSBundle* new_bundle, |
51 NSBundle** override_bundle) { | 56 NSBundle** override_bundle) { |
52 if (new_bundle != *override_bundle) { | 57 if (new_bundle != *override_bundle) { |
53 [*override_bundle release]; | 58 [*override_bundle release]; |
54 *override_bundle = [new_bundle retain]; | 59 *override_bundle = [new_bundle retain]; |
55 } | 60 } |
56 } | 61 } |
57 | 62 |
58 static void AssignOverridePath(const FilePath& file_path, | 63 static void AssignOverridePath(const FilePath& file_path, |
59 NSBundle** override_bundle) { | 64 NSBundle** override_bundle) { |
(...skipping 14 matching lines...) Expand all Loading... |
74 void SetOverrideOuterBundlePath(const FilePath& file_path) { | 79 void SetOverrideOuterBundlePath(const FilePath& file_path) { |
75 AssignOverridePath(file_path, &g_override_outer_bundle); | 80 AssignOverridePath(file_path, &g_override_outer_bundle); |
76 } | 81 } |
77 | 82 |
78 void SetOverrideFrameworkBundlePath(const FilePath& file_path) { | 83 void SetOverrideFrameworkBundlePath(const FilePath& file_path) { |
79 AssignOverridePath(file_path, &g_override_framework_bundle); | 84 AssignOverridePath(file_path, &g_override_framework_bundle); |
80 } | 85 } |
81 | 86 |
82 } // namespace mac | 87 } // namespace mac |
83 } // namespace base | 88 } // namespace base |
OLD | NEW |