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 /ui/base | |
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
Diffstat (limited to 'ui/base')
-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 |
6 files changed, 24 insertions, 65 deletions
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. |