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 // This file contains the specification of setup main functions.
7 #ifndef CHROME_INSTALLER_SETUP_INSTALL_H_
8 #define CHROME_INSTALLER_SETUP_INSTALL_H_
12 #include "base/strings/string16.h"
13 #include "base/version.h"
14 #include "chrome/installer/util/installation_state.h"
15 #include "chrome/installer/util/installer_state.h"
16 #include "chrome/installer/util/master_preferences.h"
17 #include "chrome/installer/util/product.h"
18 #include "chrome/installer/util/util_constants.h"
27 class InstallationState
;
29 class MasterPreferences
;
31 enum InstallShortcutOperation
{
32 // Create all shortcuts (potentially skipping those explicitly stated not to
33 // be installed in the InstallShortcutPreferences).
34 INSTALL_SHORTCUT_CREATE_ALL
,
35 // Create each per-user shortcut (potentially skipping those explicitly stated
36 // not to be installed in the InstallShortcutPreferences), but only if the
37 // system-level equivalent of that shortcut is not present on the system.
38 INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL
,
39 // Replace all shortcuts that still exist with the most recent version of
40 // each individual shortcut.
41 INSTALL_SHORTCUT_REPLACE_EXISTING
,
44 enum InstallShortcutLevel
{
45 // Install shortcuts for the current user only.
47 // Install global shortcuts visible to all users. Note: the Quick Launch
48 // and taskbar pin shortcuts are still installed per-user (as they have no
49 // all-users version).
53 // Escape |att_value| as per the XML AttValue production
54 // (http://www.w3.org/TR/2008/REC-xml-20081126/#NT-AttValue) for a value in
56 void EscapeXmlAttributeValueInSingleQuotes(base::string16
* att_value
);
58 // Creates VisualElementsManifest.xml beside chrome.exe in |src_path| if
59 // |src_path|\VisualElements exists.
60 // Returns true unless the manifest is supposed to be created, but fails to be.
61 bool CreateVisualElementsManifest(const base::FilePath
& src_path
,
62 const Version
& version
);
64 // Overwrites shortcuts (desktop, quick launch, and start menu) if they are
65 // present on the system.
66 // |prefs| can affect the behavior of this method through
67 // kDoNotCreateDesktopShortcut, kDoNotCreateQuickLaunchShortcut, and
69 // |install_level| specifies whether to install per-user shortcuts or shortcuts
70 // for all users on the system (this should only be used to update legacy
71 // system-level installs).
72 // If |install_operation| is a creation command, appropriate shortcuts will be
73 // created even if they don't exist.
74 // If creating the Start menu shortcut is successful, it is also pinned to the
76 void CreateOrUpdateShortcuts(
77 const base::FilePath
& target
,
78 const Product
& product
,
79 const MasterPreferences
& prefs
,
80 InstallShortcutLevel install_level
,
81 InstallShortcutOperation install_operation
);
83 // Registers Chrome on this machine.
84 // If |make_chrome_default|, also attempts to make Chrome default where doing so
85 // requires no more user interaction than a UAC prompt. In practice, this means
86 // on versions of Windows prior to Windows 8.
87 void RegisterChromeOnMachine(const InstallerState
& installer_state
,
88 const Product
& product
,
89 bool make_chrome_default
);
91 // This function installs or updates a new version of Chrome. It returns
92 // install status (failed, new_install, updated etc).
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 // install_temp_path: working directory used during install/update. It should
99 // also has a sub dir source that contains a complete
100 // and unpacked Chrome package.
101 // src_path: the unpacked Chrome package (inside |install_temp_path|).
102 // prefs: master preferences. See chrome/installer/util/master_preferences.h.
103 // new_version: new Chrome version that needs to be installed
104 // package: Represents the target installation folder and all distributions
105 // to be installed in that folder.
107 // Note: since caller unpacks Chrome to install_temp_path\source, the caller
108 // is responsible for cleaning up install_temp_path.
109 InstallStatus
InstallOrUpdateProduct(
110 const InstallationState
& original_state
,
111 const InstallerState
& installer_state
,
112 const base::FilePath
& setup_path
,
113 const base::FilePath
& archive_path
,
114 const base::FilePath
& install_temp_path
,
115 const base::FilePath
& src_path
,
116 const base::FilePath
& prefs_path
,
117 const installer::MasterPreferences
& prefs
,
118 const Version
& new_version
);
120 // Performs installation-related tasks following an OS upgrade.
121 // |chrome| The installed product (must be a browser).
122 // |installed_version| the current version of this install.
123 void HandleOsUpgradeForBrowser(const InstallerState
& installer_state
,
124 const Product
& chrome
,
125 const base::Version
& installed_version
);
127 // Performs per-user installation-related tasks on Active Setup (ran on first
128 // login for each user post system-level Chrome install).
129 // |installation_root|: The root of this install (i.e. the directory in which
130 // chrome.exe is installed).
131 // Shortcut creation is skipped if the First Run beacon is present (unless
132 // |force| is set to true).
133 // |chrome| The installed product (must be a browser).
134 void HandleActiveSetupForBrowser(const base::FilePath
& installation_root
,
135 const Product
& chrome
,
138 } // namespace installer
140 #endif // CHROME_INSTALLER_SETUP_INSTALL_H_