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 #include "chrome/installer/util/util_constants.h"
6 
7 namespace installer {
8 
9 namespace switches {
10 
11 // Allow an update of Chrome from a higher version to a lower version.
12 // Ordinarily, such downgrades are disallowed. An administrator may wish to
13 // allow them in circumstances where the potential loss of user data is
14 // permissible.
15 const char kAllowDowngrade[] = "allow-downgrade";
16 
17 // A channel name specified via administrative policy. This switch sets the
18 // channel both of the installer and of the version of Chrome being installed.
19 // This switch has no effect for secondary install modes (i.e., installs that
20 // use --chrome-sxs or another mode switch).
21 const char kChannel[] = "channel";
22 
23 // Create shortcuts for this user to point to a system-level install (which
24 // must already be installed on the machine). The shortcuts created will
25 // match the preferences of the already present system-level install as such
26 // this option is not compatible with any other installer options.
27 const char kConfigureUserSettings[] = "configure-user-settings";
28 
29 // The version number of an update containing critical fixes, for which an
30 // in-use Chrome should be restarted ASAP.
31 const char kCriticalUpdateVersion[] = "critical-update-version";
32 
33 // Delete files that belong to old versions of Chrome from the install
34 // directory.
35 const char kDeleteOldVersions[] = "delete-old-versions";
36 
37 // Delete user profile data. This param is useful only when specified with
38 // kUninstall, otherwise it is silently ignored.
39 const char kDeleteProfile[] = "delete-profile";
40 
41 // Disable logging
42 const char kDisableLogging[] = "disable-logging";
43 
44 // Prevent installer from launching Chrome after a successful first install.
45 const char kDoNotLaunchChrome[] = "do-not-launch-chrome";
46 
47 // Prevents installer from writing the Google Update key that causes Google
48 // Update to launch Chrome after a first install.
49 const char kDoNotRegisterForUpdateLaunch[] =
50     "do-not-register-for-update-launch";
51 
52 // By default we remove all shared (between users) files, registry entries etc
53 // during uninstall. If this option is specified together with kUninstall option
54 // we do not clean up shared entries otherwise this option is ignored.
55 const char kDoNotRemoveSharedItems[] = "do-not-remove-shared-items";
56 
57 // Enable logging at the error level. This is the default behavior.
58 const char kEnableLogging[] = "enable-logging";
59 
60 // Same as kConfigureUserSettings above; except the checks to know whether
61 // first run already occurred are bypassed and shortcuts are created either way
62 // (kConfigureUserSettings also needs to be on the command-line for this to have
63 // any effect).
64 const char kForceConfigureUserSettings[] = "force-configure-user-settings";
65 
66 // If present, setup will uninstall chrome without asking for any
67 // confirmation from user.
68 const char kForceUninstall[] = "force-uninstall";
69 
70 // See description for kPatch.
71 const char kInputFile[] = "input-file";
72 
73 // Specify the path to the compressed Chrome archive for install. If not
74 // specified, chrome.packed.7z or chrome.7z in the same directory as setup.exe
75 // is used (the packed file is preferred; see kUncompressedArchive to force use
76 // of an uncompressed archive).
77 const char kInstallArchive[] = "install-archive";
78 
79 // Specify the file path of Chrome master preference file.
80 const char kInstallerData[] = "installerdata";
81 
82 // If present, specify file path to write logging info.
83 const char kLogFile[] = "log-file";
84 
85 // Register Chrome as default browser on the system. Usually this will require
86 // that setup is running as admin. If running as admin we try to register
87 // as default browser at system level, if running as non-admin we try to
88 // register as default browser only for the current user.
89 const char kMakeChromeDefault[] = "make-chrome-default";
90 
91 // Tells installer to expect to be run as a subsidiary to an MSI.
92 const char kMsi[] = "msi";
93 
94 // Useful only when used with --update-setup-exe, otherwise ignored. It
95 // specifies the full path where updated setup.exe will be stored.
96 const char kNewSetupExe[] = "new-setup-exe";
97 
98 // Notify the installer that the OS has been upgraded.
99 const char kOnOsUpgrade[] = "on-os-upgrade";
100 
101 // Applies a binary patch to a file. The input, patch, and the output file are
102 // specified as command line arguments following the --patch switch.
103 // Ex: --patch=courgette --input_file='input' --patch_file='patch'
104 //        --output_file='output'
105 const char kOutputFile[] = "output-file";
106 const char kPatch[] = "patch";
107 const char kPatchFile[] = "patch-file";
108 
109 // Provide the previous version that patch is for.
110 const char kPreviousVersion[] = "previous-version";
111 
112 // Requests that setup attempt to reenable autoupdates for Chrome.
113 const char kReenableAutoupdates[] = "reenable-autoupdates";
114 
115 // Register Chrome as a valid browser on the current system. This option
116 // requires that setup.exe is running as admin. If this option is specified,
117 // options kInstallArchive and kUninstall are ignored.
118 const char kRegisterChromeBrowser[] = "register-chrome-browser";
119 
120 // Used by the installer to forward the registration suffix of the
121 // (un)installation in progress when launching an elevated setup.exe to finish
122 // registration work.
123 const char kRegisterChromeBrowserSuffix[] = "register-chrome-browser-suffix";
124 
125 // Specify the path to the dev build of chrome.exe the user wants to install
126 // (register and install Start menu shortcut for) on the system. This will
127 // always result in a user-level install and will make this install default
128 // browser.
129 const char kRegisterDevChrome[] = "register-dev-chrome";
130 
131 // Switch to allow an extra URL protocol to be registered. This option is used
132 // in conjunction with kRegisterChromeBrowser to specify an extra protocol
133 // in addition to the standard set of protocols.
134 const char kRegisterURLProtocol[] = "register-url-protocol";
135 
136 // Removes Chrome registration from current machine. Requires admin rights.
137 const char kRemoveChromeRegistration[] = "remove-chrome-registration";
138 
139 // Renames chrome.exe to old_chrome.exe and renames new_chrome.exe to chrome.exe
140 // to support in-use updates. Also deletes opv key.
141 const char kRenameChromeExe[] = "rename-chrome-exe";
142 
143 // When we try to relaunch setup.exe as admin on Vista, we append this command
144 // line flag so that we try the launch only once.
145 const char kRunAsAdmin[] = "run-as-admin";
146 
147 // Combined with --uninstall, signals to setup.exe that this uninstall was
148 // triggered by a self-destructing Chrome.
149 const char kSelfDestruct[] = "self-destruct";
150 
151 // Show the embedded EULA dialog.
152 const char kShowEula[] = "show-eula";
153 
154 // Saves the specified device management token to the registry.
155 const char kStoreDMToken[] = "store-dmtoken";
156 
157 // Install Chrome to system wise location. The default is per user install.
158 const char kSystemLevel[] = "system-level";
159 
160 // Signals to setup.exe that it should trigger the active setup command.
161 const char kTriggerActiveSetup[] = "trigger-active-setup";
162 
163 // Use the given uncompressed chrome.7z archive as the source of files to
164 // install.
165 const char kUncompressedArchive[] = "uncompressed-archive";
166 
167 // If present, setup will uninstall chrome.
168 const char kUninstall[] = "uninstall";
169 
170 // Also see --new-setup-exe. This command line option specifies a diff patch
171 // that setup.exe will apply to itself and store the resulting binary in the
172 // path given by --new-setup-exe.
173 const char kUpdateSetupExe[] = "update-setup-exe";
174 
175 // Enable verbose logging (info level).
176 const char kVerboseLogging[] = "verbose-logging";
177 
178 }  // namespace switches
179 
180 namespace env_vars {
181 
182 // The presence of this environment variable with a value of 1 implies that
183 // setup.exe should run as a system installation regardless of what is on the
184 // command line.
185 const char kGoogleUpdateIsMachineEnvVar[] = "GoogleUpdateIsMachine";
186 
187 }  // namespace env_vars
188 
189 // The Active Setup executable will be an identical copy of setup.exe; this is
190 // necessary because Windows' installer detection heuristics (which include
191 // things like process name being "setup.exe") will otherwise force elevation
192 // for non-admin users when setup.exe is launched. This is mitigated by adding
193 // requestedExecutionLevel="asInvoker" to setup.exe's manifest on Vista+, but
194 // there is no such manifest entry on Windows XP (which results in
195 // crbug.com/166473).
196 // TODO(gab): Rename setup.exe itself altogether and use the same binary for
197 // Active Setup.
198 const wchar_t kActiveSetupExe[] = L"chrmstp.exe";
199 const wchar_t kChromeDll[] = L"chrome.dll";
200 const wchar_t kChromeExe[] = L"chrome.exe";
201 const wchar_t kChromeNewExe[] = L"new_chrome.exe";
202 const wchar_t kChromeOldExe[] = L"old_chrome.exe";
203 const wchar_t kChromeProxyExe[] = L"chrome_proxy.exe";
204 const wchar_t kChromeProxyNewExe[] = L"new_chrome_proxy.exe";
205 const wchar_t kChromeProxyOldExe[] = L"old_chrome_proxy.exe";
206 const wchar_t kCmdOnOsUpgrade[] = L"on-os-upgrade";
207 const wchar_t kCmdStoreDMToken[] = L"store-dmtoken";
208 const wchar_t kEulaSentinelFile[] = L"EULA Accepted";
209 const wchar_t kInstallBinaryDir[] = L"Application";
210 const wchar_t kInstallerDir[] = L"Installer";
211 const wchar_t kInstallTempDir[] = L"Temp";
212 const wchar_t kLnkExt[] = L".lnk";
213 const wchar_t kNaClExe[] = L"nacl64.exe";
214 const wchar_t kNotificationHelperExe[] = L"notification_helper.exe";
215 const wchar_t kSetupExe[] = L"setup.exe";
216 const wchar_t kUninstallStringField[] = L"UninstallString";
217 const wchar_t kUninstallArgumentsField[] = L"UninstallArguments";
218 const wchar_t kUninstallDisplayNameField[] = L"DisplayName";
219 const wchar_t kUninstallInstallationDate[] = L"installation_date";
220 
221 // Elevation Service constants.
222 const base::FilePath::CharType kElevationServiceExe[] =
223     FILE_PATH_LITERAL("elevation_service.exe");
224 
225 // Google Update installer result API.
226 const wchar_t kInstallerError[] = L"InstallerError";
227 const wchar_t kInstallerExtraCode1[] = L"InstallerExtraCode1";
228 const wchar_t kInstallerResult[] = L"InstallerResult";
229 const wchar_t kInstallerResultUIString[] = L"InstallerResultUIString";
230 const wchar_t kInstallerSuccessLaunchCmdLine[] =
231     L"InstallerSuccessLaunchCmdLine";
232 
233 // Chrome channel display names.
234 const wchar_t kChromeChannelUnknown[] = L"unknown";
235 const wchar_t kChromeChannelCanary[] = L"canary";
236 const wchar_t kChromeChannelDev[] = L"dev";
237 const wchar_t kChromeChannelBeta[] = L"beta";
238 const wchar_t kChromeChannelStable[] = L"";
239 const wchar_t kChromeChannelStableExplicit[] = L"stable";
240 
241 const size_t kMaxAppModelIdLength = 64U;
242 
243 const char kSetupHistogramAllocatorName[] = "SetupMetrics";
244 
245 }  // namespace installer
246