OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_INSTALLER_MINI_INSTALLER_CONFIGURATION_H_ | 5 #ifndef CHROME_INSTALLER_MINI_INSTALLER_CONFIGURATION_H_ |
6 #define CHROME_INSTALLER_MINI_INSTALLER_CONFIGURATION_H_ | 6 #define CHROME_INSTALLER_MINI_INSTALLER_CONFIGURATION_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include "chrome/installer/mini_installer/mini_string.h" | |
11 | |
12 namespace mini_installer { | 10 namespace mini_installer { |
13 | 11 |
14 // A simple container of the mini_installer's configuration, as dictated by the | 12 // A simple container of the mini_installer's configuration, as dictated by the |
15 // command line used to invoke it. | 13 // command line used to invoke it. |
16 class Configuration { | 14 class Configuration { |
17 public: | 15 public: |
18 enum Operation { | 16 enum Operation { |
19 INSTALL_PRODUCT, | 17 INSTALL_PRODUCT, |
20 CLEANUP, | 18 CLEANUP, |
21 }; | 19 }; |
(...skipping 11 matching lines...) Expand all Loading... |
33 // determined (e.g., by misuse). | 31 // determined (e.g., by misuse). |
34 const wchar_t* program() const; | 32 const wchar_t* program() const; |
35 | 33 |
36 // Returns the number of arguments specified on the command line, including | 34 // Returns the number of arguments specified on the command line, including |
37 // the program itself. | 35 // the program itself. |
38 int argument_count() const { return argument_count_; } | 36 int argument_count() const { return argument_count_; } |
39 | 37 |
40 // Returns the original command line. | 38 // Returns the original command line. |
41 const wchar_t* command_line() const { return command_line_; } | 39 const wchar_t* command_line() const { return command_line_; } |
42 | 40 |
43 // Returns the app guid to be used for Chrome. --chrome-sxs on the command | 41 // Returns the app guid to be used for Chrome. --chrome-sxs on the command |
44 // line makes this the canary's app guid. | 42 // line makes this the canary's app guid (Google Chrome only). |
45 const wchar_t* chrome_app_guid() const { return chrome_app_guid_; } | 43 const wchar_t* chrome_app_guid() const { return chrome_app_guid_; } |
46 | 44 |
47 // Returns true if --chrome is explicitly or implicitly on the command line. | |
48 bool has_chrome() const { return has_chrome_; } | |
49 | |
50 // Returns true if --multi-install is on the command line. | |
51 bool is_multi_install() const { return is_multi_install_; } | |
52 | |
53 // Returns true if --system-level is on the command line or if | 45 // Returns true if --system-level is on the command line or if |
54 // GoogleUpdateIsMachine=1 is set in the process's environment. | 46 // GoogleUpdateIsMachine=1 is set in the process's environment. |
55 bool is_system_level() const { return is_system_level_; } | 47 bool is_system_level() const { return is_system_level_; } |
56 | 48 |
57 // Retuns true if --chrome-sxs is on the command line. | 49 // Retuns true if --chrome-sxs is on the command line (Google Chrome only). |
58 bool is_side_by_side() const { return is_side_by_side_; } | 50 bool is_side_by_side() const { return is_side_by_side_; } |
59 | 51 |
| 52 // Returns true if an existing multi-install Chrome is being updated (Google |
| 53 // Chrome only). |
| 54 bool is_updating_multi_chrome() const { return is_updating_multi_chrome_; } |
| 55 |
60 // Returns true if any invalid switch is found on the command line. | 56 // Returns true if any invalid switch is found on the command line. |
61 bool has_invalid_switch() const { return has_invalid_switch_; } | 57 bool has_invalid_switch() const { return has_invalid_switch_; } |
62 | 58 |
63 // Returns the previous version contained in the image's resource. | 59 // Returns the previous version contained in the image's resource. |
64 const wchar_t* previous_version() const { return previous_version_; } | 60 const wchar_t* previous_version() const { return previous_version_; } |
65 | 61 |
66 protected: | 62 protected: |
67 void Clear(); | 63 void Clear(); |
68 bool ParseCommandLine(const wchar_t* command_line); | 64 bool ParseCommandLine(const wchar_t* command_line); |
69 void ReadResources(HMODULE module); | 65 void ReadResources(HMODULE module); |
70 | 66 |
71 wchar_t** args_; | 67 wchar_t** args_; |
72 const wchar_t* chrome_app_guid_; | 68 const wchar_t* chrome_app_guid_; |
73 const wchar_t* command_line_; | 69 const wchar_t* command_line_; |
74 int argument_count_; | 70 int argument_count_; |
75 Operation operation_; | 71 Operation operation_; |
76 bool has_chrome_; | |
77 bool is_multi_install_; | |
78 bool is_system_level_; | 72 bool is_system_level_; |
79 bool is_side_by_side_; | 73 bool is_side_by_side_; |
| 74 bool is_updating_multi_chrome_; |
80 bool has_invalid_switch_; | 75 bool has_invalid_switch_; |
81 const wchar_t* previous_version_; | 76 const wchar_t* previous_version_; |
82 | 77 |
83 protected: | 78 private: |
84 typedef StackString<128> ValueString; | 79 Configuration(const Configuration&) = delete; |
| 80 Configuration& operator=(const Configuration&) = delete; |
85 | 81 |
86 // Virtual for testing. | 82 // Returns true if multi-install Chrome is already present on the machine. |
87 virtual bool ReadClientStateRegistryValue( | 83 bool IsUpdatingMultiChrome() const; |
88 const HKEY root_key, const wchar_t* app_guid, | |
89 LONG* retval, ValueString& value); | |
90 | |
91 private: | |
92 Configuration(const Configuration&); | |
93 Configuration& operator=(const Configuration&); | |
94 | |
95 void SetChromeAppGuid(); | |
96 }; | 84 }; |
97 | 85 |
98 } // namespace mini_installer | 86 } // namespace mini_installer |
99 | 87 |
100 #endif // CHROME_INSTALLER_MINI_INSTALLER_CONFIGURATION_H_ | 88 #endif // CHROME_INSTALLER_MINI_INSTALLER_CONFIGURATION_H_ |
OLD | NEW |