diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-28 02:30:04 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-28 02:30:04 +0000 |
commit | 70f9df11715b7903b1fe3ecf8b3e4a0909bd80cf (patch) | |
tree | 4078be6ec7d9c222978fd27fd6db348dfcc3cb60 | |
parent | e643e57c80fa41616d4ed5d9b13381538dec0573 (diff) | |
download | chromium_src-70f9df11715b7903b1fe3ecf8b3e4a0909bd80cf.zip chromium_src-70f9df11715b7903b1fe3ecf8b3e4a0909bd80cf.tar.gz chromium_src-70f9df11715b7903b1fe3ecf8b3e4a0909bd80cf.tar.bz2 |
content: Modfiy ResourceBundle and content_shell to run with alternative pak files.
BUG=111326
R=jam
TBR=sky,tony,ajwong,ananta
Review URL: http://codereview.chromium.org/9232060
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119566 0039d316-1c4b-4281-b951-d872f2087c98
23 files changed, 31 insertions, 34 deletions
diff --git a/ash/shell/shell_main_parts.cc b/ash/shell/shell_main_parts.cc index e7b3a0a..9497e8c 100644 --- a/ash/shell/shell_main_parts.cc +++ b/ash/shell/shell_main_parts.cc @@ -14,7 +14,7 @@ namespace shell { void PreMainMessageLoopStart() { ui::RegisterPathProvider(); icu_util::Initialize(); - ResourceBundle::InitSharedInstance("en-US"); + ResourceBundle::InitSharedInstanceWithLocale("en-US"); } } // namespace ash diff --git a/ash/shell/shell_main_parts_mac.mm b/ash/shell/shell_main_parts_mac.mm index fc4e651..aa3f51f 100644 --- a/ash/shell/shell_main_parts_mac.mm +++ b/ash/shell/shell_main_parts_mac.mm @@ -18,7 +18,7 @@ namespace shell { void PreMainMessageLoopStart() { ui::RegisterPathProvider(); icu_util::Initialize(); - ResourceBundle::InitSharedInstance("en-US"); + ResourceBundle::InitSharedInstanceWithLocale("en-US"); scoped_nsobject<NSNib> nib([[NSNib alloc] initWithNibNamed:@"MainMenu" diff --git a/ash/test/test_suite.cc b/ash/test/test_suite.cc index 9bb0835..a8a8c87 100644 --- a/ash/test/test_suite.cc +++ b/ash/test/test_suite.cc @@ -28,7 +28,7 @@ void AuraShellTestSuite::Initialize() { // Force unittests to run using en-US so if we test against string // output, it'll pass regardless of the system language. - ui::ResourceBundle::InitSharedInstance("en-US"); + ui::ResourceBundle::InitSharedInstanceWithLocale("en-US"); ui::CompositorTestSupport::Initialize(); ui::SetupTestCompositor(); } diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc index abeb5fd..ceabdb8 100644 --- a/chrome/app/chrome_main_delegate.cc +++ b/chrome/app/chrome_main_delegate.cc @@ -639,7 +639,7 @@ void ChromeMainDelegate::PreSandboxStartup() { const std::string locale = command_line.GetSwitchValueASCII(switches::kLang); const std::string loaded_locale = - ResourceBundle::InitSharedInstance(locale); + ResourceBundle::InitSharedInstanceWithLocale(locale); CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale; diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index b6559ef..28a69ce 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -1184,7 +1184,7 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() { // On a POSIX OS other than ChromeOS, the parameter that is passed to the // method InitSharedInstance is ignored. const std::string loaded_locale = - ResourceBundle::InitSharedInstance(locale); + ResourceBundle::InitSharedInstanceWithLocale(locale); if (loaded_locale.empty() && !parsed_command_line().HasSwitch(switches::kNoErrorDialogs)) { ShowMissingLocaleMessageBox(); diff --git a/chrome/browser/chrome_browser_main_extra_parts_gtk.cc b/chrome/browser/chrome_browser_main_extra_parts_gtk.cc index 406d3ec..f663ac6 100644 --- a/chrome/browser/chrome_browser_main_extra_parts_gtk.cc +++ b/chrome/browser/chrome_browser_main_extra_parts_gtk.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. @@ -34,7 +34,7 @@ void ChromeBrowserMainExtraPartsGtk::DetectRunningAsRoot() { // Get just enough of our resource machinery up so we can extract the // locale appropriate string. Note that the GTK implementation ignores the // passed in parameter and checks the LANG environment variables instead. - ResourceBundle::InitSharedInstance(""); + ResourceBundle::InitSharedInstanceWithLocale(""); std::string message = l10n_util::GetStringFUTF8( IDS_REFUSE_TO_RUN_AS_ROOT, diff --git a/chrome/browser/chrome_browser_main_mac.mm b/chrome/browser/chrome_browser_main_mac.mm index 6743e864..b1fa31f 100644 --- a/chrome/browser/chrome_browser_main_mac.mm +++ b/chrome/browser/chrome_browser_main_mac.mm @@ -86,7 +86,7 @@ void ChromeBrowserMainPartsMac::PreMainMessageLoopStart() { // TODO(markusheintz): Read preference pref::kApplicationLocale in order // to enforce the application locale. const std::string loaded_locale = - ResourceBundle::InitSharedInstance(std::string()); + ResourceBundle::InitSharedInstanceWithLocale(std::string()); CHECK(!loaded_locale.empty()) << "Default locale could not be found"; FilePath resources_pack_path; diff --git a/chrome/browser/diagnostics/diagnostics_main.cc b/chrome/browser/diagnostics/diagnostics_main.cc index ab4ddab..edc1c55 100644 --- a/chrome/browser/diagnostics/diagnostics_main.cc +++ b/chrome/browser/diagnostics/diagnostics_main.cc @@ -278,7 +278,7 @@ class TestController : public DiagnosticsModel::Observer { writer_->WriteResult(false, L"Diagnostics start", L"ICU failure"); return; } - ResourceBundle::InitSharedInstance(""); + ResourceBundle::InitSharedInstanceWithLocale(""); int count = model->GetTestAvailableCount(); writer_->WriteInfoText(base::StringPrintf( L"%d available test(s)\n\n", count)); diff --git a/chrome/service/service_process.cc b/chrome/service/service_process.cc index d66e0f0..c5efbe7 100644 --- a/chrome/service/service_process.cc +++ b/chrome/service/service_process.cc @@ -180,7 +180,7 @@ bool ServiceProcess::Initialize(MessageLoopForUI* message_loop, if (locale.empty()) locale = kDefaultServiceProcessLocale; } - ResourceBundle::InitSharedInstance(locale); + ResourceBundle::InitSharedInstanceWithLocale(locale); PrepareRestartOnCrashEnviroment(command_line); diff --git a/chrome/test/base/chrome_test_suite.cc b/chrome/test/base/chrome_test_suite.cc index f8e9553b..7adad99 100644 --- a/chrome/test/base/chrome_test_suite.cc +++ b/chrome/test/base/chrome_test_suite.cc @@ -187,7 +187,7 @@ void ChromeTestSuite::Initialize() { // Force unittests to run using en-US so if we test against string // output, it'll pass regardless of the system language. - ResourceBundle::InitSharedInstance("en-US"); + ResourceBundle::InitSharedInstanceWithLocale("en-US"); FilePath resources_pack_path; PathService::Get(base::DIR_MODULE, &resources_pack_path); resources_pack_path = diff --git a/chrome/tools/profiles/generate_profile.cc b/chrome/tools/profiles/generate_profile.cc index a19d2fc..a9165ac 100644 --- a/chrome/tools/profiles/generate_profile.cc +++ b/chrome/tools/profiles/generate_profile.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. @@ -234,7 +234,7 @@ int main(int argc, const char* argv[]) { chrome::RegisterPathProvider(); ui::RegisterPathProvider(); - ResourceBundle::InitSharedInstance("en-US"); + ResourceBundle::InitSharedInstanceWithLocale("en-US"); scoped_ptr<content::NotificationService> notification_service( content::NotificationService::Create()); MessageLoopForUI message_loop; diff --git a/chrome_frame/test/net/fake_external_tab.cc b/chrome_frame/test/net/fake_external_tab.cc index 57c738e..3ebc4a5f 100644 --- a/chrome_frame/test/net/fake_external_tab.cc +++ b/chrome_frame/test/net/fake_external_tab.cc @@ -442,7 +442,7 @@ void FakeExternalTab::Initialize() { DCHECK(res_mod); _AtlBaseModule.SetResourceInstance(res_mod); - ResourceBundle::InitSharedInstance("en-US"); + ResourceBundle::InitSharedInstanceWithLocale("en-US"); CommandLine* cmd = CommandLine::ForCurrentProcess(); cmd->AppendSwitch(switches::kDisableWebResources); diff --git a/content/shell/shell_main_delegate.cc b/content/shell/shell_main_delegate.cc index 69f1bc6..0544007 100644 --- a/content/shell/shell_main_delegate.cc +++ b/content/shell/shell_main_delegate.cc @@ -97,11 +97,7 @@ void ShellMainDelegate::InitializeShellContentClient( void ShellMainDelegate::InitializeResourceBundle() { FilePath pak_dir; PathService::Get(base::DIR_MODULE, &pak_dir); - PathService::Override(ui::FILE_RESOURCES_PAK, - pak_dir.Append( - FILE_PATH_LITERAL("content_shell.pak"))); - // Force the content shell to run using en-US because our ResourceBundle - // can't run without a language and it doesn't matter. - ui::ResourceBundle::InitSharedInstance("en-US"); + FilePath pak_file = pak_dir.Append(FILE_PATH_LITERAL("content_shell.pak")); + ui::ResourceBundle::InitSharedInstanceWithPakFile(pak_file); } diff --git a/ui/aura/demo/demo_main.cc b/ui/aura/demo/demo_main.cc index 35ee2df..4b0f0eb 100644 --- a/ui/aura/demo/demo_main.cc +++ b/ui/aura/demo/demo_main.cc @@ -82,7 +82,7 @@ int main(int argc, char** argv) { ui::RegisterPathProvider(); icu_util::Initialize(); - ResourceBundle::InitSharedInstance("en-US"); + ResourceBundle::InitSharedInstanceWithLocale("en-US"); // Create the message-loop here before creating the root window. MessageLoop message_loop(MessageLoop::TYPE_UI); diff --git a/ui/aura/test/test_suite.cc b/ui/aura/test/test_suite.cc index 3d6c1b2..a9c9cb9 100644 --- a/ui/aura/test/test_suite.cc +++ b/ui/aura/test/test_suite.cc @@ -28,7 +28,7 @@ void AuraTestSuite::Initialize() { // Force unittests to run using en-US so if we test against string // output, it'll pass regardless of the system language. - ui::ResourceBundle::InitSharedInstance("en-US"); + ui::ResourceBundle::InitSharedInstanceWithLocale("en-US"); ui::CompositorTestSupport::Initialize(); ui::SetupTestCompositor(); diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc index 596bbe1..c557dfb 100644 --- a/ui/base/resource/resource_bundle.cc +++ b/ui/base/resource/resource_bundle.cc @@ -49,7 +49,7 @@ const SkColor ResourceBundle::toolbar_separator_color = SkColorSetRGB(182, 186, 192); // static -std::string ResourceBundle::InitSharedInstance( +std::string ResourceBundle::InitSharedInstanceWithLocale( const std::string& pref_locale) { DCHECK(g_shared_instance_ == NULL) << "ResourceBundle initialized twice"; g_shared_instance_ = new ResourceBundle(); @@ -59,7 +59,7 @@ std::string ResourceBundle::InitSharedInstance( } // static -void ResourceBundle::InitSharedInstanceForTest(const FilePath& path) { +void ResourceBundle::InitSharedInstanceWithPakFile(const FilePath& path) { DCHECK(g_shared_instance_ == NULL) << "ResourceBundle initialized twice"; g_shared_instance_ = new ResourceBundle(); diff --git a/ui/base/resource/resource_bundle.h b/ui/base/resource/resource_bundle.h index fd201e9..cb966c8 100644 --- a/ui/base/resource/resource_bundle.h +++ b/ui/base/resource/resource_bundle.h @@ -80,10 +80,11 @@ class UI_EXPORT ResourceBundle { // selected. // NOTE: Mac ignores this and always loads up resources for the language // defined by the Cocoa UI (ie-NSBundle does the langange work). - static std::string InitSharedInstance(const std::string& pref_locale); + static std::string InitSharedInstanceWithLocale( + const std::string& pref_locale); // Initialize the ResourceBundle using given data pack path for testing. - static void InitSharedInstanceForTest(const FilePath& path); + static void InitSharedInstanceWithPakFile(const FilePath& path); // Load a .pak file. Returns NULL if we fail to load |path|. The caller // is responsible for deleting up this pointer. diff --git a/ui/gfx/test_suite.cc b/ui/gfx/test_suite.cc index 046f694..4a26607 100644 --- a/ui/gfx/test_suite.cc +++ b/ui/gfx/test_suite.cc @@ -49,7 +49,7 @@ void GfxTestSuite::Initialize() { // Force unittests to run using en-US so if we test against string // output, it'll pass regardless of the system language. - ui::ResourceBundle::InitSharedInstance("en-US"); + ui::ResourceBundle::InitSharedInstanceWithLocale("en-US"); } void GfxTestSuite::Shutdown() { diff --git a/ui/views/examples/examples_main.cc b/ui/views/examples/examples_main.cc index de3b598..0ff6fa9 100644 --- a/ui/views/examples/examples_main.cc +++ b/ui/views/examples/examples_main.cc @@ -42,7 +42,7 @@ int main(int argc, char** argv) { ui::RegisterPathProvider(); bool icu_result = icu_util::Initialize(); CHECK(icu_result); - ui::ResourceBundle::InitSharedInstance("en-US"); + ui::ResourceBundle::InitSharedInstanceWithLocale("en-US"); MessageLoop main_message_loop(MessageLoop::TYPE_UI); diff --git a/ui/views/run_all_unittests.cc b/ui/views/run_all_unittests.cc index 8458072..9cf79e2 100644 --- a/ui/views/run_all_unittests.cc +++ b/ui/views/run_all_unittests.cc @@ -18,7 +18,7 @@ class ViewTestSuite : public base::TestSuite { base::TestSuite::Initialize(); ui::RegisterPathProvider(); - ui::ResourceBundle::InitSharedInstance("en-US"); + ui::ResourceBundle::InitSharedInstanceWithLocale("en-US"); ui::CompositorTestSupport::Initialize(); ui::SetupTestCompositor(); diff --git a/webkit/support/platform_support_android.cc b/webkit/support/platform_support_android.cc index 17e9a2e..e18d260 100644 --- a/webkit/support/platform_support_android.cc +++ b/webkit/support/platform_support_android.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. @@ -29,7 +29,7 @@ void AfterInitialize(bool unit_test_mode) { FilePath data_path; PathService::Get(base::DIR_EXE, &data_path); data_path = data_path.Append("DumpRenderTree.pak"); - ResourceBundle::InitSharedInstanceForTest(data_path); + ResourceBundle::InitSharedInstanceWithPakFile(data_path); // We enable file-over-http to bridge the file protocol to http protocol // in here, which can diff --git a/webkit/support/platform_support_linux.cc b/webkit/support/platform_support_linux.cc index 1ff0490..55d8517 100644 --- a/webkit/support/platform_support_linux.cc +++ b/webkit/support/platform_support_linux.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. @@ -29,7 +29,7 @@ void AfterInitialize(bool unit_test_mode) { FilePath data_path; PathService::Get(base::DIR_EXE, &data_path); data_path = data_path.Append("DumpRenderTree.pak"); - ResourceBundle::InitSharedInstanceForTest(data_path); + ResourceBundle::InitSharedInstanceWithPakFile(data_path); } void BeforeShutdown() { diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc index d575da5..59f1409 100644 --- a/webkit/tools/test_shell/test_shell_gtk.cc +++ b/webkit/tools/test_shell/test_shell_gtk.cc @@ -161,7 +161,7 @@ void TestShell::InitializeTestShell(bool layout_test_mode, FilePath data_path; PathService::Get(base::DIR_EXE, &data_path); data_path = data_path.Append("test_shell.pak"); - ResourceBundle::InitSharedInstanceForTest(data_path); + ResourceBundle::InitSharedInstanceWithPakFile(data_path); FilePath resources_dir; PathService::Get(base::DIR_SOURCE_ROOT, &resources_dir); |