Roll src/third_party/WebKit 116cf7f:79abaa8 (svn 189234:189235)
[chromium-blink-merge.git] / chrome / installer / util / product_operations.h
blobd84a1b9e893d975404d5ea47f55daec3c0915816
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
3 // found in the LICENSE file.
5 #ifndef CHROME_INSTALLER_UTIL_PRODUCT_OPERATIONS_H_
6 #define CHROME_INSTALLER_UTIL_PRODUCT_OPERATIONS_H_
8 #include <set>
9 #include <string>
10 #include <vector>
12 #include "base/files/file_path.h"
13 #include "base/strings/string16.h"
14 #include "chrome/installer/util/shell_util.h"
15 #include "chrome/installer/util/util_constants.h"
17 class BrowserDistribution;
19 namespace base {
20 class CommandLine;
23 namespace installer {
25 class ChannelInfo;
26 class MasterPreferences;
28 // An interface to product-specific operations that depend on product
29 // configuration. Implementations are expected to be stateless. Configuration
30 // can be read from a MasterPreferences instance or from a product's uninstall
31 // command.
32 class ProductOperations {
33 public:
34 virtual ~ProductOperations() {}
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;
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;
44 // 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.
46 // Before attempting to delete an installation directory during an
47 // 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
49 // none of the key files are in use, can the folder be deleted. Note that
50 // this function does not return a full path to the key file(s), only (a) file
51 // name(s).
52 virtual void AddKeyFiles(const std::set<base::string16>& options,
53 std::vector<base::FilePath>* key_files) const = 0;
55 // Adds to |com_dll_list| the list of COM DLLs that are to be registered
56 // and/or unregistered. The list may be empty.
57 virtual void AddComDllList(
58 const std::set<base::string16>& options,
59 std::vector<base::FilePath>* com_dll_list) const = 0;
61 // Given a command line, appends the set of product-specific flags. These are
62 // required for product-specific uninstall commands, but are of use for any
63 // invocation of setup.exe for the product.
64 virtual void AppendProductFlags(const std::set<base::string16>& options,
65 base::CommandLine* cmd_line) const = 0;
67 // Given a command line, appends the set of product-specific rename flags.
68 virtual void AppendRenameFlags(const std::set<base::string16>& options,
69 base::CommandLine* cmd_line) const = 0;
71 // Adds or removes product-specific flags in |channel_info|. Returns true if
72 // |channel_info| is modified.
73 virtual bool SetChannelFlags(const std::set<base::string16>& options,
74 bool set,
75 ChannelInfo* channel_info) const = 0;
77 // Returns true if setup should create an entry in the Add/Remove list
78 // of installed applications for this product. This does not test for use of
79 // MSI; see InstallerState::is_msi.
80 virtual bool ShouldCreateUninstallEntry(
81 const std::set<base::string16>& options) const = 0;
83 // Modifies a ShellUtil::ShortcutProperties object by assigning default values
84 // to unintialized members.
85 virtual void AddDefaultShortcutProperties(
86 BrowserDistribution* dist,
87 const base::FilePath& target_exe,
88 ShellUtil::ShortcutProperties* properties) const = 0;
90 // After an install or upgrade the user might qualify to participate in an
91 // experiment. This function determines if the user qualifies and if so it
92 // sets the wheels in motion or in simple cases does the experiment itself.
93 virtual void LaunchUserExperiment(const base::FilePath& setup_path,
94 const std::set<base::string16>& options,
95 InstallStatus status,
96 bool system_level) const = 0;
99 } // namespace installer
101 #endif // CHROME_INSTALLER_UTIL_PRODUCT_OPERATIONS_H_