OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/app/chrome_main_delegate.h" | 5 #include "chrome/app/chrome_main_delegate.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 // The renderer sandbox prevents us from accessing our .pak files directly. | 601 // The renderer sandbox prevents us from accessing our .pak files directly. |
602 // Therefore file descriptors to the .pak files that we need are passed in | 602 // Therefore file descriptors to the .pak files that we need are passed in |
603 // at process creation time. | 603 // at process creation time. |
604 int locale_pak_fd = base::GlobalDescriptors::GetInstance()->MaybeGet( | 604 int locale_pak_fd = base::GlobalDescriptors::GetInstance()->MaybeGet( |
605 kAndroidLocalePakDescriptor); | 605 kAndroidLocalePakDescriptor); |
606 CHECK(locale_pak_fd != -1); | 606 CHECK(locale_pak_fd != -1); |
607 ResourceBundle::InitSharedInstanceWithPakFile(locale_pak_fd, false); | 607 ResourceBundle::InitSharedInstanceWithPakFile(locale_pak_fd, false); |
608 | 608 |
609 int extra_pak_keys[] = { | 609 int extra_pak_keys[] = { |
610 kAndroidChromePakDescriptor, | 610 kAndroidChromePakDescriptor, |
| 611 kAndroidChrome100PercentPakDescriptor, |
611 kAndroidUIResourcesPakDescriptor, | 612 kAndroidUIResourcesPakDescriptor, |
612 }; | 613 }; |
613 for (size_t i = 0; i < arraysize(extra_pak_keys); ++i) { | 614 for (size_t i = 0; i < arraysize(extra_pak_keys); ++i) { |
614 int pak_fd = | 615 int pak_fd = |
615 base::GlobalDescriptors::GetInstance()->MaybeGet(extra_pak_keys[i]); | 616 base::GlobalDescriptors::GetInstance()->MaybeGet(extra_pak_keys[i]); |
616 CHECK(pak_fd != -1); | 617 CHECK(pak_fd != -1); |
617 ResourceBundle::GetSharedInstance().AddDataPackFromFile( | 618 ResourceBundle::GetSharedInstance().AddDataPackFromFile( |
618 pak_fd, ui::SCALE_FACTOR_100P); | 619 pak_fd, ui::SCALE_FACTOR_100P); |
619 } | 620 } |
620 | 621 |
621 const std::string loaded_locale = locale; | 622 const std::string loaded_locale = locale; |
622 #else | 623 #else |
623 const std::string loaded_locale = | 624 const std::string loaded_locale = |
624 ResourceBundle::InitSharedInstanceWithLocale(locale, NULL); | 625 ResourceBundle::InitSharedInstanceWithLocale(locale, NULL); |
| 626 |
| 627 FilePath resources_pack_path; |
| 628 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); |
| 629 ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
| 630 resources_pack_path, ui::SCALE_FACTOR_NONE); |
625 #endif | 631 #endif |
626 CHECK(!loaded_locale.empty()) << "Locale could not be found for " << | 632 CHECK(!loaded_locale.empty()) << "Locale could not be found for " << |
627 locale; | 633 locale; |
628 | 634 |
629 #if defined(OS_MACOSX) | 635 #if defined(OS_MACOSX) |
630 // Update the process name (need resources to get the strings, so | 636 // Update the process name (need resources to get the strings, so |
631 // only do this when ResourcesBundle has been initialized). | 637 // only do this when ResourcesBundle has been initialized). |
632 SetMacProcessName(command_line); | 638 SetMacProcessName(command_line); |
633 #endif // defined(OS_MACOSX) | 639 #endif // defined(OS_MACOSX) |
634 } | 640 } |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 | 774 |
769 content::ContentRendererClient* | 775 content::ContentRendererClient* |
770 ChromeMainDelegate::CreateContentRendererClient() { | 776 ChromeMainDelegate::CreateContentRendererClient() { |
771 return &g_chrome_content_renderer_client.Get(); | 777 return &g_chrome_content_renderer_client.Get(); |
772 } | 778 } |
773 | 779 |
774 content::ContentUtilityClient* | 780 content::ContentUtilityClient* |
775 ChromeMainDelegate::CreateContentUtilityClient() { | 781 ChromeMainDelegate::CreateContentUtilityClient() { |
776 return &g_chrome_content_utility_client.Get(); | 782 return &g_chrome_content_utility_client.Get(); |
777 } | 783 } |
OLD | NEW |