summaryrefslogtreecommitdiffstats
path: root/chrome/browser/printing/cloud_print/virtual_driver_install_helper.cc
blob: 83160984bb13853339b47cc1177c9c3d8a46ddd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/printing/cloud_print/virtual_driver_install_helper.h"

#include "base/bind.h"
#include "chrome/browser/service/service_process_control.h"
#include "chrome/common/service_messages.h"

namespace cloud_print {

void VirtualDriverInstallHelper::SetUpInstall() {
  scoped_refptr<VirtualDriverInstallHelper> help =
      new VirtualDriverInstallHelper();
  ServiceProcessControl::GetInstance()->Launch(
      base::Bind(&VirtualDriverInstallHelper::InstallVirtualDriverTask,
                 help.get()),
      base::Closure());
}

void VirtualDriverInstallHelper::SetUpUninstall() {
  scoped_refptr<VirtualDriverInstallHelper> help =
      new VirtualDriverInstallHelper();
  ServiceProcessControl::GetInstance()->Launch(
      base::Bind(&VirtualDriverInstallHelper::UninstallVirtualDriverTask,
                 help.get()),
      base::Closure());
}

void VirtualDriverInstallHelper::InstallVirtualDriverTask() {
  ServiceProcessControl* process_control =
      ServiceProcessControl::GetInstance();
  DCHECK(process_control->IsConnected());
  process_control->Send(new ServiceMsg_EnableVirtualDriver());
}

void VirtualDriverInstallHelper::UninstallVirtualDriverTask() {
  ServiceProcessControl* process_control =
      ServiceProcessControl::GetInstance();
  DCHECK(process_control->IsConnected());
  process_control->Send(new ServiceMsg_DisableVirtualDriver());
}

}  // namespace cloud_print