| 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 --chrome-frame is on the command line. | |
| 51 bool has_chrome_frame() const { return has_chrome_frame_; } | |
| 52 | |
| 53 // Returns true if --multi-install is on the command line. | |
| 54 bool is_multi_install() const { return is_multi_install_; } | |
| 55 | |
| 56 // 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 |
| 57 // GoogleUpdateIsMachine=1 is set in the process's environment. | 46 // GoogleUpdateIsMachine=1 is set in the process's environment. |
| 58 bool is_system_level() const { return is_system_level_; } | 47 bool is_system_level() const { return is_system_level_; } |
| 59 | 48 |
| 60 // Retuns true if --chrome-sxs is on the command line. | 49 // Retuns true if --chrome-sxs is on the command line (Google Chrome only). |
| 61 bool is_side_by_side() const { return is_side_by_side_; } | 50 bool is_side_by_side() const { return is_side_by_side_; } |
| 62 | 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 |
| 63 // Returns the previous version contained in the image's resource. | 56 // Returns the previous version contained in the image's resource. |
| 64 const wchar_t* previous_version() const { return previous_version_; } | 57 const wchar_t* previous_version() const { return previous_version_; } |
| 65 | 58 |
| 66 protected: | 59 protected: |
| 67 void Clear(); | 60 void Clear(); |
| 68 bool ParseCommandLine(const wchar_t* command_line); | 61 bool ParseCommandLine(const wchar_t* command_line); |
| 69 void ReadResources(HMODULE module); | 62 void ReadResources(HMODULE module); |
| 70 | 63 |
| 71 wchar_t** args_; | 64 wchar_t** args_; |
| 72 const wchar_t* chrome_app_guid_; | 65 const wchar_t* chrome_app_guid_; |
| 73 const wchar_t* command_line_; | 66 const wchar_t* command_line_; |
| 74 int argument_count_; | 67 int argument_count_; |
| 75 Operation operation_; | 68 Operation operation_; |
| 76 bool has_chrome_; | |
| 77 bool has_chrome_frame_; | |
| 78 bool is_multi_install_; | |
| 79 bool is_system_level_; | 69 bool is_system_level_; |
| 80 bool is_side_by_side_; | 70 bool is_side_by_side_; |
| 71 bool is_updating_multi_chrome_; |
| 81 const wchar_t* previous_version_; | 72 const wchar_t* previous_version_; |
| 82 | 73 |
| 83 protected: | 74 private: |
| 84 typedef StackString<128> ValueString; | 75 Configuration(const Configuration&) = delete; |
| 76 Configuration& operator=(const Configuration&) = delete; |
| 85 | 77 |
| 86 // Virtual for testing. | 78 // Returns true if multi-install Chrome is already present on the machine. |
| 87 virtual bool ReadClientStateRegistryValue( | 79 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 }; | 80 }; |
| 97 | 81 |
| 98 } // namespace mini_installer | 82 } // namespace mini_installer |
| 99 | 83 |
| 100 #endif // CHROME_INSTALLER_MINI_INSTALLER_CONFIGURATION_H_ | 84 #endif // CHROME_INSTALLER_MINI_INSTALLER_CONFIGURATION_H_ |
| OLD | NEW |