summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/i18n/icu_util.cc6
-rw-r--r--base/mac/foundation_util.h11
-rw-r--r--base/mac/foundation_util.mm39
-rw-r--r--chrome/app/chrome_main_mac.mm5
-rw-r--r--chrome/browser/ui/cocoa/cocoa_test_helper.mm6
-rw-r--r--chrome/test/base/chrome_test_suite.cc7
-rw-r--r--ui/gfx/test_suite.cc8
-rw-r--r--webkit/tools/test_shell/run_all_tests.cc5
8 files changed, 32 insertions, 55 deletions
diff --git a/base/i18n/icu_util.cc b/base/i18n/icu_util.cc
index e5bbe17..5b6a580 100644
--- a/base/i18n/icu_util.cc
+++ b/base/i18n/icu_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -109,9 +109,9 @@ bool Initialize() {
// be released.
static file_util::MemoryMappedFile mapped_file;
if (!mapped_file.IsValid()) {
- // Assume it is in the MainBundle's Resources directory.
+ // Assume it is in the framework bundle's Resources directory.
FilePath data_path =
- base::mac::PathForMainAppBundleResource(CFSTR(ICU_UTIL_DATA_FILE_NAME));
+ base::mac::PathForFrameworkBundleResource(CFSTR(ICU_UTIL_DATA_FILE_NAME));
if (data_path.empty()) {
DLOG(ERROR) << ICU_UTIL_DATA_FILE_NAME << " not found in bundle";
return false;
diff --git a/base/mac/foundation_util.h b/base/mac/foundation_util.h
index 1a87470..580680c 100644
--- a/base/mac/foundation_util.h
+++ b/base/mac/foundation_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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.
@@ -49,13 +49,8 @@ BASE_EXPORT bool IsBackgroundOnlyProcess();
BASE_EXPORT NSBundle* MainAppBundle();
BASE_EXPORT FilePath MainAppBundlePath();
-// Returns the path to a resource within the MainAppBundle.
-FilePath PathForMainAppBundleResource(CFStringRef resourceName);
-
-// Set the bundle that MainAppBundle will return, overriding the default value
-// (Restore the default by calling SetOverrideAppBundle(nil)).
-BASE_EXPORT void SetOverrideAppBundle(NSBundle* bundle);
-BASE_EXPORT void SetOverrideAppBundlePath(const FilePath& file_path);
+// Returns the path to a resource within the framework bundle.
+FilePath PathForFrameworkBundleResource(CFStringRef resourceName);
// Returns the creator code associated with the CFBundleRef at bundle.
OSType CreatorCodeForCFBundleRef(CFBundleRef bundle);
diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm
index f1d277a..519af45 100644
--- a/base/mac/foundation_util.mm
+++ b/base/mac/foundation_util.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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.
@@ -9,6 +9,7 @@
#include "base/file_path.h"
#include "base/logging.h"
+#include "base/mac/bundle_locations.h"
#include "base/sys_string_conversions.h"
namespace base {
@@ -61,29 +62,22 @@ void SetOverrideAmIBundled(bool value) {
bool IsBackgroundOnlyProcess() {
// This function really does want to examine NSBundle's idea of the main
- // bundle dictionary, and not the overriden MainAppBundle. It needs to look
- // at the actual running .app's Info.plist to access its LSUIElement
- // property.
- NSDictionary* info_dictionary = [[NSBundle mainBundle] infoDictionary];
+ // bundle dictionary. It needs to look at the actual running .app's
+ // Info.plist to access its LSUIElement property.
+ NSDictionary* info_dictionary = [base::mac::MainBundle() infoDictionary];
return [[info_dictionary objectForKey:@"LSUIElement"] boolValue] != NO;
}
-// No threading worries since NSBundle isn't thread safe.
-static NSBundle* g_override_app_bundle = nil;
-
NSBundle* MainAppBundle() {
- if (g_override_app_bundle)
- return g_override_app_bundle;
- return [NSBundle mainBundle];
+ return base::mac::FrameworkBundle();
}
FilePath MainAppBundlePath() {
- NSBundle* bundle = MainAppBundle();
- return FilePath([[bundle bundlePath] fileSystemRepresentation]);
+ return base::mac::FrameworkBundlePath();
}
-FilePath PathForMainAppBundleResource(CFStringRef resourceName) {
- NSBundle* bundle = MainAppBundle();
+FilePath PathForFrameworkBundleResource(CFStringRef resourceName) {
+ NSBundle* bundle = base::mac::FrameworkBundle();
NSString* resourcePath = [bundle pathForResource:(NSString*)resourceName
ofType:nil];
if (!resourcePath)
@@ -91,21 +85,6 @@ FilePath PathForMainAppBundleResource(CFStringRef resourceName) {
return FilePath([resourcePath fileSystemRepresentation]);
}
-void SetOverrideAppBundle(NSBundle* bundle) {
- if (bundle != g_override_app_bundle) {
- [g_override_app_bundle release];
- g_override_app_bundle = [bundle retain];
- }
-}
-
-void SetOverrideAppBundlePath(const FilePath& file_path) {
- NSString* path = base::SysUTF8ToNSString(file_path.value());
- NSBundle* bundle = [NSBundle bundleWithPath:path];
- DCHECK(bundle) << "Failed to load the bundle at " << file_path.value();
-
- SetOverrideAppBundle(bundle);
-}
-
OSType CreatorCodeForCFBundleRef(CFBundleRef bundle) {
OSType creator = kUnknownType;
CFBundleGetPackageInfo(bundle, NULL, &creator);
diff --git a/chrome/app/chrome_main_mac.mm b/chrome/app/chrome_main_mac.mm
index a09f9d6..7923836 100644
--- a/chrome/app/chrome_main_mac.mm
+++ b/chrome/app/chrome_main_mac.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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.
@@ -11,6 +11,7 @@
#include "base/basictypes.h"
#include "base/file_path.h"
#include "base/logging.h"
+#import "base/mac/bundle_locations.h"
#import "base/mac/foundation_util.h"
#import "base/mac/scoped_nsautorelease_pool.h"
#include "base/sys_string_conversions.h"
@@ -38,7 +39,7 @@ void CheckUserDataDirPolicy(FilePath* user_data_dir) {
void SetUpBundleOverrides() {
base::mac::ScopedNSAutoreleasePool pool;
- base::mac::SetOverrideAppBundlePath(chrome::GetFrameworkBundlePath());
+ base::mac::SetOverrideFrameworkBundlePath(chrome::GetFrameworkBundlePath());
NSBundle* base_bundle = chrome::OuterAppBundle();
base::mac::SetBaseBundleID([[base_bundle bundleIdentifier] UTF8String]);
diff --git a/chrome/browser/ui/cocoa/cocoa_test_helper.mm b/chrome/browser/ui/cocoa/cocoa_test_helper.mm
index ab63a7b..aeaf1ee 100644
--- a/chrome/browser/ui/cocoa/cocoa_test_helper.mm
+++ b/chrome/browser/ui/cocoa/cocoa_test_helper.mm
@@ -1,10 +1,10 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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.
#import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
-#include "base/mac/foundation_util.h"
+#include "base/mac/bundle_locations.h"
#include "base/path_service.h"
#include "chrome/common/chrome_constants.h"
@@ -19,5 +19,5 @@ void CocoaTest::BootstrapCocoa() {
FilePath path;
PathService::Get(base::DIR_EXE, &path);
path = path.Append(chrome::kFrameworkName);
- base::mac::SetOverrideAppBundlePath(path);
+ base::mac::SetOverrideFrameworkBundlePath(path);
}
diff --git a/chrome/test/base/chrome_test_suite.cc b/chrome/test/base/chrome_test_suite.cc
index 0612fd4..cb22f64 100644
--- a/chrome/test/base/chrome_test_suite.cc
+++ b/chrome/test/base/chrome_test_suite.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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.
@@ -28,6 +28,7 @@
#include "ui/base/ui_base_paths.h"
#if defined(OS_MACOSX)
+#include "base/mac/bundle_locations.h"
#include "base/mac/mac_util.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "chrome/browser/chrome_browser_application_mac.h"
@@ -185,7 +186,7 @@ void ChromeTestSuite::Initialize() {
FilePath path;
PathService::Get(base::DIR_EXE, &path);
path = path.Append(chrome::kFrameworkName);
- base::mac::SetOverrideAppBundlePath(path);
+ base::mac::SetOverrideFrameworkBundlePath(path);
#endif
// Force unittests to run using en-US so if we test against string
@@ -219,7 +220,7 @@ void ChromeTestSuite::Shutdown() {
ResourceBundle::CleanupSharedInstance();
#if defined(OS_MACOSX)
- base::mac::SetOverrideAppBundle(NULL);
+ base::mac::SetOverrideFrameworkBundle(NULL);
#endif
base::StatsTable::set_current(NULL);
diff --git a/ui/gfx/test_suite.cc b/ui/gfx/test_suite.cc
index 1901ed0..046f694 100644
--- a/ui/gfx/test_suite.cc
+++ b/ui/gfx/test_suite.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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.
@@ -12,7 +12,7 @@
#include "ui/gfx/gfx_paths.h"
#if defined(OS_MACOSX)
-#include "base/mac/foundation_util.h"
+#include "base/mac/bundle_locations.h"
#endif
GfxTestSuite::GfxTestSuite(int argc, char** argv) : TestSuite(argc, argv) {}
@@ -37,7 +37,7 @@ void GfxTestSuite::Initialize() {
#else
#error Unknown branding
#endif
- base::mac::SetOverrideAppBundlePath(path);
+ base::mac::SetOverrideFrameworkBundlePath(path);
#elif defined(OS_POSIX)
FilePath pak_dir;
PathService::Get(base::DIR_MODULE, &pak_dir);
@@ -56,7 +56,7 @@ void GfxTestSuite::Shutdown() {
ui::ResourceBundle::CleanupSharedInstance();
#if defined(OS_MACOSX)
- base::mac::SetOverrideAppBundle(NULL);
+ base::mac::SetOverrideFrameworkBundle(NULL);
#endif
base::TestSuite::Shutdown();
}
diff --git a/webkit/tools/test_shell/run_all_tests.cc b/webkit/tools/test_shell/run_all_tests.cc
index 1a11b6e..68a71d4 100644
--- a/webkit/tools/test_shell/run_all_tests.cc
+++ b/webkit/tools/test_shell/run_all_tests.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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.
@@ -26,6 +26,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#if defined(OS_MACOSX)
+#include "base/mac/bundle_locations.h"
#include "base/mac/mac_util.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/path_service.h"
@@ -54,7 +55,7 @@ class TestShellTestSuite : public base::TestSuite {
FilePath path;
PathService::Get(base::DIR_EXE, &path);
path = path.AppendASCII("TestShell.app");
- base::mac::SetOverrideAppBundlePath(path);
+ base::mac::SetOverrideFrameworkBundlePath(path);
#endif
base::TestSuite::Initialize();