| 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/service/service_process.h" | 5 #include "chrome/service/service_process.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 service_prefs_->ReadPrefs(); | 168 service_prefs_->ReadPrefs(); |
| 169 | 169 |
| 170 // Check if a locale override has been specified on the command-line. | 170 // Check if a locale override has been specified on the command-line. |
| 171 std::string locale = command_line.GetSwitchValueASCII(switches::kLang); | 171 std::string locale = command_line.GetSwitchValueASCII(switches::kLang); |
| 172 if (!locale.empty()) { | 172 if (!locale.empty()) { |
| 173 service_prefs_->SetString(prefs::kApplicationLocale, locale); | 173 service_prefs_->SetString(prefs::kApplicationLocale, locale); |
| 174 service_prefs_->WritePrefs(); | 174 service_prefs_->WritePrefs(); |
| 175 } else { | 175 } else { |
| 176 // If no command-line value was specified, read the last used locale from | 176 // If no command-line value was specified, read the last used locale from |
| 177 // the prefs. | 177 // the prefs. |
| 178 service_prefs_->GetString(prefs::kApplicationLocale, &locale); | 178 locale = service_prefs_->GetString(prefs::kApplicationLocale, ""); |
| 179 // If no locale was specified anywhere, use the default one. | 179 // If no locale was specified anywhere, use the default one. |
| 180 if (locale.empty()) | 180 if (locale.empty()) |
| 181 locale = kDefaultServiceProcessLocale; | 181 locale = kDefaultServiceProcessLocale; |
| 182 } | 182 } |
| 183 ResourceBundle::InitSharedInstanceWithLocale(locale, NULL); | 183 ResourceBundle::InitSharedInstanceWithLocale(locale, NULL); |
| 184 | 184 |
| 185 PrepareRestartOnCrashEnviroment(command_line); | 185 PrepareRestartOnCrashEnviroment(command_line); |
| 186 | 186 |
| 187 // Enable Cloud Print if needed. First check the command-line. | 187 // Enable Cloud Print if needed. First check the command-line. |
| 188 bool cloud_print_proxy_enabled = | 188 // Then check if the cloud print proxy was previously enabled. |
| 189 command_line.HasSwitch(switches::kEnableCloudPrintProxy); | 189 if (command_line.HasSwitch(switches::kEnableCloudPrintProxy) || |
| 190 if (!cloud_print_proxy_enabled) { | 190 service_prefs_->GetBoolean(prefs::kCloudPrintProxyEnabled, false)) { |
| 191 // Then check if the cloud print proxy was previously enabled. | |
| 192 service_prefs_->GetBoolean(prefs::kCloudPrintProxyEnabled, | |
| 193 &cloud_print_proxy_enabled); | |
| 194 } | |
| 195 | |
| 196 if (cloud_print_proxy_enabled) { | |
| 197 GetCloudPrintProxy()->EnableForUser(lsid); | 191 GetCloudPrintProxy()->EnableForUser(lsid); |
| 198 } | 192 } |
| 199 // Enable Virtual Printer Driver if needed. | 193 // Enable Virtual Printer Driver if needed. |
| 200 bool virtual_printer_driver_enabled = false; | 194 if (service_prefs_->GetBoolean(prefs::kVirtualPrinterDriverEnabled, false)) { |
| 201 service_prefs_->GetBoolean(prefs::kVirtualPrinterDriverEnabled, | |
| 202 &virtual_printer_driver_enabled); | |
| 203 | |
| 204 if (virtual_printer_driver_enabled) { | |
| 205 // Register the fact that there is at least one | 195 // Register the fact that there is at least one |
| 206 // service needing the process. | 196 // service needing the process. |
| 207 OnServiceEnabled(); | 197 OnServiceEnabled(); |
| 208 } | 198 } |
| 209 | 199 |
| 210 VLOG(1) << "Starting Service Process IPC Server"; | 200 VLOG(1) << "Starting Service Process IPC Server"; |
| 211 ipc_server_.reset(new ServiceIPCServer( | 201 ipc_server_.reset(new ServiceIPCServer( |
| 212 service_process_state_->GetServiceProcessChannel())); | 202 service_process_state_->GetServiceProcessChannel())); |
| 213 ipc_server_->Init(); | 203 ipc_server_->Init(); |
| 214 | 204 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 if (enabled_services_ && !ipc_server_->is_client_connected()) { | 375 if (enabled_services_ && !ipc_server_->is_client_connected()) { |
| 386 GetCloudPrintProxy()->CheckCloudPrintProxyPolicy(); | 376 GetCloudPrintProxy()->CheckCloudPrintProxyPolicy(); |
| 387 } | 377 } |
| 388 ScheduleCloudPrintPolicyCheck(); | 378 ScheduleCloudPrintPolicyCheck(); |
| 389 } | 379 } |
| 390 | 380 |
| 391 ServiceProcess::~ServiceProcess() { | 381 ServiceProcess::~ServiceProcess() { |
| 392 Teardown(); | 382 Teardown(); |
| 393 g_service_process = NULL; | 383 g_service_process = NULL; |
| 394 } | 384 } |
| OLD | NEW |