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