diff options
author | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-12 23:41:53 +0000 |
---|---|---|
committer | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-12 23:41:53 +0000 |
commit | ec015c8457dd6978ad0d86fd04738aa4a12867a4 (patch) | |
tree | ddd3873f745e968db94c1cc7b3dae16ab27545e6 /chrome_frame/simple_resource_loader.cc | |
parent | 7ad2d26cf0d1eb496f3372ad02ae21b93778fe78 (diff) | |
download | chromium_src-ec015c8457dd6978ad0d86fd04738aa4a12867a4.zip chromium_src-ec015c8457dd6978ad0d86fd04738aa4a12867a4.tar.gz chromium_src-ec015c8457dd6978ad0d86fd04738aa4a12867a4.tar.bz2 |
Metro/HiDPI: Cleanup ResourceBundle
For Metro and HiDPI support we need to conditionally load resource pak files. For example, on Windows I'd like to have something like this:
..ResourceBundle::LoadCommonResources() {
....if (IsMetroMode()) {
......switch (DPIScale()) {
........case 1.0: AddDataPack("theme_resources_metro_1_0x.pak"); break;
........case 1.4: AddDataPack("theme_resources_metro_1_4x.pak"); break;
........case 1.8: AddDataPack("theme_resources_metro_1_8x.pak"); break;
......}
....} else {
......if (DPIScale() < 1.5)
........AddDataPack("theme_resources_desktop_1_0x.pak");
......else
........AddDataPack("theme_resources_desktop_2_0x.pak");
....}
..}
As a first step this CL does the following:
- create a new ResourceHandle abstract class that can be backed by a DLL on Windows.
- manage all resource packs through the data_packs_ vector
- clean up ResourceBundle interface by removing all the #ifdefs
BUG=114311
TEST=Built and ran on Mac, Linux, Windows, Linux Arua.
Review URL: http://codereview.chromium.org/10051012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132091 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/simple_resource_loader.cc')
-rw-r--r-- | chrome_frame/simple_resource_loader.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/chrome_frame/simple_resource_loader.cc b/chrome_frame/simple_resource_loader.cc index a28a62c..36c5e01 100644 --- a/chrome_frame/simple_resource_loader.cc +++ b/chrome_frame/simple_resource_loader.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. @@ -20,7 +20,6 @@ #include "base/win/windows_version.h" #include "chrome_frame/policy_settings.h" #include "ui/base/resource/data_pack.h" -#include "ui/base/resource/resource_bundle.h" namespace { @@ -206,15 +205,16 @@ bool SimpleResourceLoader::LoadLocalePack( if (file_util::PathExists(resource_pack_path) && file_util::PathExists(dll_path)) { - *data_pack = ui::ResourceBundle::LoadResourcesDataPak(resource_pack_path); - if (!*data_pack) { + scoped_ptr<ui::DataPack> cur_data_pack(new ui::DataPack()); + if (!cur_data_pack->Load(resource_pack_path)) continue; - } + HMODULE locale_dll_handle = LoadLibraryEx(dll_path.value().c_str(), NULL, load_flags); if (locale_dll_handle) { *dll_handle = locale_dll_handle; *language = dll_path.BaseName().RemoveExtension().value(); + *data_pack = cur_data_pack.release(); found_pack = true; break; } else { |