Index: chrome/service/service_process.cc |
=================================================================== |
--- chrome/service/service_process.cc (revision 70946) |
+++ chrome/service/service_process.cc (working copy) |
@@ -6,6 +6,8 @@ |
#include <algorithm> |
+#include "app/app_switches.h" |
+#include "app/resource_bundle.h" |
#include "base/basictypes.h" |
#include "base/command_line.h" |
#include "base/path_service.h" |
@@ -36,6 +38,8 @@ |
// a shutdown. |
const int64 kShutdownDelay = 60000; |
+const char kDefaultServiceProcessLocale[] = "en-US"; |
+ |
class ServiceIOThread : public base::Thread { |
public: |
explicit ServiceIOThread(const char* name); |
@@ -97,6 +101,21 @@ |
new ServiceProcessPrefs(pref_path, file_thread_->message_loop_proxy())); |
service_prefs_->ReadPrefs(); |
+ // Check if a locale override has been specified on the command-line. |
+ std::string locale = command_line.GetSwitchValueASCII(switches::kLang); |
+ if (!locale.empty()) { |
+ service_prefs_->SetString(prefs::kApplicationLocale, locale); |
+ service_prefs_->WritePrefs(); |
+ } else { |
+ // If no command-line value was specified, read the last used locale from |
+ // the prefs. |
+ service_prefs_->GetString(prefs::kApplicationLocale, &locale); |
+ // If no locale was specified anywhere, use the default one. |
+ if (locale.empty()) |
+ locale = kDefaultServiceProcessLocale; |
+ } |
+ ResourceBundle::InitSharedInstance(locale); |
+ |
#if defined(ENABLE_REMOTING) |
// Initialize chromoting host manager. |
remoting_host_manager_ = new remoting::ChromotingHostManager(this); |
@@ -176,17 +195,21 @@ |
return cloud_print_proxy_.get(); |
} |
-void ServiceProcess::OnCloudPrintProxyEnabled() { |
- // Save the preference that we have enabled the cloud print proxy. |
- service_prefs_->SetBoolean(prefs::kCloudPrintProxyEnabled, true); |
- service_prefs_->WritePrefs(); |
+void ServiceProcess::OnCloudPrintProxyEnabled(bool persist_state) { |
+ if (persist_state) { |
+ // Save the preference that we have enabled the cloud print proxy. |
+ service_prefs_->SetBoolean(prefs::kCloudPrintProxyEnabled, true); |
+ service_prefs_->WritePrefs(); |
+ } |
OnServiceEnabled(); |
} |
-void ServiceProcess::OnCloudPrintProxyDisabled() { |
- // Save the preference that we have disabled the cloud print proxy. |
- service_prefs_->SetBoolean(prefs::kCloudPrintProxyEnabled, false); |
- service_prefs_->WritePrefs(); |
+void ServiceProcess::OnCloudPrintProxyDisabled(bool persist_state) { |
+ if (persist_state) { |
+ // Save the preference that we have disabled the cloud print proxy. |
+ service_prefs_->SetBoolean(prefs::kCloudPrintProxyEnabled, false); |
+ service_prefs_->WritePrefs(); |
+ } |
OnServiceDisabled(); |
} |