Chromium Code Reviews| 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 std::string locale = command_line.GetSwitchValueASCII(switches::kLang); |
| 852 command_line.GetSwitchValueASCII(switches::kLang)); | 852 const std::string res = ResourceBundle::InitSharedInstance(locale); |
|
Peter Kasting
2010/12/21 18:35:58
Nit: |res| is a poor name; consider |loaded_locale
glotov
2010/12/21 20:33:34
Agree, just wanted a short name to fit the line. M
| |
| 853 CHECK(!res.empty()) << "Locale could not be found for " << locale; | |
|
Peter Kasting
2010/12/21 18:35:58
Nit: Shouldn't we be checking that these are equal
glotov
2010/12/21 20:33:34
That was my mistake that time. No, we shouldn't. B
| |
| 853 | 854 |
| 854 #if defined(OS_MACOSX) | 855 #if defined(OS_MACOSX) |
| 855 // Update the process name (need resources to get the strings, so | 856 // Update the process name (need resources to get the strings, so |
| 856 // only do this when ResourcesBundle has been initialized). | 857 // only do this when ResourcesBundle has been initialized). |
| 857 SetMacProcessName(process_type); | 858 SetMacProcessName(process_type); |
| 858 #endif // defined(OS_MACOSX) | 859 #endif // defined(OS_MACOSX) |
| 859 } | 860 } |
| 860 | 861 |
| 861 if (!process_type.empty()) | 862 if (!process_type.empty()) |
| 862 CommonSubprocessInit(); | 863 CommonSubprocessInit(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 904 | 905 |
| 905 int exit_code = RunNamedProcessTypeMain(process_type, main_params); | 906 int exit_code = RunNamedProcessTypeMain(process_type, main_params); |
| 906 | 907 |
| 907 if (SubprocessNeedsResourceBundle(process_type)) | 908 if (SubprocessNeedsResourceBundle(process_type)) |
| 908 ResourceBundle::CleanupSharedInstance(); | 909 ResourceBundle::CleanupSharedInstance(); |
| 909 | 910 |
| 910 LowLevelShutdown(); | 911 LowLevelShutdown(); |
| 911 | 912 |
| 912 return exit_code; | 913 return exit_code; |
| 913 } | 914 } |
| OLD | NEW |