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