summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-07 16:42:16 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-07 16:42:16 +0000
commite4221ad535d561b931bd900db9278825adf36b06 (patch)
tree5ca7bef32977d76773f975d13a34c11dd86eab04
parent9997409a1d70d0f44936ce49227520406b543c6d (diff)
downloadchromium_src-e4221ad535d561b931bd900db9278825adf36b06.zip
chromium_src-e4221ad535d561b931bd900db9278825adf36b06.tar.gz
chromium_src-e4221ad535d561b931bd900db9278825adf36b06.tar.bz2
Move all resources into the framework.
BUG=14610 (in support of unbreaking auto-update) TEST=The .app's Contents/Resources folder should not contain the resources that are moving to the .framework's Resources folder; The .app's Contents/Resources folder should still contain app.icns, document.icns, the helper .app, and a whole slew of .lprojs that only contain InfoPlist.strings; Make sure Breakpad still works in the browser, renderer, and other process types. Review URL: http://codereview.chromium.org/256062 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28262 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--app/test_suite.h18
-rw-r--r--base/mac_util.h1
-rw-r--r--base/mac_util.mm5
-rw-r--r--chrome/app/app-Info.plist2
-rw-r--r--chrome/app/chrome_dll_main.cc7
-rwxr-xr-xchrome/app/clean_mac_resources32
-rwxr-xr-xchrome/app/tweak_mac_lproj_folders2
-rw-r--r--chrome/browser/cocoa/cocoa_test_helper.h5
-rw-r--r--chrome/browser/cocoa/nsimage_cache_unittest.mm5
-rwxr-xr-xchrome/chrome.gyp358
-rw-r--r--chrome/common/chrome_paths.cc9
-rw-r--r--chrome/common/chrome_paths_internal.h16
-rw-r--r--chrome/common/chrome_paths_mac.mm48
-rw-r--r--chrome/common/mac_app_names.h8
-rw-r--r--chrome/test/unit/chrome_test_suite.h4
15 files changed, 317 insertions, 203 deletions
diff --git a/app/test_suite.h b/app/test_suite.h
index 192f80e..8a04be9 100644
--- a/app/test_suite.h
+++ b/app/test_suite.h
@@ -33,12 +33,24 @@ class AppTestSuite : public TestSuite {
app::RegisterPathProvider();
#if defined(OS_MACOSX)
+ // Look in the framework bundle for resources.
+ // TODO(port): make a resource bundle for non-app exes.
FilePath path;
PathService::Get(base::DIR_EXE, &path);
- // TODO(port): make a resource bundle for non-app exes.
- path = path.AppendASCII("Chromium.app");
- mac_util::SetOverrideAppBundlePath(path);
+#if defined(GOOGLE_CHROME_BUILD)
+#define MAC_PRODUCT_NAME "Google Chrome"
+#elif defined(CHROMIUM_BUILD)
+#define MAC_PRODUCT_NAME "Chromium"
+#else
+#error Unknown branding
#endif
+ path = path.AppendASCII(MAC_PRODUCT_NAME ".app");
+ path = path.AppendASCII("Contents");
+ path = path.AppendASCII("Frameworks");
+ path = path.AppendASCII(MAC_PRODUCT_NAME " Framework.framework");
+#undef MAC_PRODUCT_NAME
+ mac_util::SetOverrideAppBundlePath(path);
+#endif // OS_MACOSX
// Force unittests to run using en-US so if we test against string
// output, it'll pass regardless of the system language.
diff --git a/base/mac_util.h b/base/mac_util.h
index 2235377..0baab02 100644
--- a/base/mac_util.h
+++ b/base/mac_util.h
@@ -31,6 +31,7 @@ bool IsBackgroundOnlyProcess();
// to fetch resources from bundles, but work within a unittest where we
// aren't a bundle.
NSBundle* MainAppBundle();
+FilePath MainAppBundlePath();
// Set the bundle that MainAppBundle will return, overriding the default value
// (Restore the default by calling SetOverrideAppBundle(nil)).
diff --git a/base/mac_util.mm b/base/mac_util.mm
index 2aa86f2..014342c 100644
--- a/base/mac_util.mm
+++ b/base/mac_util.mm
@@ -61,6 +61,11 @@ NSBundle* MainAppBundle() {
return [NSBundle mainBundle];
}
+FilePath MainAppBundlePath() {
+ NSBundle* bundle = MainAppBundle();
+ return FilePath([[bundle bundlePath] fileSystemRepresentation]);
+}
+
void SetOverrideAppBundle(NSBundle* bundle) {
if (bundle != g_override_app_bundle) {
[g_override_app_bundle release];
diff --git a/chrome/app/app-Info.plist b/chrome/app/app-Info.plist
index 4dc9ca5..b0784d7 100644
--- a/chrome/app/app-Info.plist
+++ b/chrome/app/app-Info.plist
@@ -186,8 +186,6 @@
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>10.5.0</string>
- <key>NSMainNibFile</key>
- <string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>CrApplication</string>
<key>UTExportedTypeDeclarations</key>
diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc
index 02f5b36..4422027 100644
--- a/chrome/app/chrome_dll_main.cc
+++ b/chrome/app/chrome_dll_main.cc
@@ -354,12 +354,7 @@ int ChromeMain(int argc, char** argv) {
parsed_command_line.GetSwitchValue(switches::kProcessType);
#if defined(OS_MACOSX)
- // If process_type is not empty, this is the helper. Set the main app bundle
- // so code can fetch Mac resources.
- if (!process_type.empty()) {
- FilePath main_path(chrome::GetBrowserBundlePath());
- mac_util::SetOverrideAppBundlePath(main_path);
- }
+ mac_util::SetOverrideAppBundle(chrome::GetFrameworkBundle());
#endif // OS_MACOSX
#if defined(OS_WIN)
diff --git a/chrome/app/clean_mac_resources b/chrome/app/clean_mac_resources
new file mode 100755
index 0000000..36aefca
--- /dev/null
+++ b/chrome/app/clean_mac_resources
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# Copyright (c) 2009 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.
+
+set -e
+
+# Resources used to live in the .app bundle's Resources directory, but now,
+# almost all of them have moved into the .framework. To avoid having the old
+# resources get in the way of non-clobber builds, this script removes them.
+
+# TODO(mark): Remove this some time after October 20, 2009, allowing two weeks
+# for the transition.
+
+RESOURCES_DIR="${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/Resources"
+
+# app.icns and document.icns are referenced by the app's Info.plist and must
+# remain in the .app bundle. chrome_debug.log is created by debug builds,
+# there's no reason to remove it if present.
+find "${RESOURCES_DIR}" -type f -depth 1 \
+ \! -name app.icns \! -name document.icns \! -name chrome_debug.log \
+ -exec rm -f {} \;
+
+# Get rid of the locale.pak files in each .lproj directory. The .lprojs
+# themselves must stay, because they still hold InfoPlist.strings files with
+# localized strings for things like the Finder's Get Info window.
+find "${RESOURCES_DIR}" -type f -depth 2 -name locale.pak -exec rm -f {} \;
+
+# Get rid of the Breakpad helpers (Breakpad-enabled builds only).
+rm -rf "${RESOURCES_DIR}/crash_report_sender.app" \
+ "${RESOURCES_DIR}/crash_inspector"
diff --git a/chrome/app/tweak_mac_lproj_folders b/chrome/app/tweak_mac_lproj_folders
index 46ef42f..6fffcdf 100755
--- a/chrome/app/tweak_mac_lproj_folders
+++ b/chrome/app/tweak_mac_lproj_folders
@@ -11,7 +11,7 @@
set -e
# Working in the resources directory
-cd "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/Contents/Resources"
+cd "${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/Resources"
# Provide an link for en.lproj that points to en_US.lproj.
diff --git a/chrome/browser/cocoa/cocoa_test_helper.h b/chrome/browser/cocoa/cocoa_test_helper.h
index 282db9c..ebcb4d4 100644
--- a/chrome/browser/cocoa/cocoa_test_helper.h
+++ b/chrome/browser/cocoa/cocoa_test_helper.h
@@ -50,10 +50,13 @@
class CocoaTestHelper {
public:
CocoaTestHelper() {
- // Look in the Chromium app bundle for resources.
+ // Look in the framework bundle for resources.
FilePath path;
PathService::Get(base::DIR_EXE, &path);
path = path.AppendASCII(MAC_BROWSER_APP_NAME);
+ path = path.AppendASCII("Contents");
+ path = path.AppendASCII("Frameworks");
+ path = path.AppendASCII(MAC_FRAMEWORK_NAME);
mac_util::SetOverrideAppBundlePath(path);
// Bootstrap Cocoa. It's very unhappy without this.
diff --git a/chrome/browser/cocoa/nsimage_cache_unittest.mm b/chrome/browser/cocoa/nsimage_cache_unittest.mm
index 9ecf747..6283ffe 100644
--- a/chrome/browser/cocoa/nsimage_cache_unittest.mm
+++ b/chrome/browser/cocoa/nsimage_cache_unittest.mm
@@ -20,10 +20,13 @@ namespace {
class NSImageCacheTest : public PlatformTest {
public:
NSImageCacheTest() {
- // Look in the Chromium app bundle for resources.
+ // Look in the framework bundle for resources.
FilePath path;
PathService::Get(base::DIR_EXE, &path);
path = path.AppendASCII(MAC_BROWSER_APP_NAME);
+ path = path.AppendASCII("Contents");
+ path = path.AppendASCII("Frameworks");
+ path = path.AppendASCII(MAC_FRAMEWORK_NAME);
mac_util::SetOverrideAppBundlePath(path);
}
virtual ~NSImageCacheTest() {
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 5e97e00..20517d4 100755
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -995,8 +995,6 @@
'browser/cocoa/clear_browsing_data_controller.mm',
'browser/cocoa/clickhold_button_cell.h',
'browser/cocoa/clickhold_button_cell.mm',
- 'browser/cocoa/cocoa_test_helper.h',
- 'browser/cocoa/cocoa_test_helper.mm',
'browser/cocoa/command_observer_bridge.h',
'browser/cocoa/command_observer_bridge.mm',
'browser/cocoa/constrained_window_mac.h',
@@ -3245,60 +3243,6 @@
'../build/util/support/support.gyp:*',
],
'mac_bundle_resources': [
- # put any pdfs down in the sources block below so pdfsqueeze runs on
- # them.
- 'app/nibs/About.xib',
- 'app/nibs/AboutIPC.xib',
- 'app/nibs/BookmarkBar.xib',
- 'app/nibs/BookmarkBubble.xib',
- 'app/nibs/BookmarkEditor.xib',
- 'app/nibs/BookmarkNameFolder.xib',
- 'app/nibs/BrowserWindow.xib',
- 'app/nibs/ClearBrowsingData.xib',
- 'app/nibs/DownloadItem.xib',
- 'app/nibs/DownloadShelf.xib',
- 'app/nibs/EditSearchEngine.xib',
- 'app/nibs/ExtensionShelf.xib',
- 'app/nibs/FindBar.xib',
- 'app/nibs/FirstRunDialog.xib',
- 'app/nibs/HungRendererDialog.xib',
- 'app/nibs/HttpAuthLoginSheet.xib',
- 'app/nibs/InfoBar.xib',
- 'app/nibs/InfoBarContainer.xib',
- 'app/nibs/ImportProgressDialog.xib',
- 'app/nibs/KeywordEditor.xib',
- 'app/nibs/MainMenu.xib',
- 'app/nibs/PageInfo.xib',
- 'app/nibs/Preferences.xib',
- 'app/nibs/SaveAccessoryView.xib',
- 'app/nibs/TabContents.xib',
- 'app/nibs/TabView.xib',
- 'app/nibs/TaskManager.xib',
- 'app/nibs/Toolbar.xib',
- 'app/theme/alert_small.png',
- 'app/theme/back_Template.pdf',
- 'app/theme/bookmark_bar_folder.png',
- 'app/theme/chevron.png', # TODO(jrg): get (and use) a pdf version
- 'app/theme/close_bar.pdf',
- 'app/theme/close_bar_h.pdf',
- 'app/theme/close_bar_p.pdf',
- 'app/theme/downloads_favicon.png',
- 'app/theme/find_next_Template.pdf',
- 'app/theme/find_prev_Template.pdf',
- 'app/theme/forward_Template.pdf',
- 'app/theme/go_Template.pdf',
- 'app/theme/home_Template.pdf',
- 'app/theme/menu_chrome_rtl_Template.pdf',
- 'app/theme/menu_chrome_Template.pdf',
- 'app/theme/menu_page_rtl_Template.pdf',
- 'app/theme/menu_page_Template.pdf',
- 'app/theme/nav.pdf',
- 'app/theme/newtab.pdf',
- 'app/theme/otr_icon.pdf',
- 'app/theme/reload_Template.pdf',
- 'app/theme/star_Template.pdf',
- 'app/theme/starred.pdf',
- 'app/theme/stop_Template.pdf',
'app/app-Info.plist',
],
# TODO(mark): Come up with a fancier way to do this. It should only
@@ -3440,12 +3384,6 @@
'../breakpad/breakpad.gyp:dump_syms',
'../breakpad/breakpad.gyp:symupload',
],
- 'copies': [
- {
- 'destination': '<(PRODUCT_DIR)/<(mac_product_name).app/Contents/Resources/',
- 'files': ['<(PRODUCT_DIR)/crash_inspector', '<(PRODUCT_DIR)/crash_report_sender.app'],
- },
- ],
'postbuilds': [
{
'postbuild_name': 'Dump Symbols',
@@ -3481,25 +3419,9 @@
'dependencies': [
'helper_app',
'infoplist_strings_tool',
- # Bring in pdfsqueeze and run it on all pdfs
- '../build/temp_gyp/pdfsqueeze.gyp:pdfsqueeze',
# This library provides the real implementation for NaClSyscallSeg
'../native_client/src/trusted/service_runtime/arch/x86_32/service_runtime_x86_32.gyp:service_runtime_x86_32_chrome'
],
- 'rules': [
- {
- 'rule_name': 'pdfsqueeze',
- 'extension': 'pdf',
- 'inputs': [
- '<(PRODUCT_DIR)/pdfsqueeze',
- ],
- 'outputs': [
- '<(INTERMEDIATE_DIR)/pdfsqueeze/<(RULE_INPUT_ROOT).pdf',
- ],
- 'action': ['<(PRODUCT_DIR)/pdfsqueeze', '<(RULE_INPUT_PATH)', '<@(_outputs)'],
- 'message': 'Running pdfsqueeze on <(RULE_INPUT_PATH)',
- },
- ],
'actions': [
{
# Generate the InfoPlist.strings file
@@ -3550,19 +3472,16 @@
'destination': '<(PRODUCT_DIR)/<(mac_product_name).app/Contents/Frameworks',
'files': ['<(PRODUCT_DIR)/<(mac_product_name) Framework.framework'],
},
- {
- # Copy web inspector resources to the Contents/Resources folder.
- 'destination': '<(PRODUCT_DIR)/<(mac_product_name).app/Contents/Resources',
- 'files': ['<(PRODUCT_DIR)/resources/inspector/'],
- },
],
'postbuilds': [
{
# Modify the Info.plist as needed. The script explains why this
- # is needed. This is also done in the helper_app target.
+ # is needed. This is also done in the helper_app and chrome_dll
+ # targets. Use -b0 to not include any Breakpad information;
+ # that all goes into the framework's Info.plist.
'postbuild_name': 'Tweak Info.plist',
'action': ['<(DEPTH)/build/mac/tweak_app_infoplist',
- '-b<(mac_breakpad)',
+ '-b0',
'-k<(mac_keystone)',
'-s1', # Include Subversion information
'<(branding)'],
@@ -3571,6 +3490,11 @@
'postbuild_name': 'Tweak Mac lproj folders',
'action': ['app/tweak_mac_lproj_folders'],
},
+ {
+ # TODO(mark): Remove after October 20, 2009.
+ 'postbuild_name': 'Clean up old resources',
+ 'action': ['app/clean_mac_resources'],
+ },
], # postbuilds
}, { # else: OS != "mac"
'conditions': [
@@ -3694,10 +3618,19 @@
},
],
}, { # 'OS!="win"
+ 'sources!': [
+ 'app/chrome_exe_main.cc',
+ 'app/client_util.cc',
+ 'app/google_update_client.cc',
+ ]
+ }],
+ ['OS=="linux" or OS=="freebsd"', {
'variables': {
'repack_path': '../tools/data_pack/repack.py',
},
'actions': [
+ # TODO(mark): These actions are duplicated for the Mac in the
+ # chrome_dll target. Can they be unified?
{
'action_name': 'repack_chrome',
'variables': {
@@ -3716,8 +3649,8 @@
'outputs': [
'<(INTERMEDIATE_DIR)/repack/chrome.pak',
],
- 'action': ['python', '<(repack_path)', '<@(_outputs)', '<@(pak_inputs)'],
- 'process_outputs_as_mac_bundle_resources': 1,
+ 'action': ['python', '<(repack_path)', '<@(_outputs)',
+ '<@(pak_inputs)'],
},
{
'action_name': 'repack_theme',
@@ -3732,21 +3665,13 @@
'<@(pak_inputs)',
],
'outputs': [
- '<(INTERMEDIATE_DIR)/repack/theme.pak',
- ],
- 'action': ['python', '<(repack_path)', '<@(_outputs)', '<@(pak_inputs)'],
- 'process_outputs_as_mac_bundle_resources': 1,
- 'conditions': [
- ['OS=="linux" or OS=="freebsd"', {
- 'outputs=': [
- '<(INTERMEDIATE_DIR)/repack/default.pak',
- ]
- }],
+ '<(INTERMEDIATE_DIR)/repack/default.pak',
],
+ 'action': ['python', '<(repack_path)', '<@(_outputs)',
+ '<@(pak_inputs)'],
},
{
'action_name': 'repack_locales',
- 'process_outputs_as_mac_bundle_resources': 1,
'variables': {
'conditions': [
['branding=="Chrome"', {
@@ -3768,7 +3693,8 @@
'outputs': [
'>!@(<(repack_locales_cmd) -o -g \'<(grit_out_dir)\' -s \'<(SHARED_INTERMEDIATE_DIR)\' -x \'<(INTERMEDIATE_DIR)\' <(locales))',
],
- 'action': ['<@(repack_locales_cmd)',
+ 'action': [
+ '<@(repack_locales_cmd)',
'<@(branding_flag)',
'-g', '<(grit_out_dir)',
'-s', '<(SHARED_INTERMEDIATE_DIR)',
@@ -3777,11 +3703,6 @@
],
},
],
- 'sources!': [
- 'app/chrome_exe_main.cc',
- 'app/client_util.cc',
- 'app/google_update_client.cc',
- ]
}],
],
},
@@ -4251,6 +4172,8 @@
'browser/cocoa/bubble_view_unittest.mm',
'browser/cocoa/clear_browsing_data_controller_unittest.mm',
'browser/cocoa/clickhold_button_cell_unittest.mm',
+ 'browser/cocoa/cocoa_test_helper.h',
+ 'browser/cocoa/cocoa_test_helper.mm',
'browser/cocoa/command_observer_bridge_unittest.mm',
'browser/cocoa/custom_home_pages_model_unittest.mm',
'browser/cocoa/delayedmenu_button_unittest.mm',
@@ -4989,69 +4912,197 @@
# three times it is listed here.
'mac_bundle_resources': [
'app/framework-Info.plist',
+ 'app/nibs/About.xib',
+ 'app/nibs/AboutIPC.xib',
+ 'app/nibs/BookmarkBar.xib',
+ 'app/nibs/BookmarkBubble.xib',
+ 'app/nibs/BookmarkEditor.xib',
+ 'app/nibs/BookmarkNameFolder.xib',
+ 'app/nibs/BrowserWindow.xib',
+ 'app/nibs/ClearBrowsingData.xib',
+ 'app/nibs/DownloadItem.xib',
+ 'app/nibs/DownloadShelf.xib',
+ 'app/nibs/EditSearchEngine.xib',
+ 'app/nibs/ExtensionShelf.xib',
+ 'app/nibs/FindBar.xib',
+ 'app/nibs/FirstRunDialog.xib',
+ 'app/nibs/HungRendererDialog.xib',
+ 'app/nibs/HttpAuthLoginSheet.xib',
+ 'app/nibs/InfoBar.xib',
+ 'app/nibs/InfoBarContainer.xib',
+ 'app/nibs/ImportProgressDialog.xib',
+ 'app/nibs/KeywordEditor.xib',
+ 'app/nibs/MainMenu.xib',
+ 'app/nibs/PageInfo.xib',
+ 'app/nibs/Preferences.xib',
+ 'app/nibs/SaveAccessoryView.xib',
+ 'app/nibs/TabContents.xib',
+ 'app/nibs/TabView.xib',
+ 'app/nibs/TaskManager.xib',
+ 'app/nibs/Toolbar.xib',
+ 'app/theme/alert_small.png',
+ 'app/theme/back_Template.pdf',
+ 'app/theme/bookmark_bar_folder.png',
+ 'app/theme/chevron.png', # TODO(jrg): get and use a pdf version
+ 'app/theme/close_bar.pdf',
+ 'app/theme/close_bar_h.pdf',
+ 'app/theme/close_bar_p.pdf',
+ 'app/theme/downloads_favicon.png',
+ 'app/theme/find_next_Template.pdf',
+ 'app/theme/find_prev_Template.pdf',
+ 'app/theme/forward_Template.pdf',
+ 'app/theme/go_Template.pdf',
+ 'app/theme/home_Template.pdf',
+ 'app/theme/menu_chrome_rtl_Template.pdf',
+ 'app/theme/menu_chrome_Template.pdf',
+ 'app/theme/menu_page_rtl_Template.pdf',
+ 'app/theme/menu_page_Template.pdf',
+ 'app/theme/nav.pdf',
+ 'app/theme/newtab.pdf',
+ 'app/theme/otr_icon.pdf',
+ 'app/theme/reload_Template.pdf',
+ 'app/theme/star_Template.pdf',
+ 'app/theme/starred.pdf',
+ 'app/theme/stop_Template.pdf',
],
'mac_bundle_resources!': [
'app/framework-Info.plist',
],
'dependencies': [
+ # Bring in pdfsqueeze and run it on all pdfs
+ '../build/temp_gyp/pdfsqueeze.gyp:pdfsqueeze',
'../build/util/support/support.gyp:*',
],
- # For now, don't put any resources into the framework. Exclude
- # them all and push them into the bundle resources of the sole
- # app bundle, the only dependent of this target.
- # TODO(mark): Fix.
- 'mac_bundle_resources/': [
- ['exclude', '.*'],
+ 'rules': [
+ {
+ 'rule_name': 'pdfsqueeze',
+ 'extension': 'pdf',
+ 'inputs': [
+ '<(PRODUCT_DIR)/pdfsqueeze',
+ ],
+ 'outputs': [
+ '<(INTERMEDIATE_DIR)/pdfsqueeze/<(RULE_INPUT_ROOT).pdf',
+ ],
+ 'action': ['<(PRODUCT_DIR)/pdfsqueeze',
+ '<(RULE_INPUT_PATH)', '<@(_outputs)'],
+ 'message': 'Running pdfsqueeze on <(RULE_INPUT_PATH)',
+ },
],
- 'direct_dependent_settings': {
- 'mac_bundle_resources': [
- '../third_party/WebKit/WebCore/Resources/aliasCursor.png',
- '../third_party/WebKit/WebCore/Resources/cellCursor.png',
- '../third_party/WebKit/WebCore/Resources/contextMenuCursor.png',
- '../third_party/WebKit/WebCore/Resources/copyCursor.png',
- '../third_party/WebKit/WebCore/Resources/crossHairCursor.png',
- '../third_party/WebKit/WebCore/Resources/eastResizeCursor.png',
- '../third_party/WebKit/WebCore/Resources/eastWestResizeCursor.png',
- '../third_party/WebKit/WebCore/Resources/helpCursor.png',
- '../third_party/WebKit/WebCore/Resources/linkCursor.png',
- '../third_party/WebKit/WebCore/Resources/missingImage.png',
- '../third_party/WebKit/WebCore/Resources/moveCursor.png',
- '../third_party/WebKit/WebCore/Resources/noDropCursor.png',
- '../third_party/WebKit/WebCore/Resources/noneCursor.png',
- '../third_party/WebKit/WebCore/Resources/northEastResizeCursor.png',
- '../third_party/WebKit/WebCore/Resources/northEastSouthWestResizeCursor.png',
- '../third_party/WebKit/WebCore/Resources/northResizeCursor.png',
- '../third_party/WebKit/WebCore/Resources/northWestResizeCursor.png',
- '../third_party/WebKit/WebCore/Resources/northWestSouthEastResizeCursor.png',
- '../third_party/WebKit/WebCore/Resources/notAllowedCursor.png',
- '../third_party/WebKit/WebCore/Resources/progressCursor.png',
- '../third_party/WebKit/WebCore/Resources/southEastResizeCursor.png',
- '../third_party/WebKit/WebCore/Resources/southResizeCursor.png',
- '../third_party/WebKit/WebCore/Resources/southWestResizeCursor.png',
- '../third_party/WebKit/WebCore/Resources/verticalTextCursor.png',
- '../third_party/WebKit/WebCore/Resources/waitCursor.png',
- '../third_party/WebKit/WebCore/Resources/westResizeCursor.png',
- '../third_party/WebKit/WebCore/Resources/zoomInCursor.png',
- '../third_party/WebKit/WebCore/Resources/zoomOutCursor.png',
- 'renderer/renderer.sb',
- ],
+ 'variables': {
+ 'repack_path': '../tools/data_pack/repack.py',
},
+ 'actions': [
+ # TODO(mark): These actions are duplicated for Linux and
+ # and FreeBSD in the chrome target. Can they be unified?
+ {
+ 'action_name': 'repack_chrome',
+ 'variables': {
+ 'pak_inputs': [
+ '<(grit_out_dir)/browser_resources.pak',
+ '<(grit_out_dir)/common_resources.pak',
+ '<(grit_out_dir)/renderer_resources.pak',
+ '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak',
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.pak',
+ ],
+ },
+ 'inputs': [
+ '<(repack_path)',
+ '<@(pak_inputs)',
+ ],
+ 'outputs': [
+ '<(INTERMEDIATE_DIR)/repack/chrome.pak',
+ ],
+ 'action': ['python', '<(repack_path)', '<@(_outputs)',
+ '<@(pak_inputs)'],
+ 'process_outputs_as_mac_bundle_resources': 1,
+ },
+ {
+ 'action_name': 'repack_theme',
+ 'variables': {
+ 'pak_inputs': [
+ '<(SHARED_INTERMEDIATE_DIR)/app/app_resources.pak',
+ '<(grit_out_dir)/theme_resources.pak',
+ ],
+ },
+ 'inputs': [
+ '<(repack_path)',
+ '<@(pak_inputs)',
+ ],
+ 'outputs': [
+ '<(INTERMEDIATE_DIR)/repack/theme.pak',
+ ],
+ 'action': ['python', '<(repack_path)', '<@(_outputs)',
+ '<@(pak_inputs)'],
+ 'process_outputs_as_mac_bundle_resources': 1,
+ },
+ {
+ 'action_name': 'repack_locales',
+ 'process_outputs_as_mac_bundle_resources': 1,
+ 'variables': {
+ 'conditions': [
+ ['branding=="Chrome"', {
+ 'branding_flag': ['-b', 'google_chrome',],
+ }, { # else: branding!="Chrome"
+ 'branding_flag': ['-b', 'chromium',],
+ }],
+ ],
+ },
+ 'inputs': [
+ 'tools/build/repack_locales.py',
+ # NOTE: Ideally the common command args would be shared
+ # amongst inputs/outputs/action, but the args include shell
+ # variables which need to be passed intact, and command
+ # expansion wants to expand the shell variables. Adding the
+ # explicit quoting here was the only way it seemed to work.
+ '>!@(<(repack_locales_cmd) -i <(branding_flag) -g \'<(grit_out_dir)\' -s \'<(SHARED_INTERMEDIATE_DIR)\' -x \'<(INTERMEDIATE_DIR)\' <(locales))',
+ ],
+ 'outputs': [
+ '>!@(<(repack_locales_cmd) -o -g \'<(grit_out_dir)\' -s \'<(SHARED_INTERMEDIATE_DIR)\' -x \'<(INTERMEDIATE_DIR)\' <(locales))',
+ ],
+ 'action': [
+ '<@(repack_locales_cmd)',
+ '<@(branding_flag)',
+ '-g', '<(grit_out_dir)',
+ '-s', '<(SHARED_INTERMEDIATE_DIR)',
+ '-x', '<(INTERMEDIATE_DIR)',
+ '<@(locales)',
+ ],
+ },
+ ],
'postbuilds': [
{
# Modify the Info.plist as needed. The script explains why
# this is needed. This is also done in the chrome target.
- # The framework does not need the breakpad, keystone, or
- # subversion keys as those are only needed on the main
- # or helper app.
+ # The framework does not need the Keystone or Subversion
+ # keys, but it does need the Breakpad keys.
'postbuild_name': 'Tweak Info.plist',
'action': ['<(DEPTH)/build/mac/tweak_app_infoplist',
- '-b0',
+ '-b<(mac_breakpad)',
'-k0',
'-s0',
'<(branding)'],
},
+ {
+ 'postbuild_name': 'Tweak Mac lproj folders',
+ 'action': ['app/tweak_mac_lproj_folders'],
+ },
+ ],
+ 'copies': [
+ {
+ 'destination': '<(PRODUCT_DIR)/$(CONTENTS_FOLDER_PATH)/Resources',
+ 'files': [
+ '<(PRODUCT_DIR)/resources/inspector/'
+ ],
+ 'conditions': [
+ ['mac_breakpad==1', {
+ 'files': [
+ '<(PRODUCT_DIR)/crash_inspector',
+ '<(PRODUCT_DIR)/crash_report_sender.app'
+ ],
+ }],
+ ],
+ },
],
-
'conditions': [
['mac_breakpad==1', {
'variables': {
@@ -5178,14 +5229,15 @@
},
{
# Modify the Info.plist as needed. The script explains why this
- # is needed. This is also done in the chrome target. In
- # this case, -k0 is always used because Keystone never runs
- # within the helper app. -s0 is used to avoid placing Subversion
- # data in the helper app's Info.plist. It will be present in
- # the main app's Info.plist, which is sufficient.
+ # is needed. This is also done in the chrome and chrome_dll
+ # targets. In this case, -b0 is used because Breakpad data is
+ # not placed into the helper, it is only placed in the framework.
+ # -k0 is used because Keystone never runs within the helper, only
+ # within the main app. -s0 is used to avoid placing Subversion
+ # data in the helper's Info.plist.
'postbuild_name': 'Tweak Info.plist',
'action': ['<(DEPTH)/build/mac/tweak_app_infoplist',
- '-b<(mac_breakpad)',
+ '-b0',
'-k0',
'-s0',
'<(branding)'],
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc
index 8612e68..aa9ae8d 100644
--- a/chrome/common/chrome_paths.cc
+++ b/chrome/common/chrome_paths.cc
@@ -115,16 +115,15 @@ bool PathProvider(int key, FilePath* result) {
return false;
break;
case chrome::DIR_INSPECTOR:
- if (!PathService::Get(chrome::DIR_APP, &cur))
- return false;
#if defined(OS_MACOSX)
- cur = cur.DirName();
+ cur = mac_util::MainAppBundlePath();
cur = cur.Append(FILE_PATH_LITERAL("Resources"));
- cur = cur.Append(FILE_PATH_LITERAL("inspector"));
#else
+ if (!PathService::Get(chrome::DIR_APP, &cur))
+ return false;
cur = cur.Append(FILE_PATH_LITERAL("resources"));
- cur = cur.Append(FILE_PATH_LITERAL("inspector"));
#endif
+ cur = cur.Append(FILE_PATH_LITERAL("inspector"));
break;
case chrome::DIR_APP_DICTIONARIES:
#if defined(OS_LINUX) || defined(OS_MACOSX)
diff --git a/chrome/common/chrome_paths_internal.h b/chrome/common/chrome_paths_internal.h
index 54b9870..dc61634 100644
--- a/chrome/common/chrome_paths_internal.h
+++ b/chrome/common/chrome_paths_internal.h
@@ -9,6 +9,14 @@
#include "base/file_path.h"
+#if defined(OS_MACOSX)
+#ifdef __OBJC__
+@class NSBundle;
+#else
+class NSBundle;
+#endif
+#endif
+
namespace chrome {
// Get the path to the user's data directory, regardless of whether
@@ -30,13 +38,9 @@ bool GetUserDownloadsDirectory(FilePath* result);
bool GetUserDesktop(FilePath* result);
#if defined(OS_MACOSX)
-// Retrieves the browser bundle path. It is only valid to call this from a
-// helper process, as it makes assumptions about the location of the enclosing
-// bundle on disk.
-FilePath GetBrowserBundlePath();
-#endif // defined(OS_MACOSX)
+NSBundle* GetFrameworkBundle();
+#endif // OS_MACOSX
} // namespace chrome
-
#endif // CHROME_COMMON_CHROME_PATHS_INTERNAL_H_
diff --git a/chrome/common/chrome_paths_mac.mm b/chrome/common/chrome_paths_mac.mm
index 734a0a9..2d350a8 100644
--- a/chrome/common/chrome_paths_mac.mm
+++ b/chrome/common/chrome_paths_mac.mm
@@ -2,13 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#import "chrome/common/chrome_paths_internal.h"
+#include "chrome/common/chrome_paths_internal.h"
#import <Cocoa/Cocoa.h>
-#import "base/base_paths.h"
-#import "base/logging.h"
-#import "base/path_service.h"
+#include "base/base_paths.h"
+#include "base/logging.h"
+#include "base/mac_util.h"
+#include "base/path_service.h"
namespace chrome {
@@ -64,30 +65,29 @@ bool GetUserDesktop(FilePath* result) {
return success;
}
-FilePath GetBrowserBundlePath() {
- NSBundle* running_app_bundle = [NSBundle mainBundle];
- NSString* running_app_bundle_path = [running_app_bundle bundlePath];
- DCHECK(running_app_bundle_path) << "failed to get the main bundle path";
+NSBundle* GetFrameworkBundle() {
+ NSString* app_bundle_identifier = [[NSBundle mainBundle] bundleIdentifier];
- // Are we the helper or the browser (main bundle)?
- if (![[[running_app_bundle infoDictionary]
- objectForKey:@"LSUIElement"] boolValue]) {
- // We aren't a LSUIElement, so this must be the browser, return it's path.
- return FilePath([running_app_bundle_path fileSystemRepresentation]);
+ NSString* browser_bundle_identifier = app_bundle_identifier;
+ if (mac_util::IsBackgroundOnlyProcess()) {
+ // Take off the last component of a background helper process' bundle
+ // identifier to form the browser process' bundle identifier.
+ NSRange range = [app_bundle_identifier rangeOfString:@"."
+ options:NSBackwardsSearch];
+ range.length = [app_bundle_identifier length] - range.location;
+ browser_bundle_identifier =
+ [app_bundle_identifier stringByReplacingCharactersInRange:range
+ withString:@""];
}
- // Helper lives at ...app/Contents/Resources/...Helper.app
- NSArray* components = [running_app_bundle_path pathComponents];
- DCHECK_GE([components count], static_cast<NSUInteger>(4))
- << "too few path components for this bundle to be within another bundle";
- components =
- [components subarrayWithRange:NSMakeRange(0, [components count] - 3)];
+ // Append ".framework" to the browser's bundle identifier to get the
+ // framework's bundle identifier.
+ NSString* framework_bundle_identifier =
+ [browser_bundle_identifier stringByAppendingString:@".framework"];
+ NSBundle* framework_bundle =
+ [NSBundle bundleWithIdentifier:framework_bundle_identifier];
- NSString* browser_path = [NSString pathWithComponents:components];
- DCHECK([[browser_path pathExtension] isEqualToString:@"app"])
- << "we weren't within another app?";
-
- return FilePath([browser_path fileSystemRepresentation]);
+ return framework_bundle;
}
} // namespace chrome
diff --git a/chrome/common/mac_app_names.h b/chrome/common/mac_app_names.h
index ab70987..0d8723a 100644
--- a/chrome/common/mac_app_names.h
+++ b/chrome/common/mac_app_names.h
@@ -5,12 +5,18 @@
#ifndef CHROME_COMMON_MAC_APP_NAMES_H_
#define CHROME_COMMON_MAC_APP_NAMES_H_
+#if !defined(UNIT_TEST)
+#error Don't use this file outside of tests
+#endif
+
#if defined(GOOGLE_CHROME_BUILD)
#define MAC_BROWSER_APP_NAME "Google Chrome.app"
+#define MAC_FRAMEWORK_NAME "Google Chrome Framework.framework"
#elif defined(CHROMIUM_BUILD)
#define MAC_BROWSER_APP_NAME "Chromium.app"
+#define MAC_FRAMEWORK_NAME "Chromium Framework.framework"
#else
-#error "Not sure what the branding is!"
+#error Not sure what the branding is!
#endif
#endif // CHROME_COMMON_MAC_APP_NAMES_H_
diff --git a/chrome/test/unit/chrome_test_suite.h b/chrome/test/unit/chrome_test_suite.h
index 9c838a4..145c330 100644
--- a/chrome/test/unit/chrome_test_suite.h
+++ b/chrome/test/unit/chrome_test_suite.h
@@ -98,9 +98,13 @@ class ChromeTestSuite : public TestSuite {
PathService::Override(chrome::DIR_USER_DATA, user_data_dir);
#if defined(OS_MACOSX)
+ // Look in the framework bundle for resources.
FilePath path;
PathService::Get(base::DIR_EXE, &path);
path = path.AppendASCII(MAC_BROWSER_APP_NAME);
+ path = path.AppendASCII("Contents");
+ path = path.AppendASCII("Frameworks");
+ path = path.AppendASCII(MAC_FRAMEWORK_NAME);
mac_util::SetOverrideAppBundlePath(path);
#endif