diff options
author | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-17 04:00:32 +0000 |
---|---|---|
committer | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-17 04:00:32 +0000 |
commit | cf06693e40afbc3ee50cb260739c3ef0d5ab1688 (patch) | |
tree | 7c2d05512351712bf236a5aaead33778293e0442 | |
parent | 95991b1967e509c94c3eb6bb0750fafd398c863c (diff) | |
download | chromium_src-cf06693e40afbc3ee50cb260739c3ef0d5ab1688.zip chromium_src-cf06693e40afbc3ee50cb260739c3ef0d5ab1688.tar.gz chromium_src-cf06693e40afbc3ee50cb260739c3ef0d5ab1688.tar.bz2 |
Revert 132517 - Metro/HiDPI: Move 1x icons into separate pak file
Currently all 1x art files are repacked into chrome.pak files.
This is a problem on Windows where we want to choose which pak file to load based on metro and DPI scale.
As a first step this CL does the following:
- add a new enable_hidpi build flag. This allows us to test HiDPI mode on Windows Chrome.
- stop packing theme_resources_standard.pak and ui_resources_standard.pak into chrome.pak
- update the Mac and Windows installer code to package the extra pak files.
Note, I'll be updating the Linux installer script in a separate CL. I'm still looking into the ChromeOS situation.
BUG=114311
TEST=Ran on Windows, and Mac and Linux.
Review URL: http://codereview.chromium.org/10024050
TBR=sail@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10103022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132529 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | build/common.gypi | 14 | ||||
-rw-r--r-- | chrome/chrome_dll.gypi | 18 | ||||
-rw-r--r-- | chrome/chrome_repack_chrome.gypi | 2 | ||||
-rw-r--r-- | chrome/chrome_repack_theme_resources_2x.gypi | 21 | ||||
-rw-r--r-- | chrome/chrome_resources.gyp | 33 | ||||
-rw-r--r-- | chrome/installer/mini_installer/chrome.release | 6 | ||||
-rw-r--r-- | chrome/tools/build/chromeos/FILES.cfg | 10 | ||||
-rw-r--r-- | chrome/tools/build/linux/FILES.cfg | 10 | ||||
-rw-r--r-- | chrome/tools/build/win/FILES.cfg | 20 | ||||
-rwxr-xr-x | chrome/tools/build/win/create_installer_archive.py | 15 | ||||
-rw-r--r-- | chrome/tools/build/win/release.rules | 2 | ||||
-rw-r--r-- | ui/base/resource/resource_bundle_android.cc | 19 | ||||
-rw-r--r-- | ui/base/resource/resource_bundle_linux.cc | 17 | ||||
-rw-r--r-- | ui/base/resource/resource_bundle_mac.mm | 12 | ||||
-rw-r--r-- | ui/base/resource/resource_bundle_win.cc | 24 | ||||
-rw-r--r-- | ui/base/ui_base_paths.cc | 12 | ||||
-rw-r--r-- | ui/base/ui_base_paths.h | 5 | ||||
-rw-r--r-- | ui/test/test_suite.cc | 7 |
18 files changed, 62 insertions, 185 deletions
diff --git a/build/common.gypi b/build/common.gypi index 7b591ff..7001af3 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -40,9 +40,6 @@ # Disable viewport meta tag by default. 'enable_viewport%': 0, - - # Enable HiDPI support. - 'enable_hidpi%': 0, }, # Copy conditionally-set variables out one scope. 'chromeos%': '<(chromeos)', @@ -52,7 +49,6 @@ 'use_openssl%': '<(use_openssl)', 'use_virtual_keyboard%': '<(use_virtual_keyboard)', 'enable_viewport%': '<(enable_viewport)', - 'enable_hidpi%': '<(enable_hidpi)', # Compute the architecture that we're building on. 'conditions': [ @@ -86,11 +82,6 @@ }, { 'toolkit_views%': 0, }], - - # Enable HiDPI on Mac OS. - ['OS=="mac"', { - 'enable_hidpi%': 1, - }], ], }, @@ -104,7 +95,6 @@ 'use_openssl%': '<(use_openssl)', 'use_virtual_keyboard%': '<(use_virtual_keyboard)', 'enable_viewport%': '<(enable_viewport)', - 'enable_hidpi%': '<(enable_hidpi)', # We used to provide a variable for changing how libraries were built. # This variable remains until we can clean up all the users. @@ -500,7 +490,6 @@ 'chromeos%': '<(chromeos)', 'use_virtual_keyboard%': '<(use_virtual_keyboard)', 'enable_viewport%': '<(enable_viewport)', - 'enable_hidpi%': '<(enable_hidpi)', 'use_xi2_mt%':'<(use_xi2_mt)', 'file_manager_extension%': '<(file_manager_extension)', 'webui_task_manager%': '<(webui_task_manager)', @@ -1296,9 +1285,6 @@ ['notifications==1', { 'defines': ['ENABLE_NOTIFICATIONS'], }], - ['enable_hidpi==1', { - 'defines': ['ENABLE_HIDPI=1'], - }], ['fastbuild!=0', { 'conditions': [ diff --git a/chrome/chrome_dll.gypi b/chrome/chrome_dll.gypi index c926dc4..2744184 100644 --- a/chrome/chrome_dll.gypi +++ b/chrome/chrome_dll.gypi @@ -100,6 +100,7 @@ '<(SHARED_INTERMEDIATE_DIR)/chrome/extensions_api_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/renderer_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/theme_resources.rc', + '<(SHARED_INTERMEDIATE_DIR)/chrome/theme_resources_standard.rc', '<(SHARED_INTERMEDIATE_DIR)/content/content_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gfx_resources.rc', @@ -303,10 +304,8 @@ 'app/theme/star.pdf', 'app/theme/star_lit.pdf', 'browser/mac/install.sh', - '<(SHARED_INTERMEDIATE_DIR)/repack/chrome.pak', - '<(SHARED_INTERMEDIATE_DIR)/repack/resources.pak', - '<(grit_out_dir)/theme_resources_standard.pak', - '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources_standard/ui_resources_standard.pak', + '<(SHARED_INTERMEDIATE_DIR)/repack/chrome.pak', + '<(SHARED_INTERMEDIATE_DIR)/repack/resources.pak', '<!@pymod_do_main(repack_locales -o -g <(grit_out_dir) -s <(SHARED_INTERMEDIATE_DIR) -x <(SHARED_INTERMEDIATE_DIR) <(locales))', # Note: pseudo_locales are generated via the packed_resources # dependency but not copied to the final target. See @@ -355,6 +354,11 @@ ], 'repack_path': '../tools/grit/grit/format/repack.py', }, + 'actions': [ + { + 'includes': ['chrome_repack_theme_resources_2x.gypi'] + }, + ], 'postbuilds': [ { # This step causes an error to be raised if the .order file @@ -533,12 +537,6 @@ '../pdf/pdf.gyp:pdf', ], }], - ['enable_hidpi==1', { - 'mac_bundle_resources': [ - '<(grit_out_dir)/theme_resources_2x.pak', - '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources_2x/ui_resources_2x.pak', - ], - }], ], # conditions }], # OS=="mac" ], # conditions diff --git a/chrome/chrome_repack_chrome.gypi b/chrome/chrome_repack_chrome.gypi index 342a60e..2911000 100644 --- a/chrome/chrome_repack_chrome.gypi +++ b/chrome/chrome_repack_chrome.gypi @@ -9,9 +9,11 @@ '<(grit_out_dir)/common_resources.pak', '<(grit_out_dir)/renderer_resources.pak', '<(grit_out_dir)/theme_resources.pak', + '<(grit_out_dir)/theme_resources_standard.pak', '<(SHARED_INTERMEDIATE_DIR)/content/content_resources.pak', '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak', '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/ui_resources.pak', + '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources_standard/ui_resources_standard.pak', '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.pak', '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.pak', ], diff --git a/chrome/chrome_repack_theme_resources_2x.gypi b/chrome/chrome_repack_theme_resources_2x.gypi new file mode 100644 index 0000000..9453118 --- /dev/null +++ b/chrome/chrome_repack_theme_resources_2x.gypi @@ -0,0 +1,21 @@ +# 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. +{ + 'action_name': 'repack_theme_resources_2x', + 'variables': { + 'pak_inputs': [ + '<(grit_out_dir)/theme_resources_2x.pak', + ], + }, + 'inputs': [ + '<(repack_path)', + '<@(pak_inputs)', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/repack/theme_resources_2x.pak', + ], + 'action': ['python', '<(repack_path)', '<@(_outputs)', + '<@(pak_inputs)'], + 'process_outputs_as_mac_bundle_resources': 1, +} diff --git a/chrome/chrome_resources.gyp b/chrome/chrome_resources.gyp index d821e5e..9834578 100644 --- a/chrome/chrome_resources.gyp +++ b/chrome/chrome_resources.gyp @@ -219,39 +219,6 @@ }, ], 'includes': [ '../build/grit_target.gypi' ], - 'conditions': [ - ['OS != "mac"', { - # Copy pak files to the product directory. These files will be picked - # up by the following installer scripts: - # - Windows: chrome/installer/mini_installer/chrome.release - # - Linux: chrome/installer/linux/internal/common/installer.include - # Ensure that the above scripts are updated when adding or removing - # pak files. - # Coping files to the product directory is not needed on the Mac - # since the framework build phase will copy them into the framework - # bundle directly. - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)', - 'files': [ - '<(grit_out_dir)/theme_resources_standard.pak', - '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources_standard/ui_resources_standard.pak', - ], - }, - ], - }], - ['OS != "mac" and enable_hidpi == 1', { - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)', - 'files': [ - '<(grit_out_dir)/theme_resources_2x.pak', - '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources_2x/ui_resources_2x.pak', - ], - }, - ], - }], - ], }, { 'target_name': 'packed_extra_resources', diff --git a/chrome/installer/mini_installer/chrome.release b/chrome/installer/mini_installer/chrome.release index b3bd017..a8265a4 100644 --- a/chrome/installer/mini_installer/chrome.release +++ b/chrome/installer/mini_installer/chrome.release @@ -13,8 +13,6 @@ nacl_irt_x86_32.nexe: %(VersionDir)s\ nacl_irt_x86_64.nexe: %(VersionDir)s\ icudt.dll: %(VersionDir)s\ resources.pak: %(VersionDir)s\ -theme_resources_standard.pak: %(VersionDir)s\ -ui_resources_standard.pak: %(VersionDir)s\ locales\*.pak: %(VersionDir)s\Locales locales\*.dll: %(VersionDir)s\Locales npchrome_frame.dll: %(VersionDir)s\ @@ -32,10 +30,6 @@ xinput1_3.dll: %(VersionDir)s\ default_apps\*.crx: %(VersionDir)s\default_apps\ default_apps\external_extensions.json: %(VersionDir)s\default_apps\ -[HIDPI] -theme_resources_2x.pak: %(VersionDir)s\ -ui_resources_2x.pak: %(VersionDir)s\ - [GOOGLE_CHROME] gcswf32.dll: %(VersionDir)s\ plugin.vch: %(VersionDir)s\ diff --git a/chrome/tools/build/chromeos/FILES.cfg b/chrome/tools/build/chromeos/FILES.cfg index 958f6b2..cdf2700 100644 --- a/chrome/tools/build/chromeos/FILES.cfg +++ b/chrome/tools/build/chromeos/FILES.cfg @@ -85,16 +85,6 @@ FILES = [ 'buildtype': ['dev', 'official'], }, { - 'filename': 'theme_resources_standard.pak', - 'arch': ['32bit', '64bit'], - 'buildtype': ['dev', 'official'], - }, - { - 'filename': 'ui_resources_standard.pak', - 'arch': ['32bit', '64bit'], - 'buildtype': ['dev', 'official'], - }, - { 'filename': 'session', 'arch': ['32bit', '64bit'], 'buildtype': ['dev'], diff --git a/chrome/tools/build/linux/FILES.cfg b/chrome/tools/build/linux/FILES.cfg index 5953a0a..88520a8 100644 --- a/chrome/tools/build/linux/FILES.cfg +++ b/chrome/tools/build/linux/FILES.cfg @@ -87,16 +87,6 @@ FILES = [ 'buildtype': ['dev', 'official'], }, { - 'filename': 'theme_resources_standard.pak', - 'arch': ['32bit', '64bit'], - 'buildtype': ['dev', 'official'], - }, - { - 'filename': 'ui_resources_standard.pak', - 'arch': ['32bit', '64bit'], - 'buildtype': ['dev', 'official'], - }, - { 'filename': 'session', 'arch': ['32bit', '64bit'], 'buildtype': ['dev'], diff --git a/chrome/tools/build/win/FILES.cfg b/chrome/tools/build/win/FILES.cfg index 60fe243..2c21743 100644 --- a/chrome/tools/build/win/FILES.cfg +++ b/chrome/tools/build/win/FILES.cfg @@ -347,26 +347,6 @@ FILES = [ 'buildtype': ['dev', 'official'], }, { - 'filename': 'theme_resources_standard.pak', - 'arch': ['32bit', '64bit'], - 'buildtype': ['dev', 'official'], - }, - { - 'filename': 'theme_resources_2x.pak', - 'arch': ['32bit', '64bit'], - 'buildtype': ['dev', 'official'], - }, - { - 'filename': 'ui_resources_standard.pak', - 'arch': ['32bit', '64bit'], - 'buildtype': ['dev', 'official'], - }, - { - 'filename': 'ui_resources_2x.pak', - 'arch': ['32bit', '64bit'], - 'buildtype': ['dev', 'official'], - }, - { 'filename': 'wow_helper.exe', 'arch': ['32bit', '64bit'], 'buildtype': ['dev', 'official'], diff --git a/chrome/tools/build/win/create_installer_archive.py b/chrome/tools/build/win/create_installer_archive.py index 25b2972..a7adbba 100755 --- a/chrome/tools/build/win/create_installer_archive.py +++ b/chrome/tools/build/win/create_installer_archive.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Copyright (c) 2011 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. @@ -89,8 +89,7 @@ def CompressUsingLZMA(build_dir, compressed_file, input_file): RunSystemCommand(cmd) -def CopyAllFilesToStagingDir(config, distribution, staging_dir, build_dir, - enable_hidpi): +def CopyAllFilesToStagingDir(config, distribution, staging_dir, build_dir): """Copies the files required for installer archive. Copies all common files required for various distributions of Chromium and also files for the specific Chromium build specified by distribution. @@ -101,8 +100,6 @@ def CopyAllFilesToStagingDir(config, distribution, staging_dir, build_dir, distribution = distribution[1:] CopySectionFilesToStagingDir(config, distribution.upper(), staging_dir, build_dir) - if enable_hidpi == '1': - CopySectionFilesToStagingDir(config, 'HIDPI', staging_dir, build_dir) def CopySectionFilesToStagingDir(config, section, staging_dir, build_dir): @@ -327,13 +324,11 @@ def main(options): # building the optimized mini_installer. if options.build_dir != options.output_dir: CopyAllFilesToStagingDir(config, options.distribution, - staging_dir, options.output_dir, - options.enable_hidpi) + staging_dir, options.output_dir) # Now copy the remainder of the files from the build dir. CopyAllFilesToStagingDir(config, options.distribution, - staging_dir, options.build_dir, - options.enable_hidpi) + staging_dir, options.build_dir) version_numbers = current_version.split('.') current_build_number = version_numbers[2] + '.' + version_numbers[3] @@ -385,8 +380,6 @@ def _ParseOptions(): '{BSDIFF|COURGETTE}.') parser.add_option('-n', '--output_name', default='chrome', help='Name used to prefix names of generated archives.') - parser.add_option('--enable_hidpi', default='0', - help='Whether to include HiDPI resource files.') options, args = parser.parse_args() if not options.build_dir: diff --git a/chrome/tools/build/win/release.rules b/chrome/tools/build/win/release.rules index cd3212b..21cdf14 100644 --- a/chrome/tools/build/win/release.rules +++ b/chrome/tools/build/win/release.rules @@ -7,7 +7,7 @@ <CustomBuildRule Name="Create Installer Archive" DisplayName="Create Installer Archive" - CommandLine="$(SolutionDir)..\third_party\python_24\python.exe $(SolutionDir)tools\build\win\create_installer_archive.py --output_dir="$(OutDir)" --input_file="$(InputPath)" --distribution=$(CHROMIUM_BUILD) --enable_hidpi=$(ENABLE_HIDPI) [LastChromeInstaller] [SkipRebuildArchive] [SetupExeFormat] [DiffAlgorithm]" + CommandLine="$(SolutionDir)..\third_party\python_24\python.exe $(SolutionDir)tools\build\win\create_installer_archive.py --output_dir="$(OutDir)" --input_file="$(InputPath)" --distribution=$(CHROMIUM_BUILD) [LastChromeInstaller] [SkipRebuildArchive] [SetupExeFormat] [DiffAlgorithm]" Outputs="$(OutDir)/$(InputName).7z;$(OutDir)/$(InputName).packed.7z;$(OutDir)/setup.ex_;$(OutDir)/packed_files.txt;" AdditionalDependencies="$(SolutionDir)\tools\build\win\create_installer_archive.py;$(OutDir)\chrome.exe;$(OutDir)\crash_reporter.exe;$(OutDir)\chrome.dll;$(OutDir)\locales\en-US.dll;$(OutDir)\icudt38.dll" FileExtensions="*.release" diff --git a/ui/base/resource/resource_bundle_android.cc b/ui/base/resource/resource_bundle_android.cc index 62a53c6..2959d5b 100644 --- a/ui/base/resource/resource_bundle_android.cc +++ b/ui/base/resource/resource_bundle_android.cc @@ -12,23 +12,14 @@ #include "base/path_service.h" #include "base/stringprintf.h" -namespace { - -FilePath GetResourcesPakFilePath(const std::string& pak_name) { - FilePath path; - PathService::Get(base::DIR_ANDROID_APP_DATA, &path); - DCHECK(!path.empty()); - return path.AppendASCII("paks").AppendASCII(pak_name.c_str()); -} - -} // namespace - namespace ui { void ResourceBundle::LoadCommonResources() { - AddDataPack(GetResourcesPakFilePath("chrome.pak")); - AddDataPack(GetResourcesPakFilePath("theme_resources_standard.pak")); - AddDataPack(GetResourcesPakFilePath("ui_resources_standard.pak")); + FilePath data_path; + PathService::Get(base::DIR_ANDROID_APP_DATA, &data_path); + DCHECK(!data_path.empty()); + data_path = data_path.AppendASCII("paks").AppendASCII("chrome.pak"); + AddDataPack(data_path); } gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { diff --git a/ui/base/resource/resource_bundle_linux.cc b/ui/base/resource/resource_bundle_linux.cc index 5c8d598..ec6678d 100644 --- a/ui/base/resource/resource_bundle_linux.cc +++ b/ui/base/resource/resource_bundle_linux.cc @@ -7,23 +7,12 @@ #include "base/path_service.h" #include "ui/base/ui_base_paths.h" -namespace { - -FilePath GetResourcesPakFilePath(const std::string& pak_name) { - FilePath path; - if (PathService::Get(base::DIR_MODULE, &path)) - return path.AppendASCII(pak_name.c_str()); - return FilePath(); -} - -} // namespace - namespace ui { void ResourceBundle::LoadCommonResources() { - AddDataPack(GetResourcesPakFilePath("chrome.pak")); - AddDataPack(GetResourcesPakFilePath("theme_resources_standard.pak")); - AddDataPack(GetResourcesPakFilePath("ui_resources_standard.pak")); + FilePath path; + PathService::Get(ui::FILE_RESOURCES_PAK, &path); + AddDataPack(path); } } // namespace ui diff --git a/ui/base/resource/resource_bundle_mac.mm b/ui/base/resource/resource_bundle_mac.mm index 6e4002d..5ace3de 100644 --- a/ui/base/resource/resource_bundle_mac.mm +++ b/ui/base/resource/resource_bundle_mac.mm @@ -44,18 +44,8 @@ FilePath GetResourcesPakFilePath(NSString* name, NSString* mac_locale) { void ResourceBundle::LoadCommonResources() { AddDataPack(GetResourcesPakFilePath(@"chrome", nil)); - AddDataPack(GetResourcesPakFilePath(@"theme_resources_standard", nil)); - AddDataPack(GetResourcesPakFilePath(@"ui_resources_standard", nil)); - - // On Windows and ChromeOS we load either the 1x resource or the 2x resource. - // On Mac we load both and let the UI framework decide which one to use. -#if defined(ENABLE_HIDPI) - if (base::mac::IsOSLionOrLater()) { + if (base::mac::IsOSLionOrLater()) AddDataPack(GetResourcesPakFilePath(@"theme_resources_2x", nil)); - AddDataPack(GetResourcesPakFilePath(@"theme_resources_standard_2x", nil)); - AddDataPack(GetResourcesPakFilePath(@"ui_resources_standard_2x", nil)); - } -#endif } // static diff --git a/ui/base/resource/resource_bundle_win.cc b/ui/base/resource/resource_bundle_win.cc index 79355d6..b295b50 100644 --- a/ui/base/resource/resource_bundle_win.cc +++ b/ui/base/resource/resource_bundle_win.cc @@ -5,10 +5,8 @@ #include "ui/base/resource/resource_bundle_win.h" #include "base/logging.h" -#include "base/path_service.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_data_dll_win.h" -#include "ui/base/win/dpi.h" namespace ui { @@ -22,33 +20,11 @@ HINSTANCE GetCurrentResourceDLL() { return GetModuleHandle(NULL); } -FilePath GetResourcesPakFilePath(const std::string& pak_name) { - FilePath path; - if (PathService::Get(base::DIR_MODULE, &path)) - return path.AppendASCII(pak_name.c_str()); - return FilePath(); -} - } // end anonymous namespace void ResourceBundle::LoadCommonResources() { // As a convenience, add the current resource module as a data packs. data_packs_.push_back(new ResourceDataDLL(GetCurrentResourceDLL())); - - bool use_hidpi_pak = false; -#if defined(ENABLE_HIDPI) - // If we're running in HiDPI mode then use the 2x resource for DPI greater - // than 1.5. Otherwise use the 1x resource. - use_hidpi_pak = ui::GetDPIScale() > 1.5; -#endif - - if (!use_hidpi_pak) { - AddDataPack(GetResourcesPakFilePath("theme_resources_standard.pak")); - AddDataPack(GetResourcesPakFilePath("ui_resources_standard.pak")); - } else { - AddDataPack(GetResourcesPakFilePath("theme_resources_2x.pak")); - AddDataPack(GetResourcesPakFilePath("ui_resources_2x.pak")); - } } void ResourceBundle::LoadTestResources(const FilePath& path) { diff --git a/ui/base/ui_base_paths.cc b/ui/base/ui_base_paths.cc index b216c7e..14897f0 100644 --- a/ui/base/ui_base_paths.cc +++ b/ui/base/ui_base_paths.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -32,6 +32,16 @@ bool PathProvider(int key, FilePath* result) { #endif create_dir = true; break; + case ui::FILE_RESOURCES_PAK: +#if defined(OS_POSIX) && !defined(OS_MACOSX) + if (!PathService::Get(base::DIR_EXE, &cur)) + return false; + // TODO(tony): We shouldn't be referencing chrome here. + cur = cur.AppendASCII("chrome.pak"); +#else + NOTREACHED(); +#endif + break; // The following are only valid in the development environment, and // will fail if executed from an installed executable (because the // generated path won't exist). diff --git a/ui/base/ui_base_paths.h b/ui/base/ui_base_paths.h index 6d58d49..2884ae9 100644 --- a/ui/base/ui_base_paths.h +++ b/ui/base/ui_base_paths.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -18,6 +18,9 @@ enum { DIR_LOCALES, // Directory where locale resources are stored. + FILE_RESOURCES_PAK, // Path to the data .pak file which holds binary + // resources. + // Valid only in development environment; TODO(darin): move these DIR_TEST_DATA, // Directory where unit test data resides. diff --git a/ui/test/test_suite.cc b/ui/test/test_suite.cc index 024543e..bd4e325 100644 --- a/ui/test/test_suite.cc +++ b/ui/test/test_suite.cc @@ -46,16 +46,13 @@ void UITestSuite::Initialize() { PathService::Get(base::DIR_MODULE, &pak_dir); pak_dir = pak_dir.AppendASCII("ui_unittests_strings"); PathService::Override(ui::DIR_LOCALES, pak_dir); + PathService::Override(ui::FILE_RESOURCES_PAK, + pak_dir.AppendASCII("ui_resources.pak")); #endif // defined(OS_MACOSX) // Force unittests to run using en-US so if we test against string // output, it'll pass regardless of the system language. ui::ResourceBundle::InitSharedInstanceWithLocale("en-US"); - -#if !defined(OS_MACOSX) && defined(OS_POSIX) - ui::ResourceBundle::GetSharedInstance().AddDataPack( - pak_dir.AppendASCII("ui_resources.pak")); -#endif } void UITestSuite::Shutdown() { |