OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/app_paths.h" | 5 #include "app/app_paths.h" |
6 #include "app/app_switches.h" | 6 #include "app/app_switches.h" |
7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/debugger.h" | 10 #include "base/debug/debugger.h" |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 if (SubprocessNeedsResourceBundle(process_type)) { | 839 if (SubprocessNeedsResourceBundle(process_type)) { |
840 // Initialize ResourceBundle which handles files loaded from external | 840 // Initialize ResourceBundle which handles files loaded from external |
841 // sources. The language should have been passed in to us from the | 841 // sources. The language should have been passed in to us from the |
842 // browser process as a command line flag. | 842 // browser process as a command line flag. |
843 DCHECK(command_line.HasSwitch(switches::kLang) || | 843 DCHECK(command_line.HasSwitch(switches::kLang) || |
844 process_type == switches::kZygoteProcess); | 844 process_type == switches::kZygoteProcess); |
845 | 845 |
846 // TODO(markusheintz): The command line flag --lang is actually processed | 846 // TODO(markusheintz): The command line flag --lang is actually processed |
847 // by the CommandLinePrefStore, and made available through the PrefService | 847 // by the CommandLinePrefStore, and made available through the PrefService |
848 // via the preference prefs::kApplicationLocale. The browser process uses | 848 // via the preference prefs::kApplicationLocale. The browser process uses |
849 // the --lang flag to passe the value of the PrefService in here. Maybe this | 849 // the --lang flag to pass the value of the PrefService in here. Maybe this |
850 // value could be passed in a different way. | 850 // value could be passed in a different way. |
851 ResourceBundle::InitSharedInstance( | 851 const std::string locale = |
852 command_line.GetSwitchValueASCII(switches::kLang)); | 852 command_line.GetSwitchValueASCII(switches::kLang); |
| 853 const std::string loaded_locale = |
| 854 ResourceBundle::InitSharedInstance(locale); |
| 855 CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale; |
853 | 856 |
854 #if defined(OS_MACOSX) | 857 #if defined(OS_MACOSX) |
855 // Update the process name (need resources to get the strings, so | 858 // Update the process name (need resources to get the strings, so |
856 // only do this when ResourcesBundle has been initialized). | 859 // only do this when ResourcesBundle has been initialized). |
857 SetMacProcessName(process_type); | 860 SetMacProcessName(process_type); |
858 #endif // defined(OS_MACOSX) | 861 #endif // defined(OS_MACOSX) |
859 } | 862 } |
860 | 863 |
861 if (!process_type.empty()) | 864 if (!process_type.empty()) |
862 CommonSubprocessInit(); | 865 CommonSubprocessInit(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 | 907 |
905 int exit_code = RunNamedProcessTypeMain(process_type, main_params); | 908 int exit_code = RunNamedProcessTypeMain(process_type, main_params); |
906 | 909 |
907 if (SubprocessNeedsResourceBundle(process_type)) | 910 if (SubprocessNeedsResourceBundle(process_type)) |
908 ResourceBundle::CleanupSharedInstance(); | 911 ResourceBundle::CleanupSharedInstance(); |
909 | 912 |
910 LowLevelShutdown(); | 913 LowLevelShutdown(); |
911 | 914 |
912 return exit_code; | 915 return exit_code; |
913 } | 916 } |
OLD | NEW |