uninstall.h revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
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 declares Chrome uninstall related functions.
6
7#ifndef CHROME_INSTALLER_SETUP_UNINSTALL_H_
8#define CHROME_INSTALLER_SETUP_UNINSTALL_H_
9
10#include <shlobj.h>
11
12#include "base/string16.h"
13#include "chrome/installer/util/util_constants.h"
14
15class BrowserDistribution;
16class CommandLine;
17
18namespace base {
19class FilePath;
20}
21
22namespace installer {
23
24class InstallationState;
25class InstallerState;
26class Product;
27
28// This function removes all Chrome registration related keys. It returns true
29// if successful, otherwise false. The error code is set in |exit_code|.
30// |root| is the registry root (HKLM|HKCU) and |browser_entry_suffix| is the
31// suffix for default browser entry name in the registry (optional).
32bool DeleteChromeRegistrationKeys(const InstallerState& installer_state,
33                                  BrowserDistribution* dist,
34                                  HKEY root,
35                                  const string16& browser_entry_suffix,
36                                  InstallStatus* exit_code);
37
38// Removes any legacy registry keys from earlier versions of Chrome that are no
39// longer needed. This is used during autoupdate since we don't do full
40// uninstalls/reinstalls to update.
41void RemoveChromeLegacyRegistryKeys(BrowserDistribution* dist,
42                                    const string16& chrome_exe);
43
44// This function uninstalls a product.  Hence we came up with this awesome
45// name for it.
46//
47// original_state: The installation state of all products on the system.
48// installer_state: State associated with this operation.
49// setup_path: Path to the executable (setup.exe) as it will be copied
50//           to temp folder before deleting Chrome folder.
51// dist: Represents the distribution to be uninstalled.
52// remove_all: Remove all shared files, registry entries as well.
53// force_uninstall: Uninstall without prompting for user confirmation or
54//                  any checks for Chrome running.
55// cmd_line: CommandLine that contains information about the command that
56//           was used to launch current uninstaller.
57installer::InstallStatus UninstallProduct(
58    const InstallationState& original_state,
59    const InstallerState& installer_state,
60    const base::FilePath& setup_path,
61    const Product& dist,
62    bool remove_all,
63    bool force_uninstall,
64    const CommandLine& cmd_line);
65
66// Cleans up the installation directory after all uninstall operations have
67// completed. Depending on what products are remaining, setup.exe and the
68// installer archive may be deleted. Empty directories will be pruned (or
69// scheduled for pruning after reboot, if necessary).
70//
71// original_state: The installation state of all products on the system.
72// installer_state: State associated with this operation.
73// cmd_line: CommandLine that contains information about the command that
74//           was used to launch current uninstaller.
75// uninstall_status: the uninstall status so far (may change during invocation).
76void CleanUpInstallationDirectoryAfterUninstall(
77    const InstallationState& original_state,
78    const InstallerState& installer_state,
79    const CommandLine& cmd_line,
80    installer::InstallStatus* uninstall_status);
81
82}  // namespace installer
83
84#endif  // CHROME_INSTALLER_SETUP_UNINSTALL_H_
85