Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / cloud_print / service / win / service_controller.h
blob6868fbd9571c11b855b5ad55ee2ab00e7cc741d3
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CLOUD_PRINT_SERVICE_SERVICE_CONTROLLER_H_
6 #define CLOUD_PRINT_SERVICE_SERVICE_CONTROLLER_H_
8 #include <atlbase.h>
9 #include <string>
11 #include "base/command_line.h"
12 #include "base/strings/string16.h"
13 #include "cloud_print/resources.h"
15 namespace base {
16 class FilePath;
17 } // base
19 class ServiceController {
20 public:
21 enum State {
22 STATE_UNKNOWN = 0,
23 STATE_NOT_FOUND,
24 STATE_STOPPED,
25 STATE_RUNNING,
28 DECLARE_REGISTRY_APPID_RESOURCEID(IDR_CLOUDPRINTSERVICE,
29 "{8013FB7C-2E3E-4992-B8BD-05C0C4AB0627}")
31 ServiceController();
32 ~ServiceController();
34 // Installs temporarily service to check pre-requirements.
35 HRESULT InstallCheckService(const base::string16& user,
36 const base::string16& password,
37 const base::FilePath& user_data_dir);
39 // Installs real service that will run connector.
40 HRESULT InstallConnectorService(const base::string16& user,
41 const base::string16& password,
42 const base::FilePath& user_data_dir,
43 bool enable_logging);
45 HRESULT UninstallService();
47 HRESULT StartService();
48 HRESULT StopService();
50 HRESULT UpdateBinaryPath();
52 // Query service status and options. Results accessible with getters below.
53 void UpdateState();
54 State state() const { return state_; }
55 const base::string16& user() const { return user_; }
56 bool is_logging_enabled() const;
58 base::FilePath GetBinary() const;
60 private:
61 HRESULT InstallService(const base::string16& user,
62 const base::string16& password,
63 bool auto_start,
64 const std::string& run_switch,
65 const base::FilePath& user_data_dir,
66 bool enable_logging);
68 const base::string16 name_;
69 State state_;
70 base::string16 user_;
71 bool is_logging_enabled_;
72 base::CommandLine command_line_;
75 #endif // CLOUD_PRINT_SERVICE_SERVICE_CONTROLLER_H_