- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / installer / setup / install_worker.h
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.
4 //
5 // This file contains the declarations of the installer functions that build
6 // the WorkItemList used to install the application.
7
8 #ifndef CHROME_INSTALLER_SETUP_INSTALL_WORKER_H_
9 #define CHROME_INSTALLER_SETUP_INSTALL_WORKER_H_
10
11 #include <windows.h>
12
13 #include <vector>
14
15 class BrowserDistribution;
16 class CommandLine;
17 class WorkItemList;
18
19 namespace base {
20 class FilePath;
21 class Version;
22 }
23
24 namespace installer {
25
26 class InstallationState;
27 class InstallerState;
28 class Product;
29
30 // This method adds work items to create (or update) Chrome uninstall entry in
31 // either the Control Panel->Add/Remove Programs list or in the Omaha client
32 // state key if running under an MSI installer.
33 void AddUninstallShortcutWorkItems(const InstallerState& installer_state,
34                                    const base::FilePath& setup_path,
35                                    const base::Version& new_version,
36                                    const Product& product,
37                                    WorkItemList* install_list);
38
39 // Creates Version key for a product (if not already present) and sets the new
40 // product version as the last step.  If |add_language_identifier| is true, the
41 // "lang" value is also set according to the currently selected translation.
42 void AddVersionKeyWorkItems(HKEY root,
43                             BrowserDistribution* dist,
44                             const base::Version& new_version,
45                             bool add_language_identifier,
46                             WorkItemList* list);
47
48 // Helper function for AddGoogleUpdateWorkItems that mirrors oeminstall.
49 void AddOemInstallWorkItems(const InstallationState& original_state,
50                             const InstallerState& installer_state,
51                             WorkItemList* install_list);
52
53 // Helper function for AddGoogleUpdateWorkItems that mirrors eulaaccepted.
54 void AddEulaAcceptedWorkItems(const InstallationState& original_state,
55                               const InstallerState& installer_state,
56                               WorkItemList* install_list);
57
58 // Adds work items that make registry adjustments for Google Update; namely,
59 // copy brand, oeminstall, and eulaaccepted values; and move a usagestats value.
60 void AddGoogleUpdateWorkItems(const InstallationState& original_state,
61                               const InstallerState& installer_state,
62                               WorkItemList* install_list);
63
64 // Adds work items that make registry adjustments for stats and crash
65 // collection.  When a product is installed, Google Update may write a
66 // "usagestats" value to Chrome or Chrome Frame's ClientState key.  In the
67 // multi-install case, both products will consult/modify stats for the binaries'
68 // app guid.  Consequently, during install and update we will move a
69 // product-specific value into the binaries' ClientState key.
70 void AddUsageStatsWorkItems(const InstallationState& original_state,
71                             const InstallerState& installer_state,
72                             WorkItemList* install_list);
73
74 // After a successful copying of all the files, this function is called to
75 // do a few post install tasks:
76 // - Handle the case of in-use-update by updating "opv" (old version) key or
77 //   deleting it if not required.
78 // - Register any new dlls and unregister old dlls.
79 // - If this is an MSI install, ensures that the MSI marker is set, and sets
80 //   it if not.
81 // If these operations are successful, the function returns true, otherwise
82 // false.
83 // |current_version| can be NULL to indicate no Chrome is currently installed.
84 bool AppendPostInstallTasks(const InstallerState& installer_state,
85                             const base::FilePath& setup_path,
86                             const base::Version* current_version,
87                             const base::Version& new_version,
88                             const base::FilePath& temp_path,
89                             WorkItemList* post_install_task_list);
90
91 // Builds the complete WorkItemList used to build the set of installation steps
92 // needed to lay down one or more installed products.
93 //
94 // setup_path: Path to the executable (setup.exe) as it will be copied
95 //           to Chrome install folder after install is complete
96 // archive_path: Path to the archive (chrome.7z) as it will be copied
97 //               to Chrome install folder after install is complete
98 // src_path: the path that contains a complete and unpacked Chrome package
99 //           to be installed.
100 // temp_path: the path of working directory used during installation. This path
101 //            does not need to exist.
102 // |current_version| can be NULL to indicate no Chrome is currently installed.
103 void AddInstallWorkItems(const InstallationState& original_state,
104                          const InstallerState& installer_state,
105                          const base::FilePath& setup_path,
106                          const base::FilePath& archive_path,
107                          const base::FilePath& src_path,
108                          const base::FilePath& temp_path,
109                          const base::Version* current_version,
110                          const base::Version& new_version,
111                          WorkItemList* install_list);
112
113 // Appends registration or unregistration work items to |work_item_list| for the
114 // COM DLLs whose file names are given in |dll_files| and which reside in the
115 // path |dll_folder|.
116 // |system_level| specifies whether to call the system or user level DLL
117 // registration entry points.
118 // |do_register| says whether to register or unregister.
119 // |may_fail| states whether this is best effort or not. If |may_fail| is true
120 // then |work_item_list| will still succeed if the registration fails and
121 // no registration rollback will be performed.
122 void AddRegisterComDllWorkItems(const base::FilePath& dll_folder,
123                                 const std::vector<base::FilePath>& dll_files,
124                                 bool system_level,
125                                 bool do_register,
126                                 bool ignore_failures,
127                                 WorkItemList* work_item_list);
128
129 void AddSetMsiMarkerWorkItem(const InstallerState& installer_state,
130                              BrowserDistribution* dist,
131                              bool set,
132                              WorkItemList* work_item_list);
133
134 // Called for either installation or uninstallation. This method updates the
135 // registry according to Chrome Frame specific options for the current
136 // installation.  This includes handling of the ready-mode option.
137 void AddChromeFrameWorkItems(const InstallationState& original_state,
138                              const InstallerState& installer_state,
139                              const base::FilePath& setup_path,
140                              const base::Version& new_version,
141                              const Product& product,
142                              WorkItemList* list);
143
144 // Called for either installation or uninstallation. This method adds or
145 // removes COM registration for a product's DelegateExecute verb handler.
146 // If |new_version| is empty, the registrations will point to
147 // delegate_execute.exe directly in |target_path|.
148 void AddDelegateExecuteWorkItems(const InstallerState& installer_state,
149                                  const base::FilePath& target_path,
150                                  const base::Version& new_version,
151                                  const Product& product,
152                                  WorkItemList* list);
153
154 // Adds Active Setup registration for sytem-level setup to be called by Windows
155 // on user-login post-install/update.
156 // This method should be called for installation only.
157 // |product|: The product being installed. This method is a no-op if this is
158 // anything other than system-level Chrome/Chromium.
159 void AddActiveSetupWorkItems(const InstallerState& installer_state,
160                              const base::FilePath& setup_path,
161                              const base::Version& new_version,
162                              const Product& product,
163                              WorkItemList* list);
164
165 // Unregisters the "opv" version of ChromeLauncher from IE's low rights
166 // elevation policy.
167 void AddDeleteOldIELowRightsPolicyWorkItems(
168     const InstallerState& installer_state,
169     WorkItemList* install_list);
170
171 // Adds work items to copy IE low rights policies for an in-use update.
172 void AddCopyIELowRightsPolicyWorkItems(const InstallerState& installer_state,
173                                        WorkItemList* install_list);
174
175 // Utility method currently shared between install.cc and install_worker.cc
176 void AppendUninstallCommandLineFlags(const InstallerState& installer_state,
177                                      const Product& product,
178                                      CommandLine* uninstall_cmd);
179
180 // Refreshes the elevation policy on platforms where it is supported.
181 void RefreshElevationPolicy();
182
183 // Adds work items to add or remove the "on-os-upgrade" command to |product|'s
184 // version key on the basis of the current operation (represented in
185 // |installer_state|).  |new_version| is the version of the product(s)
186 // currently being installed -- can be empty on uninstall.
187 void AddOsUpgradeWorkItems(const InstallerState& installer_state,
188                            const base::FilePath& setup_path,
189                            const base::Version& new_version,
190                            const Product& product,
191                            WorkItemList* install_list);
192
193 // Adds work items to add or remove the "query-eula-acceptance" command to
194 // |product|'s version key on the basis of the current operation (represented
195 // in |installer_state|).  |new_version| is the version of the product(s)
196 // currently being installed -- can be empty on uninstall.
197 void AddQueryEULAAcceptanceWorkItems(const InstallerState& installer_state,
198                                      const base::FilePath& setup_path,
199                                      const base::Version& new_version,
200                                      const Product& product,
201                                      WorkItemList* work_item_list);
202
203 // Adds work items to add or remove the "quick-enable-cf" to the multi-installer
204 // binaries' version key on the basis of the current operation (represented in
205 // |installer_state|) and the pre-existing machine configuration (represented in
206 // |machine_state|).  |setup_path| (the path to the executable currently being
207 // run) and |new_version| (the version of the product(s) currently being
208 // installed) are required when processing product installation; they are unused
209 // (and may therefore be empty) when uninstalling.
210 void AddQuickEnableChromeFrameWorkItems(const InstallerState& installer_state,
211                                         const InstallationState& machine_state,
212                                         const base::FilePath& setup_path,
213                                         const base::Version& new_version,
214                                         WorkItemList* work_item_list);
215
216 }  // namespace installer
217
218 #endif  // CHROME_INSTALLER_SETUP_INSTALL_WORKER_H_