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