Index: base/mac/bundle_locations.h |
diff --git a/base/mac/bundle_locations.h b/base/mac/bundle_locations.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ebaf9459985d77b79d12869111016a6720ea61fb |
--- /dev/null |
+++ b/base/mac/bundle_locations.h |
@@ -0,0 +1,62 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef BASE_MAC_BUNDLE_LOCATIONS_H_ |
+#define BASE_MAC_BUNDLE_LOCATIONS_H_ |
+#pragma once |
+ |
+#include "base/base_export.h" |
+#include "base/file_path.h" |
+ |
+#if defined(__OBJC__) |
+#import <Foundation/Foundation.h> |
+#else // __OBJC__ |
+class NSBundle; |
+class NSString; |
+#endif // __OBJC__ |
+ |
+class FilePath; |
+ |
+namespace base { |
+namespace mac { |
+ |
+// This file provides several functions to explicitly request the various |
+// component bundles of Chrome. Please use these methods rather than calling |
+// +[NSBundle mainBundle] or CFBundleGetMainBundle(). |
+// |
+// Terminology |
+// - "Outer Bundle" - This is the main bundle for Chrome, it's what |
Avi (use Gerrit)
2012/01/10 15:37:13
semicolon after 'Chrome' rather than comma
jeremy
2012/01/11 07:12:44
Done.
|
+// +[NSBundle mainBundle] returns when Chrome is launched normally. |
+// |
+// - "Launch Bundle" - This is the bundle from which Chrome was launched. |
+// usually this should be the same as the outer bundle except when Chrome |
Avi (use Gerrit)
2012/01/10 15:37:13
"Usually this should" is pleonastic. Try
This wil
jeremy
2012/01/11 07:12:44
Done.
|
+// is launched via an app shortcut in which case this will return the app |
+// shortcut's bundle rather than the main Chrome bundle. |
+// |
+// - "Framework Bundle" - Bundle corresponding to the Chrome framework. |
Avi (use Gerrit)
2012/01/10 15:37:13
First two items in the list were "This is the bund
jeremy
2012/01/11 07:12:44
Done.
|
+// |
+// Guidelines for use: |
+// - To access a resource, the Framework bundle should be used. |
+// - If the choice is between the Outer or Launch bundles then please chose |
Avi (use Gerrit)
2012/01/10 15:37:13
s/chose/choose/
jeremy
2012/01/11 07:12:44
Done.
|
+// carefully. Most often the Outer bundle will be the right choice, but for |
+// cases such as adding an app to the "launch on startup" list, the Launch |
+// bundle is probably the one to use. |
+ |
+// Methods for retrieving the various bundles. |
+BASE_EXPORT NSBundle* LaunchBundle(); |
+BASE_EXPORT FilePath LaunchBundleBundlePath(); |
Avi (use Gerrit)
2012/01/10 15:37:13
Why two 'Bundle's here but one in OuterBundlePath?
jeremy
2012/01/11 07:12:44
Done.
|
+BASE_EXPORT NSBundle* OuterBundle(); |
+BASE_EXPORT FilePath OuterBundlePath(); |
+BASE_EXPORT NSBundle* FrameworkBundle(); |
Avi (use Gerrit)
2012/01/10 15:37:13
FrameworkBundlePath isn't needed?
jeremy
2012/01/11 07:12:44
Done.
|
+ |
+// Set the bundle that MainAppBundle will return, overriding the default value |
Avi (use Gerrit)
2012/01/10 15:37:13
There is no MainAppBundle nor SetOverrideAppBundle
jeremy
2012/01/11 07:12:44
Done.
|
+// (Restore the default by calling SetOverrideAppBundle(nil)). |
+BASE_EXPORT void SetOverrideLaunchBundle(NSBundle* bundle); |
+BASE_EXPORT void SetOverrideFrameworkBundle(NSBundle* bundle); |
+BASE_EXPORT void SetOverrideOuterBundle(NSBundle* bundle); |
Mark Mentovai
2012/01/10 22:09:35
This is replacing base/mac/foundation_util base::m
jeremy
2012/01/11 07:12:44
Done.
|
+ |
Mark Mentovai
2012/01/10 22:09:35
Maybe we should just have
// In the .h:
enum Whi
jeremy
2012/01/11 07:12:44
Personally I prefer the method in this patch to th
|
+} // namespace mac |
+} // namespace base |
+ |
+#endif // #ifndef BASE_MAC_BUNDLE_LOCATIONS_H_ |
Mark Mentovai
2012/01/10 22:09:35
No #ifndef in the comment.
jeremy
2012/01/11 07:12:44
Done.
|