Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: chrome/service/service_process.cc

Issue 7485011: Virtual Cloud Print Driver for Mac. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed copyright Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/service/service_process.h ('k') | cloud_print/virtual_driver/posix/backend.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/command_line.h" 10 #include "base/command_line.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 command_line.HasSwitch(switches::kEnableCloudPrintProxy); 185 command_line.HasSwitch(switches::kEnableCloudPrintProxy);
186 if (!cloud_print_proxy_enabled) { 186 if (!cloud_print_proxy_enabled) {
187 // Then check if the cloud print proxy was previously enabled. 187 // Then check if the cloud print proxy was previously enabled.
188 service_prefs_->GetBoolean(prefs::kCloudPrintProxyEnabled, 188 service_prefs_->GetBoolean(prefs::kCloudPrintProxyEnabled,
189 &cloud_print_proxy_enabled); 189 &cloud_print_proxy_enabled);
190 } 190 }
191 191
192 if (cloud_print_proxy_enabled) { 192 if (cloud_print_proxy_enabled) {
193 GetCloudPrintProxy()->EnableForUser(lsid); 193 GetCloudPrintProxy()->EnableForUser(lsid);
194 } 194 }
195 // Enable Virtual Printer Driver if needed.
196 bool virtual_printer_driver_enabled = false;
197 service_prefs_->GetBoolean(prefs::kVirtualPrinterDriverEnabled,
198 &virtual_printer_driver_enabled);
199
200 if (virtual_printer_driver_enabled) {
201 // Register the fact that there is at least one
202 // service needing the process.
203 OnServiceEnabled();
204 }
195 205
196 VLOG(1) << "Starting Service Process IPC Server"; 206 VLOG(1) << "Starting Service Process IPC Server";
197 ipc_server_.reset(new ServiceIPCServer( 207 ipc_server_.reset(new ServiceIPCServer(
198 service_process_state_->GetServiceProcessChannel())); 208 service_process_state_->GetServiceProcessChannel()));
199 ipc_server_->Init(); 209 ipc_server_->Init();
200 210
201 // After the IPC server has started we signal that the service process is 211 // After the IPC server has started we signal that the service process is
202 // ready. 212 // ready.
203 if (!state->SignalReady(io_thread_->message_loop_proxy(), 213 if (!state->SignalReady(io_thread_->message_loop_proxy(),
204 NewRunnableMethod(this, &ServiceProcess::Shutdown))) { 214 NewRunnableMethod(this, &ServiceProcess::Shutdown))) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 275
266 void ServiceProcess::OnCloudPrintProxyDisabled(bool persist_state) { 276 void ServiceProcess::OnCloudPrintProxyDisabled(bool persist_state) {
267 if (persist_state) { 277 if (persist_state) {
268 // Save the preference that we have disabled the cloud print proxy. 278 // Save the preference that we have disabled the cloud print proxy.
269 service_prefs_->SetBoolean(prefs::kCloudPrintProxyEnabled, false); 279 service_prefs_->SetBoolean(prefs::kCloudPrintProxyEnabled, false);
270 service_prefs_->WritePrefs(); 280 service_prefs_->WritePrefs();
271 } 281 }
272 OnServiceDisabled(); 282 OnServiceDisabled();
273 } 283 }
274 284
285 void ServiceProcess::EnableVirtualPrintDriver() {
286 OnServiceEnabled();
287 // Save the preference that we have enabled the virtual driver.
288 service_prefs_->SetBoolean(prefs::kVirtualPrinterDriverEnabled, true);
289 service_prefs_->WritePrefs();
290 }
291
292 void ServiceProcess::DisableVirtualPrintDriver() {
293 OnServiceDisabled();
294 // Save the preference that we have disabled the virtual driver.
295 service_prefs_->SetBoolean(prefs::kVirtualPrinterDriverEnabled, false);
296 service_prefs_->WritePrefs();
297 }
298
275 ServiceURLRequestContextGetter* 299 ServiceURLRequestContextGetter*
276 ServiceProcess::GetServiceURLRequestContextGetter() { 300 ServiceProcess::GetServiceURLRequestContextGetter() {
277 DCHECK(request_context_getter_.get()); 301 DCHECK(request_context_getter_.get());
278 return request_context_getter_.get(); 302 return request_context_getter_.get();
279 } 303 }
280 304
281 void ServiceProcess::OnServiceEnabled() { 305 void ServiceProcess::OnServiceEnabled() {
282 enabled_services_++; 306 enabled_services_++;
283 if ((1 == enabled_services_) && 307 if ((1 == enabled_services_) &&
284 !CommandLine::ForCurrentProcess()->HasSwitch( 308 !CommandLine::ForCurrentProcess()->HasSwitch(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 } else { 345 } else {
322 Shutdown(); 346 Shutdown();
323 } 347 }
324 } 348 }
325 } 349 }
326 350
327 ServiceProcess::~ServiceProcess() { 351 ServiceProcess::~ServiceProcess() {
328 Teardown(); 352 Teardown();
329 g_service_process = NULL; 353 g_service_process = NULL;
330 } 354 }
OLDNEW
« no previous file with comments | « chrome/service/service_process.h ('k') | cloud_print/virtual_driver/posix/backend.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698