Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / installer / mini_installer / configuration.h
blob605fa907a2e8bc918d3e8be2c04c20c7758aaab6
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 #include "chrome/installer/mini_installer/mini_string.h"
12 namespace mini_installer {
14 // A simple container of the mini_installer's configuration, as dictated by the
15 // command line used to invoke it.
16 class Configuration {
17 public:
18 enum Operation {
19 INSTALL_PRODUCT,
20 CLEANUP,
23 Configuration();
24 ~Configuration();
26 // Initializes this instance on the basis of the process's command line.
27 bool Initialize(HMODULE module);
29 // Returns the desired operation dictated by the command line options.
30 Operation operation() const { return operation_; }
32 // Returns the program portion of the command line, or NULL if it cannot be
33 // determined (e.g., by misuse).
34 const wchar_t* program() const;
36 // Returns the number of arguments specified on the command line, including
37 // the program itself.
38 int argument_count() const { return argument_count_; }
40 // Returns the original command line.
41 const wchar_t* command_line() const { return command_line_; }
43 // Returns the app guid to be used for Chrome. --chrome-sxs on the command
44 // line makes this the canary's app guid.
45 const wchar_t* chrome_app_guid() const { return chrome_app_guid_; }
47 // Returns true if --chrome is explicitly or implicitly on the command line.
48 bool has_chrome() const { return has_chrome_; }
50 // Returns true if --chrome-frame is on the command line.
51 bool has_chrome_frame() const { return has_chrome_frame_; }
53 // Returns true if --multi-install is on the command line.
54 bool is_multi_install() const { return is_multi_install_; }
56 // Returns true if --system-level is on the command line.
57 bool is_system_level() const { return is_system_level_; }
59 // Retuns true if --chrome-sxs is on the command line.
60 bool is_side_by_side() const { return is_side_by_side_; }
62 // Returns the previous version contained in the image's resource.
63 const wchar_t* previous_version() const { return previous_version_; }
65 protected:
66 void Clear();
67 bool ParseCommandLine(const wchar_t* command_line);
68 void ReadResources(HMODULE module);
70 wchar_t** args_;
71 const wchar_t* chrome_app_guid_;
72 const wchar_t* command_line_;
73 int argument_count_;
74 Operation operation_;
75 bool has_chrome_;
76 bool has_chrome_frame_;
77 bool is_multi_install_;
78 bool is_system_level_;
79 bool is_side_by_side_;
80 const wchar_t* previous_version_;
82 protected:
83 typedef StackString<128> ValueString;
85 // Virtual for testing.
86 virtual bool ReadClientStateRegistryValue(
87 const HKEY root_key, const wchar_t* app_guid,
88 LONG* retval, ValueString& value);
90 private:
91 Configuration(const Configuration&);
92 Configuration& operator=(const Configuration&);
94 void SetChromeAppGuid();
97 } // namespace mini_installer
99 #endif // CHROME_INSTALLER_MINI_INSTALLER_CONFIGURATION_H_