diff options
author | ofri@google.com <ofri@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-18 13:38:04 +0000 |
---|---|---|
committer | ofri@google.com <ofri@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-18 13:38:04 +0000 |
commit | 4cea8f8d61c9c3eeb58d49ff2ac3833c26172b6d (patch) | |
tree | 74ba0c3801227f12b47b5a288c70a323ae880048 /ui/base/resource | |
parent | c907cc61ae94982368a2394ea2e3f328a8d76e70 (diff) | |
download | chromium_src-4cea8f8d61c9c3eeb58d49ff2ac3833c26172b6d.zip chromium_src-4cea8f8d61c9c3eeb58d49ff2ac3833c26172b6d.tar.gz chromium_src-4cea8f8d61c9c3eeb58d49ff2ac3833c26172b6d.tar.bz2 |
Adding BidiChecker tests which run in fake bidi
BUG=NONE
TEST=NONE
Review URL: http://codereview.chromium.org/7488045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97304 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/resource')
-rw-r--r-- | ui/base/resource/resource_bundle.cc | 15 | ||||
-rw-r--r-- | ui/base/resource/resource_bundle.h | 7 | ||||
-rw-r--r-- | ui/base/resource/resource_bundle_posix.cc | 10 |
3 files changed, 24 insertions, 8 deletions
diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc index 8322566..c47b7b9 100644 --- a/ui/base/resource/resource_bundle.cc +++ b/ui/base/resource/resource_bundle.cc @@ -4,6 +4,7 @@ #include "ui/base/resource/resource_bundle.h" +#include "base/command_line.h" #include "base/logging.h" #include "base/stl_util.h" #include "base/string_piece.h" @@ -11,6 +12,7 @@ #include "build/build_config.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/resource/data_pack.h" +#include "ui/base/ui_base_switches.h" #include "ui/gfx/codec/png_codec.h" #include "ui/gfx/font.h" #include "ui/gfx/image/image.h" @@ -102,6 +104,14 @@ ResourceBundle& ResourceBundle::GetSharedInstance() { return *g_shared_instance_; } +void ResourceBundle::OverrideLocalePak(FilePath pak_path) { + overridden_pak_path_ = pak_path; +} + +FilePath& ResourceBundle::GetOverriddenPakPath() { + return overridden_pak_path_; +} + SkBitmap* ResourceBundle::GetBitmapNamed(int resource_id) { const SkBitmap* bitmap = static_cast<const SkBitmap*>(GetImageNamed(resource_id)); @@ -196,6 +206,11 @@ ResourceBundle::ResourceBundle() resources_data_(NULL), large_icon_resources_data_(NULL), locale_resources_data_(NULL) { + CommandLine *command_line = CommandLine::ForCurrentProcess(); + if (command_line->HasSwitch(switches::kLocalePak)) { + OverrideLocalePak( + command_line->GetSwitchValuePath(switches::kLocalePak)); + } } void ResourceBundle::FreeImages() { diff --git a/ui/base/resource/resource_bundle.h b/ui/base/resource/resource_bundle.h index 37d3ef1..f10af62 100644 --- a/ui/base/resource/resource_bundle.h +++ b/ui/base/resource/resource_bundle.h @@ -142,6 +142,11 @@ class UI_EXPORT ResourceBundle { // system have changed, for example, when the locale has changed. void ReloadFonts(); + // Overrides the path to the pak file from which the locale resources will be + // loaded. Pass an empty path to undo. + void OverrideLocalePak(FilePath pak_path); + FilePath& GetOverriddenPakPath(); + #if defined(OS_WIN) // NOTE: This needs to be called before initializing the shared instance if // your resources are not stored in the executable. @@ -293,6 +298,8 @@ class UI_EXPORT ResourceBundle { static ResourceBundle* g_shared_instance_; + FilePath overridden_pak_path_; + DISALLOW_COPY_AND_ASSIGN(ResourceBundle); }; diff --git a/ui/base/resource/resource_bundle_posix.cc b/ui/base/resource/resource_bundle_posix.cc index d23a5b1..df6ff93 100644 --- a/ui/base/resource/resource_bundle_posix.cc +++ b/ui/base/resource/resource_bundle_posix.cc @@ -4,7 +4,6 @@ #include "ui/base/resource/resource_bundle.h" -#include "base/command_line.h" #include "base/file_path.h" #include "base/logging.h" #include "base/stl_util.h" @@ -13,7 +12,6 @@ #include "base/synchronization/lock.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/data_pack.h" -#include "ui/base/ui_base_switches.h" #include "ui/gfx/font.h" namespace ui { @@ -115,12 +113,8 @@ std::string ResourceBundle::LoadLocaleResources( const std::string& pref_locale) { DCHECK(!locale_resources_data_) << "locale.pak already loaded"; std::string app_locale = l10n_util::GetApplicationLocale(pref_locale); - FilePath locale_file_path; - CommandLine *command_line = CommandLine::ForCurrentProcess(); - if (command_line->HasSwitch(switches::kLocalePak)) { - locale_file_path = - command_line->GetSwitchValuePath(switches::kLocalePak); - } else { + FilePath locale_file_path = GetOverriddenPakPath(); + if (locale_file_path.empty()) { locale_file_path = GetLocaleFilePath(app_locale); } if (locale_file_path.empty()) { |