Add testing/scripts/OWNERS
[chromium-blink-merge.git] / chrome / installer / mini_installer / configuration.h
blob2e108c7be2b61205a7697b6db5f2d903b5437baf
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 namespace mini_installer {
10 // A simple container of the mini_installer's configuration, as dictated by the
11 // command line used to invoke it.
12 class Configuration {
13 public:
14 enum Operation {
15 INSTALL_PRODUCT,
16 CLEANUP,
19 Configuration();
20 ~Configuration();
22 // Initializes this instance on the basis of the process's command line.
23 bool Initialize();
25 // Returns the desired operation dictated by the command line options.
26 Operation operation() const { return operation_; }
28 // Returns the program portion of the command line, or NULL if it cannot be
29 // determined (e.g., by misuse).
30 const wchar_t* program() const;
32 // Returns the number of arguments specified on the command line, including
33 // the program itself.
34 int argument_count() const { return argument_count_; }
36 // Returns the original command line.
37 const wchar_t* command_line() const { return command_line_; }
39 // Returns the app guid to be used for Chrome. --chrome-sxs on the command
40 // line makes this the canary's app guid.
41 const wchar_t* chrome_app_guid() const { return chrome_app_guid_; }
43 // Returns true if --chrome is explicitly or implicitly on the command line.
44 bool has_chrome() const { return has_chrome_; }
46 // Returns true if --chrome-frame is on the command line.
47 bool has_chrome_frame() const { return has_chrome_frame_; }
49 // Returns true if --app-host is on the command line.
50 bool has_app_host() const { return has_app_host_; }
52 // Returns true if --multi-install is on the command line.
53 bool is_multi_install() const { return is_multi_install_; }
55 // Returns true if --system-level is on the command line.
56 bool is_system_level() const { return is_system_level_; }
58 // Returns true if --query-component-build is on the command line.
59 // This will cause mini_installer to exit and return 1 if this is
60 // a component install or 0 otherwise.
61 bool query_component_build() const { return query_component_build_; }
63 protected:
64 void Clear();
65 bool InitializeFromCommandLine(const wchar_t* command_line);
67 wchar_t** args_;
68 const wchar_t* chrome_app_guid_;
69 const wchar_t* command_line_;
70 int argument_count_;
71 Operation operation_;
72 bool has_chrome_;
73 bool has_chrome_frame_;
74 bool has_app_host_;
75 bool is_multi_install_;
76 bool is_system_level_;
77 bool query_component_build_;
79 private:
80 Configuration(const Configuration&);
81 Configuration& operator=(const Configuration&);
84 } // namespace mini_installer
86 #endif // CHROME_INSTALLER_MINI_INSTALLER_CONFIGURATION_H_