| 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_UTIL_PRODUCT_OPERATIONS_H_ | 5 #ifndef CHROME_INSTALLER_UTIL_PRODUCT_OPERATIONS_H_ |
| 6 #define CHROME_INSTALLER_UTIL_PRODUCT_OPERATIONS_H_ | 6 #define CHROME_INSTALLER_UTIL_PRODUCT_OPERATIONS_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/string16.h" |
| 13 #include "chrome/installer/util/shell_util.h" | 14 #include "chrome/installer/util/shell_util.h" |
| 15 #include "chrome/installer/util/util_constants.h" |
| 14 | 16 |
| 15 class BrowserDistribution; | 17 class BrowserDistribution; |
| 16 class CommandLine; | 18 class CommandLine; |
| 17 | 19 |
| 18 namespace installer { | 20 namespace installer { |
| 19 | 21 |
| 20 class ChannelInfo; | 22 class ChannelInfo; |
| 21 class MasterPreferences; | 23 class MasterPreferences; |
| 22 | 24 |
| 23 // An interface to product-specific operations that depend on product | 25 // An interface to product-specific operations that depend on product |
| 24 // configuration. Implementations are expected to be stateless. Configuration | 26 // configuration. Implementations are expected to be stateless. Configuration |
| 25 // can be read from a MasterPreferences instance or from a product's uninstall | 27 // can be read from a MasterPreferences instance or from a product's uninstall |
| 26 // command. | 28 // command. |
| 27 class ProductOperations { | 29 class ProductOperations { |
| 28 public: | 30 public: |
| 29 virtual ~ProductOperations() {} | 31 virtual ~ProductOperations() {} |
| 30 | 32 |
| 31 // Reads product-specific options from |prefs|, adding them to |options|. | 33 // Reads product-specific options from |prefs|, adding them to |options|. |
| 32 virtual void ReadOptions(const MasterPreferences& prefs, | 34 virtual void ReadOptions(const MasterPreferences& prefs, |
| 33 std::set<std::wstring>* options) const = 0; | 35 std::set<string16>* options) const = 0; |
| 34 | 36 |
| 35 // Reads product-specific options from |command|, adding them to |options|. | 37 // Reads product-specific options from |command|, adding them to |options|. |
| 36 virtual void ReadOptions(const CommandLine& command, | 38 virtual void ReadOptions(const CommandLine& command, |
| 37 std::set<std::wstring>* options) const = 0; | 39 std::set<string16>* options) const = 0; |
| 38 | 40 |
| 39 // A key-file is a file such as a DLL on Windows that is expected to be in use | 41 // A key-file is a file such as a DLL on Windows that is expected to be in use |
| 40 // when the product is being used. For example "chrome.dll" for Chrome. | 42 // when the product is being used. For example "chrome.dll" for Chrome. |
| 41 // Before attempting to delete an installation directory during an | 43 // Before attempting to delete an installation directory during an |
| 42 // uninstallation, the uninstaller will check if any one of a potential set of | 44 // uninstallation, the uninstaller will check if any one of a potential set of |
| 43 // key files is in use and if they are, abort the delete operation. Only if | 45 // key files is in use and if they are, abort the delete operation. Only if |
| 44 // none of the key files are in use, can the folder be deleted. Note that | 46 // none of the key files are in use, can the folder be deleted. Note that |
| 45 // this function does not return a full path to the key file(s), only (a) file | 47 // this function does not return a full path to the key file(s), only (a) file |
| 46 // name(s). | 48 // name(s). |
| 47 virtual void AddKeyFiles(const std::set<std::wstring>& options, | 49 virtual void AddKeyFiles(const std::set<string16>& options, |
| 48 std::vector<base::FilePath>* key_files) const = 0; | 50 std::vector<base::FilePath>* key_files) const = 0; |
| 49 | 51 |
| 50 // Adds to |com_dll_list| the list of COM DLLs that are to be registered | 52 // Adds to |com_dll_list| the list of COM DLLs that are to be registered |
| 51 // and/or unregistered. The list may be empty. | 53 // and/or unregistered. The list may be empty. |
| 52 virtual void AddComDllList( | 54 virtual void AddComDllList( |
| 53 const std::set<std::wstring>& options, | 55 const std::set<string16>& options, |
| 54 std::vector<base::FilePath>* com_dll_list) const = 0; | 56 std::vector<base::FilePath>* com_dll_list) const = 0; |
| 55 | 57 |
| 56 // Given a command line, appends the set of product-specific flags. These are | 58 // Given a command line, appends the set of product-specific flags. These are |
| 57 // required for product-specific uninstall commands, but are of use for any | 59 // required for product-specific uninstall commands, but are of use for any |
| 58 // invocation of setup.exe for the product. | 60 // invocation of setup.exe for the product. |
| 59 virtual void AppendProductFlags(const std::set<std::wstring>& options, | 61 virtual void AppendProductFlags(const std::set<string16>& options, |
| 60 CommandLine* cmd_line) const = 0; | 62 CommandLine* cmd_line) const = 0; |
| 61 | 63 |
| 62 // Given a command line, appends the set of product-specific rename flags. | 64 // Given a command line, appends the set of product-specific rename flags. |
| 63 virtual void AppendRenameFlags(const std::set<std::wstring>& options, | 65 virtual void AppendRenameFlags(const std::set<string16>& options, |
| 64 CommandLine* cmd_line) const = 0; | 66 CommandLine* cmd_line) const = 0; |
| 65 | 67 |
| 66 // Adds or removes product-specific flags in |channel_info|. Returns true if | 68 // Adds or removes product-specific flags in |channel_info|. Returns true if |
| 67 // |channel_info| is modified. | 69 // |channel_info| is modified. |
| 68 virtual bool SetChannelFlags(const std::set<std::wstring>& options, | 70 virtual bool SetChannelFlags(const std::set<string16>& options, |
| 69 bool set, | 71 bool set, |
| 70 ChannelInfo* channel_info) const = 0; | 72 ChannelInfo* channel_info) const = 0; |
| 71 | 73 |
| 72 // Returns true if setup should create an entry in the Add/Remove list | 74 // Returns true if setup should create an entry in the Add/Remove list |
| 73 // of installed applications for this product. This does not test for use of | 75 // of installed applications for this product. This does not test for use of |
| 74 // MSI; see InstallerState::is_msi. | 76 // MSI; see InstallerState::is_msi. |
| 75 virtual bool ShouldCreateUninstallEntry( | 77 virtual bool ShouldCreateUninstallEntry( |
| 76 const std::set<std::wstring>& options) const = 0; | 78 const std::set<string16>& options) const = 0; |
| 77 | 79 |
| 78 // Modifies a ShellUtil::ShortcutProperties object by assigning default values | 80 // Modifies a ShellUtil::ShortcutProperties object by assigning default values |
| 79 // to unintialized members. | 81 // to unintialized members. |
| 80 virtual void AddDefaultShortcutProperties( | 82 virtual void AddDefaultShortcutProperties( |
| 81 BrowserDistribution* dist, | 83 BrowserDistribution* dist, |
| 82 const base::FilePath& target_exe, | 84 const base::FilePath& target_exe, |
| 83 ShellUtil::ShortcutProperties* properties) const = 0; | 85 ShellUtil::ShortcutProperties* properties) const = 0; |
| 86 |
| 87 // After an install or upgrade the user might qualify to participate in an |
| 88 // experiment. This function determines if the user qualifies and if so it |
| 89 // sets the wheels in motion or in simple cases does the experiment itself. |
| 90 virtual void LaunchUserExperiment(const base::FilePath& setup_path, |
| 91 const std::set<string16>& options, |
| 92 InstallStatus status, |
| 93 bool system_level) const = 0; |
| 84 }; | 94 }; |
| 85 | 95 |
| 86 } // namespace installer | 96 } // namespace installer |
| 87 | 97 |
| 88 #endif // CHROME_INSTALLER_UTIL_PRODUCT_OPERATIONS_H_ | 98 #endif // CHROME_INSTALLER_UTIL_PRODUCT_OPERATIONS_H_ |
| OLD | NEW |