Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / installer / mini_installer / configuration.h
blob1c75960d693acafad61d44912c92b87c36d81067
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
3 // found in the LICENSE file.
5 #ifndef CHROME_INSTALLER_MINI_INSTALLER_CONFIGURATION_H_
6 #define CHROME_INSTALLER_MINI_INSTALLER_CONFIGURATION_H_
8 #include <windows.h>
10 namespace mini_installer {
12 // A simple container of the mini_installer's configuration, as dictated by the
13 // command line used to invoke it.
14 class Configuration {
15 public:
16 enum Operation {
17 INSTALL_PRODUCT,
18 CLEANUP,
21 Configuration();
22 ~Configuration();
24 // Initializes this instance on the basis of the process's command line.
25 bool Initialize(HMODULE module);
27 // Returns the desired operation dictated by the command line options.
28 Operation operation() const { return operation_; }
30 // Returns the program portion of the command line, or NULL if it cannot be
31 // determined (e.g., by misuse).
32 const wchar_t* program() const;
34 // Returns the number of arguments specified on the command line, including
35 // the program itself.
36 int argument_count() const { return argument_count_; }
38 // Returns the original command line.
39 const wchar_t* command_line() const { return command_line_; }
41 // Returns the app guid to be used for Chrome. --chrome-sxs on the command
42 // line makes this the canary's app guid.
43 const wchar_t* chrome_app_guid() const { return chrome_app_guid_; }
45 // Returns true if --chrome is explicitly or implicitly on the command line.
46 bool has_chrome() const { return has_chrome_; }
48 // Returns true if --chrome-frame is on the command line.
49 bool has_chrome_frame() const { return has_chrome_frame_; }
51 // Returns true if --multi-install is on the command line.
52 bool is_multi_install() const { return is_multi_install_; }
54 // Returns true if --system-level is on the command line.
55 bool is_system_level() const { return is_system_level_; }
57 // Returns the previous version contained in the image's resource.
58 const wchar_t* previous_version() const { return previous_version_; }
60 protected:
61 void Clear();
62 bool ParseCommandLine(const wchar_t* command_line);
63 void ReadResources(HMODULE module);
65 wchar_t** args_;
66 const wchar_t* chrome_app_guid_;
67 const wchar_t* command_line_;
68 int argument_count_;
69 Operation operation_;
70 bool has_chrome_;
71 bool has_chrome_frame_;
72 bool is_multi_install_;
73 bool is_system_level_;
74 const wchar_t* previous_version_;
76 private:
77 Configuration(const Configuration&);
78 Configuration& operator=(const Configuration&);
81 } // namespace mini_installer
83 #endif // CHROME_INSTALLER_MINI_INSTALLER_CONFIGURATION_H_