Home | History | Annotate | Download | only in setup
      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 adds or
    135 // removes COM registration for a product's DelegateExecute verb handler.
    136 // If |new_version| is empty, the registrations will point to
    137 // delegate_execute.exe directly in |target_path|.
    138 void AddDelegateExecuteWorkItems(const InstallerState& installer_state,
    139                                  const base::FilePath& target_path,
    140                                  const base::Version& new_version,
    141                                  const Product& product,
    142                                  WorkItemList* list);
    143 
    144 // Adds Active Setup registration for sytem-level setup to be called by Windows
    145 // on user-login post-install/update.
    146 // This method should be called for installation only.
    147 // |product|: The product being installed. This method is a no-op if this is
    148 // anything other than system-level Chrome/Chromium.
    149 void AddActiveSetupWorkItems(const InstallerState& installer_state,
    150                              const base::FilePath& setup_path,
    151                              const base::Version& new_version,
    152                              const Product& product,
    153                              WorkItemList* list);
    154 
    155 // Unregisters the "opv" version of ChromeLauncher from IE's low rights
    156 // elevation policy.
    157 void AddDeleteOldIELowRightsPolicyWorkItems(
    158     const InstallerState& installer_state,
    159     WorkItemList* install_list);
    160 
    161 // Utility method currently shared between install.cc and install_worker.cc
    162 void AppendUninstallCommandLineFlags(const InstallerState& installer_state,
    163                                      const Product& product,
    164                                      CommandLine* uninstall_cmd);
    165 
    166 // Refreshes the elevation policy on platforms where it is supported.
    167 void RefreshElevationPolicy();
    168 
    169 // Adds work items to add or remove the "on-os-upgrade" command to |product|'s
    170 // version key on the basis of the current operation (represented in
    171 // |installer_state|).  |new_version| is the version of the product(s)
    172 // currently being installed -- can be empty on uninstall.
    173 void AddOsUpgradeWorkItems(const InstallerState& installer_state,
    174                            const base::FilePath& setup_path,
    175                            const base::Version& new_version,
    176                            const Product& product,
    177                            WorkItemList* install_list);
    178 
    179 // Adds work items to add or remove the "query-eula-acceptance" command to
    180 // |product|'s version key on the basis of the current operation (represented
    181 // in |installer_state|).  |new_version| is the version of the product(s)
    182 // currently being installed -- can be empty on uninstall.
    183 void AddQueryEULAAcceptanceWorkItems(const InstallerState& installer_state,
    184                                      const base::FilePath& setup_path,
    185                                      const base::Version& new_version,
    186                                      const Product& product,
    187                                      WorkItemList* work_item_list);
    188 
    189 // Adds work items to remove "quick-enable-cf" from the multi-installer
    190 // binaries' version key.
    191 void AddQuickEnableChromeFrameWorkItems(const InstallerState& installer_state,
    192                                         WorkItemList* work_item_list);
    193 
    194 }  // namespace installer
    195 
    196 #endif  // CHROME_INSTALLER_SETUP_INSTALL_WORKER_H_
    197