summaryrefslogtreecommitdiffstats
path: root/chrome/service/service_process.cc
diff options
context:
space:
mode:
authorsanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-20 23:19:33 +0000
committersanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-20 23:19:33 +0000
commit0ffeb598304f119e2d3df70d47a592d2dbc722da (patch)
tree8d1519e141a036af64cb4c943b1132060503a24f /chrome/service/service_process.cc
parent9fc18674a68e4b4c366ffb81fb4c84b6c6bed9d2 (diff)
downloadchromium_src-0ffeb598304f119e2d3df70d47a592d2dbc722da.zip
chromium_src-0ffeb598304f119e2d3df70d47a592d2dbc722da.tar.gz
chromium_src-0ffeb598304f119e2d3df70d47a592d2dbc722da.tar.bz2
Code to send diagnostic messages about cloud print proxy. Currently diagnostic messages are sent if the print system fails to initialize (this can happen on Windows if the XPS Framework is not installed on XP) as well when printer registration fails because we could not get the capabilities for the printer.
BUG=None TEST=None Review URL: http://codereview.chromium.org/6245005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72037 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service/service_process.cc')
-rw-r--r--chrome/service/service_process.cc39
1 files changed, 31 insertions, 8 deletions
diff --git a/chrome/service/service_process.cc b/chrome/service/service_process.cc
index c2f43f2..b141b01 100644
--- a/chrome/service/service_process.cc
+++ b/chrome/service/service_process.cc
@@ -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 @@ namespace {
// 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 @@ bool ServiceProcess::Initialize(MessageLoop* message_loop,
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 @@ CloudPrintProxy* ServiceProcess::GetCloudPrintProxy() {
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();
}