Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(698)

Side by Side Diff: chrome/installer/setup/setup_main.cc

Issue 165382: Merge 22284 - Refactoring of master preferences parsing before adding a new p... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/installer/setup/install.cc ('k') | chrome/installer/util/browser_distribution.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:mergeinfo
Merged /branches/chrome_webkit_merge_branch/chrome/installer/setup/setup_main.cc:r69-2775
Merged /trunk/src/chrome/installer/setup/setup_main.cc:r22284
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 #include <windows.h> 6 #include <windows.h>
7 #include <msi.h> 7 #include <msi.h>
8 #include <shlobj.h> 8 #include <shlobj.h>
9 9
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 LOG(ERROR) << "Renaming of executables failed. Rolling back any changes."; 199 LOG(ERROR) << "Renaming of executables failed. Rolling back any changes.";
200 install_list->Rollback(); 200 install_list->Rollback();
201 ret = installer_util::RENAME_FAILED; 201 ret = installer_util::RENAME_FAILED;
202 } 202 }
203 file_util::Delete(temp_path, true); 203 file_util::Delete(temp_path, true);
204 return ret; 204 return ret;
205 } 205 }
206 206
207 // Parse command line and read master profile, if present, to get distribution 207 // Parse command line and read master profile, if present, to get distribution
208 // related install options. 208 // related install options.
209 int GetInstallOptions(const CommandLine& cmd_line) { 209 DictionaryValue* GetInstallPreferences(const CommandLine& cmd_line) {
210 int options = 0; 210 DictionaryValue* prefs = NULL;
211 int preferences = 0;
212 211
213 if (cmd_line.HasSwitch(installer_util::switches::kInstallerData)) { 212 if (cmd_line.HasSwitch(installer_util::switches::kInstallerData)) {
214 std::wstring prefs_path = cmd_line.GetSwitchValue( 213 FilePath prefs_path(
215 installer_util::switches::kInstallerData); 214 cmd_line.GetSwitchValue(installer_util::switches::kInstallerData));
216 preferences = installer_util::ParseDistributionPreferences(prefs_path); 215 prefs = installer_util::ParseDistributionPreferences(prefs_path);
217 if ((preferences & installer_util::MASTER_PROFILE_NOT_FOUND) == 0) {
218 options |= installer_util::MASTER_PROFILE_PRESENT;
219 if ((preferences & installer_util::MASTER_PROFILE_ERROR) == 0)
220 options |= installer_util::MASTER_PROFILE_VALID;
221 }
222 // While there is a --show-eula command line flag, we don't process
223 // it in this function because it requires special handling.
224 if (preferences & installer_util::MASTER_PROFILE_REQUIRE_EULA)
225 options |= installer_util::SHOW_EULA_DIALOG;
226 } 216 }
227 217
228 if (preferences & installer_util::MASTER_PROFILE_CREATE_ALL_SHORTCUTS || 218 if (!prefs)
229 cmd_line.HasSwitch(installer_util::switches::kCreateAllShortcuts)) 219 prefs = new DictionaryValue();
230 options |= installer_util::CREATE_ALL_SHORTCUTS;
231 220
232 if (preferences & installer_util::MASTER_PROFILE_DO_NOT_LAUNCH_CHROME || 221 if (cmd_line.HasSwitch(installer_util::switches::kCreateAllShortcuts))
233 cmd_line.HasSwitch(installer_util::switches::kDoNotLaunchChrome)) 222 installer_util::SetDistroBooleanPreference(
234 options |= installer_util::DO_NOT_LAUNCH_CHROME; 223 prefs, installer_util::master_preferences::kCreateAllShortcuts, true);
235 224
236 if (preferences & installer_util::MASTER_PROFILE_MAKE_CHROME_DEFAULT || 225 if (cmd_line.HasSwitch(installer_util::switches::kDoNotLaunchChrome))
237 cmd_line.HasSwitch(installer_util::switches::kMakeChromeDefault)) 226 installer_util::SetDistroBooleanPreference(
238 options |= installer_util::MAKE_CHROME_DEFAULT; 227 prefs, installer_util::master_preferences::kDoNotLaunchChrome, true);
239 228
240 if (preferences & installer_util::MASTER_PROFILE_SYSTEM_LEVEL || 229 if (cmd_line.HasSwitch(installer_util::switches::kMakeChromeDefault))
241 cmd_line.HasSwitch(installer_util::switches::kSystemLevel)) 230 installer_util::SetDistroBooleanPreference(
242 options |= installer_util::SYSTEM_LEVEL; 231 prefs, installer_util::master_preferences::kMakeChromeDefault, true);
243 232
244 if (preferences & installer_util::MASTER_PROFILE_VERBOSE_LOGGING || 233 if (cmd_line.HasSwitch(installer_util::switches::kSystemLevel))
245 cmd_line.HasSwitch(installer_util::switches::kVerboseLogging)) 234 installer_util::SetDistroBooleanPreference(
246 options |= installer_util::VERBOSE_LOGGING; 235 prefs, installer_util::master_preferences::kSystemLevel, true);
247 236
248 if (preferences & installer_util::MASTER_PROFILE_ALT_SHORTCUT_TXT || 237 if (cmd_line.HasSwitch(installer_util::switches::kVerboseLogging))
249 cmd_line.HasSwitch(installer_util::switches::kAltDesktopShortcut)) 238 installer_util::SetDistroBooleanPreference(
250 options |= installer_util::ALT_DESKTOP_SHORTCUT; 239 prefs, installer_util::master_preferences::kVerboseLogging, true);
251 240
252 return options; 241 if (cmd_line.HasSwitch(installer_util::switches::kAltDesktopShortcut))
242 installer_util::SetDistroBooleanPreference(
243 prefs, installer_util::master_preferences::kAltShortcutText, true);
244
245 return prefs;
253 } 246 }
254 247
255 // Copy master preference file if provided to installer to the same path 248 // Copy master preferences file provided to installer, in the same folder
256 // of chrome.exe so Chrome first run can find it. 249 // as chrome.exe so Chrome first run can find it. This function will be called
257 // This function will be called only when Chrome is launched the first time. 250 // only on the first install of Chrome.
258 void CopyPreferenceFileForFirstRun(int options, const CommandLine& cmd_line) { 251 void CopyPreferenceFileForFirstRun(bool system_level,
259 if (options & installer_util::MASTER_PROFILE_VALID) { 252 const CommandLine& cmd_line) {
260 std::wstring prefs_source_path = cmd_line.GetSwitchValue( 253 std::wstring prefs_source_path = cmd_line.GetSwitchValue(
261 installer_util::switches::kInstallerData); 254 installer_util::switches::kInstallerData);
262 bool system_install = (options & installer_util::SYSTEM_LEVEL) != 0; 255 std::wstring prefs_dest_path(
263 std::wstring prefs_dest_path( 256 installer::GetChromeInstallPath(system_level));
264 installer::GetChromeInstallPath(system_install)); 257 file_util::AppendToPath(&prefs_dest_path,
265 file_util::AppendToPath(&prefs_dest_path, 258 installer_util::kDefaultMasterPrefs);
266 installer_util::kDefaultMasterPrefs); 259 if (!file_util::CopyFile(prefs_source_path, prefs_dest_path))
267 if (!file_util::CopyFile(prefs_source_path, prefs_dest_path)) 260 LOG(ERROR) << "failed copying master profile";
268 LOG(ERROR) << "failed copying master profile";
269 }
270 } 261 }
271 262
272 bool CheckPreInstallConditions(const installer::Version* installed_version, 263 bool CheckPreInstallConditions(const installer::Version* installed_version,
273 int options, 264 bool system_install,
274 installer_util::InstallStatus& status) { 265 installer_util::InstallStatus& status) {
275 bool system_install = (options & installer_util::SYSTEM_LEVEL) != 0;
276
277 // Check to avoid simultaneous per-user and per-machine installs. 266 // Check to avoid simultaneous per-user and per-machine installs.
278 scoped_ptr<installer::Version> 267 scoped_ptr<installer::Version>
279 chrome_version(InstallUtil::GetChromeVersion(!system_install)); 268 chrome_version(InstallUtil::GetChromeVersion(!system_install));
280 if (chrome_version.get()) { 269 if (chrome_version.get()) {
281 LOG(ERROR) << "Already installed version " << chrome_version->GetString() 270 LOG(ERROR) << "Already installed version " << chrome_version->GetString()
282 << " conflicts with the current install mode."; 271 << " conflicts with the current install mode.";
283 status = system_install ? installer_util::USER_LEVEL_INSTALL_EXISTS : 272 status = system_install ? installer_util::USER_LEVEL_INSTALL_EXISTS :
284 installer_util::SYSTEM_LEVEL_INSTALL_EXISTS; 273 installer_util::SYSTEM_LEVEL_INSTALL_EXISTS;
285 int str_id = system_install ? IDS_INSTALL_USER_LEVEL_EXISTS_BASE : 274 int str_id = system_install ? IDS_INSTALL_USER_LEVEL_EXISTS_BASE :
286 IDS_INSTALL_SYSTEM_LEVEL_EXISTS_BASE; 275 IDS_INSTALL_SYSTEM_LEVEL_EXISTS_BASE;
(...skipping 14 matching lines...) Expand all
301 int str_id = IDS_INSTALL_DIR_IN_USE_BASE; 290 int str_id = IDS_INSTALL_DIR_IN_USE_BASE;
302 InstallUtil::WriteInstallerResult(system_install, status, str_id, NULL); 291 InstallUtil::WriteInstallerResult(system_install, status, str_id, NULL);
303 return false; 292 return false;
304 } 293 }
305 } 294 }
306 295
307 return true; 296 return true;
308 } 297 }
309 298
310 installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, 299 installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line,
311 const installer::Version* installed_version, int options) { 300 const installer::Version* installed_version, const DictionaryValue* prefs) {
301 bool system_level = installer_util::GetDistroBooleanPreference(prefs,
302 installer_util::master_preferences::kSystemLevel);
312 installer_util::InstallStatus install_status = installer_util::UNKNOWN_STATUS; 303 installer_util::InstallStatus install_status = installer_util::UNKNOWN_STATUS;
313 if (!CheckPreInstallConditions(installed_version, options, install_status)) 304 if (!CheckPreInstallConditions(installed_version,
305 system_level, install_status))
314 return install_status; 306 return install_status;
315 307
316 bool system_install = (options & installer_util::SYSTEM_LEVEL) != 0;
317 // For install the default location for chrome.packed.7z is in current 308 // For install the default location for chrome.packed.7z is in current
318 // folder, so get that value first. 309 // folder, so get that value first.
319 std::wstring archive = file_util::GetDirectoryFromPath(cmd_line.program()); 310 std::wstring archive = file_util::GetDirectoryFromPath(cmd_line.program());
320 file_util::AppendToPath(&archive, 311 file_util::AppendToPath(&archive,
321 std::wstring(installer::kChromeCompressedArchive)); 312 std::wstring(installer::kChromeCompressedArchive));
322 // If --install-archive is given, get the user specified value 313 // If --install-archive is given, get the user specified value
323 if (cmd_line.HasSwitch(installer_util::switches::kInstallArchive)) { 314 if (cmd_line.HasSwitch(installer_util::switches::kInstallArchive)) {
324 archive = cmd_line.GetSwitchValue( 315 archive = cmd_line.GetSwitchValue(
325 installer_util::switches::kInstallArchive); 316 installer_util::switches::kInstallArchive);
326 } 317 }
327 LOG(INFO) << "Archive found to install Chrome " << archive; 318 LOG(INFO) << "Archive found to install Chrome " << archive;
328 319
329 // Create a temp folder where we will unpack Chrome archive. If it fails, 320 // Create a temp folder where we will unpack Chrome archive. If it fails,
330 // then we are doomed, so return immediately and no cleanup is required. 321 // then we are doomed, so return immediately and no cleanup is required.
331 std::wstring temp_path; 322 std::wstring temp_path;
332 if (!file_util::CreateNewTempDirectory(std::wstring(L"chrome_"), 323 if (!file_util::CreateNewTempDirectory(std::wstring(L"chrome_"),
333 &temp_path)) { 324 &temp_path)) {
334 LOG(ERROR) << "Could not create temporary path."; 325 LOG(ERROR) << "Could not create temporary path.";
335 InstallUtil::WriteInstallerResult(system_install, 326 InstallUtil::WriteInstallerResult(system_level,
336 installer_util::TEMP_DIR_FAILED, 327 installer_util::TEMP_DIR_FAILED,
337 IDS_INSTALL_TEMP_DIR_FAILED_BASE, 328 IDS_INSTALL_TEMP_DIR_FAILED_BASE,
338 NULL); 329 NULL);
339 return installer_util::TEMP_DIR_FAILED; 330 return installer_util::TEMP_DIR_FAILED;
340 } 331 }
341 LOG(INFO) << "created path " << temp_path; 332 LOG(INFO) << "created path " << temp_path;
342 333
343 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 334 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
344 std::wstring unpack_path(temp_path); 335 std::wstring unpack_path(temp_path);
345 file_util::AppendToPath(&unpack_path, 336 file_util::AppendToPath(&unpack_path,
346 std::wstring(installer::kInstallSourceDir)); 337 std::wstring(installer::kInstallSourceDir));
347 bool incremental_install = false; 338 bool incremental_install = false;
348 if (UnPackArchive(archive, system_install, installed_version, 339 if (UnPackArchive(archive, system_level, installed_version,
349 temp_path, unpack_path, incremental_install)) { 340 temp_path, unpack_path, incremental_install)) {
350 install_status = installer_util::UNCOMPRESSION_FAILED; 341 install_status = installer_util::UNCOMPRESSION_FAILED;
351 InstallUtil::WriteInstallerResult(system_install, install_status, 342 InstallUtil::WriteInstallerResult(system_level, install_status,
352 IDS_INSTALL_UNCOMPRESSION_FAILED_BASE, 343 IDS_INSTALL_UNCOMPRESSION_FAILED_BASE,
353 NULL); 344 NULL);
354 } else { 345 } else {
355 LOG(INFO) << "unpacked to " << unpack_path; 346 LOG(INFO) << "unpacked to " << unpack_path;
356 std::wstring src_path(unpack_path); 347 std::wstring src_path(unpack_path);
357 file_util::AppendToPath(&src_path, 348 file_util::AppendToPath(&src_path,
358 std::wstring(installer::kInstallSourceChromeDir)); 349 std::wstring(installer::kInstallSourceChromeDir));
359 scoped_ptr<installer::Version> 350 scoped_ptr<installer::Version>
360 installer_version(setup_util::GetVersionFromDir(src_path)); 351 installer_version(setup_util::GetVersionFromDir(src_path));
361 if (!installer_version.get()) { 352 if (!installer_version.get()) {
362 LOG(ERROR) << "Did not find any valid version in installer."; 353 LOG(ERROR) << "Did not find any valid version in installer.";
363 install_status = installer_util::INVALID_ARCHIVE; 354 install_status = installer_util::INVALID_ARCHIVE;
364 InstallUtil::WriteInstallerResult(system_install, install_status, 355 InstallUtil::WriteInstallerResult(system_level, install_status,
365 IDS_INSTALL_INVALID_ARCHIVE_BASE, NULL); 356 IDS_INSTALL_INVALID_ARCHIVE_BASE, NULL);
366 } else { 357 } else {
367 LOG(INFO) << "version to install: " << installer_version->GetString(); 358 LOG(INFO) << "version to install: " << installer_version->GetString();
368 if (installed_version && 359 if (installed_version &&
369 installed_version->IsHigherThan(installer_version.get())) { 360 installed_version->IsHigherThan(installer_version.get())) {
370 LOG(ERROR) << "Higher version is already installed."; 361 LOG(ERROR) << "Higher version is already installed.";
371 install_status = installer_util::HIGHER_VERSION_EXISTS; 362 install_status = installer_util::HIGHER_VERSION_EXISTS;
372 InstallUtil::WriteInstallerResult(system_install, install_status, 363 InstallUtil::WriteInstallerResult(system_level, install_status,
373 IDS_INSTALL_HIGHER_VERSION_BASE, 364 IDS_INSTALL_HIGHER_VERSION_BASE,
374 NULL); 365 NULL);
375 } else { 366 } else {
376 // We want to keep uncompressed archive (chrome.7z) that we get after 367 // We want to keep uncompressed archive (chrome.7z) that we get after
377 // uncompressing and binary patching. Get the location for this file. 368 // uncompressing and binary patching. Get the location for this file.
378 std::wstring archive_to_copy(temp_path); 369 std::wstring archive_to_copy(temp_path);
379 file_util::AppendToPath(&archive_to_copy, 370 file_util::AppendToPath(&archive_to_copy,
380 std::wstring(installer::kChromeArchive)); 371 std::wstring(installer::kChromeArchive));
381 install_status = installer::InstallOrUpdateChrome( 372 install_status = installer::InstallOrUpdateChrome(
382 cmd_line.program(), archive_to_copy, temp_path, options, 373 cmd_line.program(), archive_to_copy, temp_path, prefs,
383 *installer_version, installed_version); 374 *installer_version, installed_version);
384 375
385 int install_msg_base = IDS_INSTALL_FAILED_BASE; 376 int install_msg_base = IDS_INSTALL_FAILED_BASE;
386 std::wstring chrome_exe; 377 std::wstring chrome_exe;
387 if (install_status != installer_util::INSTALL_FAILED) { 378 if (install_status != installer_util::INSTALL_FAILED) {
388 chrome_exe = installer::GetChromeInstallPath(system_install); 379 chrome_exe = installer::GetChromeInstallPath(system_level);
389 if (chrome_exe.empty()) { 380 if (chrome_exe.empty()) {
390 // If we failed to construct install path, it means the OS call to 381 // If we failed to construct install path, it means the OS call to
391 // get %ProgramFiles% or %AppData% failed. Report this as failure. 382 // get %ProgramFiles% or %AppData% failed. Report this as failure.
392 install_msg_base = IDS_INSTALL_OS_ERROR_BASE; 383 install_msg_base = IDS_INSTALL_OS_ERROR_BASE;
393 install_status = installer_util::OS_ERROR; 384 install_status = installer_util::OS_ERROR;
394 } else { 385 } else {
395 file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe); 386 file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe);
396 chrome_exe = L"\"" + chrome_exe + L"\""; 387 chrome_exe = L"\"" + chrome_exe + L"\"";
397 install_msg_base = 0; 388 install_msg_base = 0;
398 } 389 }
399 } 390 }
400 InstallUtil::WriteInstallerResult(system_install, install_status, 391 InstallUtil::WriteInstallerResult(system_level, install_status,
401 install_msg_base, &chrome_exe); 392 install_msg_base, &chrome_exe);
402 if (install_status == installer_util::FIRST_INSTALL_SUCCESS) { 393 if (install_status == installer_util::FIRST_INSTALL_SUCCESS) {
403 LOG(INFO) << "First install successful."; 394 LOG(INFO) << "First install successful.";
404 CopyPreferenceFileForFirstRun(options, cmd_line); 395 CopyPreferenceFileForFirstRun(system_level, cmd_line);
405 // We never want to launch Chrome in system level install mode. 396 // We never want to launch Chrome in system level install mode.
406 if (!(options & installer_util::DO_NOT_LAUNCH_CHROME) && 397 if (!system_level && !installer_util::GetDistroBooleanPreference(prefs ,
407 !(options & installer_util::SYSTEM_LEVEL)) 398 installer_util::master_preferences::kDoNotLaunchChrome))
408 installer::LaunchChrome(system_install); 399 installer::LaunchChrome(system_level);
409 } 400 }
410 } 401 }
411 } 402 }
412 // There might be an experiment (for upgrade usually) that needs to happen. 403 // There might be an experiment (for upgrade usually) that needs to happen.
413 // An experiment's outcome can include chrome's uninstallation. If that is 404 // An experiment's outcome can include chrome's uninstallation. If that is
414 // the case we would not do that directly at this point but in another 405 // the case we would not do that directly at this point but in another
415 // instance of setup.exe 406 // instance of setup.exe
416 dist->LaunchUserExperiment(install_status, *installer_version, 407 dist->LaunchUserExperiment(install_status, *installer_version,
417 system_install, options); 408 system_level);
418 } 409 }
419 410
420 // Delete temporary files. These include install temporary directory 411 // Delete temporary files. These include install temporary directory
421 // and master profile file if present. 412 // and master profile file if present.
422 scoped_ptr<WorkItemList> cleanup_list(WorkItem::CreateWorkItemList()); 413 scoped_ptr<WorkItemList> cleanup_list(WorkItem::CreateWorkItemList());
423 LOG(INFO) << "Deleting temporary directory " << temp_path; 414 LOG(INFO) << "Deleting temporary directory " << temp_path;
424 cleanup_list->AddDeleteTreeWorkItem(temp_path, std::wstring()); 415 cleanup_list->AddDeleteTreeWorkItem(temp_path, std::wstring());
425 if (options & installer_util::MASTER_PROFILE_PRESENT) { 416 if (cmd_line.HasSwitch(installer_util::switches::kInstallerData)) {
426 std::wstring prefs_path = cmd_line.GetSwitchValue( 417 std::wstring prefs_path = cmd_line.GetSwitchValue(
427 installer_util::switches::kInstallerData); 418 installer_util::switches::kInstallerData);
428 cleanup_list->AddDeleteTreeWorkItem(prefs_path, std::wstring()); 419 cleanup_list->AddDeleteTreeWorkItem(prefs_path, std::wstring());
429 } 420 }
430 cleanup_list->Do(); 421 cleanup_list->Do();
431 422
432 dist->UpdateDiffInstallStatus(system_install, incremental_install, 423 dist->UpdateDiffInstallStatus(system_level, incremental_install,
433 install_status); 424 install_status);
434 return install_status; 425 return install_status;
435 } 426 }
436 427
437 installer_util::InstallStatus UninstallChrome(const CommandLine& cmd_line, 428 installer_util::InstallStatus UninstallChrome(const CommandLine& cmd_line,
438 const wchar_t* cmd_params, 429 const wchar_t* cmd_params,
439 const installer::Version* version, 430 const installer::Version* version,
440 bool system_install) { 431 bool system_install) {
441 LOG(INFO) << "Uninstalling Chome"; 432 LOG(INFO) << "Uninstalling Chome";
442 bool force = cmd_line.HasSwitch(installer_util::switches::kForceUninstall); 433 bool force = cmd_line.HasSwitch(installer_util::switches::kForceUninstall);
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 587
597 } // namespace 588 } // namespace
598 589
599 int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, 590 int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
600 wchar_t* command_line, int show_command) { 591 wchar_t* command_line, int show_command) {
601 // The exit manager is in charge of calling the dtors of singletons. 592 // The exit manager is in charge of calling the dtors of singletons.
602 base::AtExitManager exit_manager; 593 base::AtExitManager exit_manager;
603 CommandLine::Init(0, NULL); 594 CommandLine::Init(0, NULL);
604 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); 595 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
605 installer::InitInstallerLogging(parsed_command_line); 596 installer::InitInstallerLogging(parsed_command_line);
606 int options = GetInstallOptions(parsed_command_line); 597 scoped_ptr<DictionaryValue> prefs(GetInstallPreferences(parsed_command_line));
607 if (options & installer_util::VERBOSE_LOGGING) 598 if (installer_util::GetDistroBooleanPreference(prefs.get(),
599 installer_util::master_preferences::kVerboseLogging))
608 logging::SetMinLogLevel(logging::LOG_INFO); 600 logging::SetMinLogLevel(logging::LOG_INFO);
609 601
610 bool system_install = (options & installer_util::SYSTEM_LEVEL) != 0; 602 bool system_install = installer_util::GetDistroBooleanPreference(prefs.get(),
603 installer_util::master_preferences::kSystemLevel);
611 LOG(INFO) << "system install is " << system_install; 604 LOG(INFO) << "system install is " << system_install;
612 605
613 // Check to make sure current system is WinXP or later. If not, log 606 // Check to make sure current system is WinXP or later. If not, log
614 // error message and get out. 607 // error message and get out.
615 if (!InstallUtil::IsOSSupported()) { 608 if (!InstallUtil::IsOSSupported()) {
616 LOG(ERROR) << "Chrome only supports Windows XP or later."; 609 LOG(ERROR) << "Chrome only supports Windows XP or later.";
617 InstallUtil::WriteInstallerResult(system_install, 610 InstallUtil::WriteInstallerResult(system_install,
618 installer_util::OS_NOT_SUPPORTED, 611 installer_util::OS_NOT_SUPPORTED,
619 IDS_INSTALL_OS_NOT_SUPPORTED_BASE, NULL); 612 IDS_INSTALL_OS_NOT_SUPPORTED_BASE, NULL);
620 return installer_util::OS_NOT_SUPPORTED; 613 return installer_util::OS_NOT_SUPPORTED;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 // If --uninstall option is given, uninstall chrome 660 // If --uninstall option is given, uninstall chrome
668 if (parsed_command_line.HasSwitch(installer_util::switches::kUninstall)) { 661 if (parsed_command_line.HasSwitch(installer_util::switches::kUninstall)) {
669 install_status = UninstallChrome(parsed_command_line, 662 install_status = UninstallChrome(parsed_command_line,
670 command_line, 663 command_line,
671 installed_version.get(), 664 installed_version.get(),
672 system_install); 665 system_install);
673 // If --uninstall option is not specified, we assume it is install case. 666 // If --uninstall option is not specified, we assume it is install case.
674 } else { 667 } else {
675 install_status = InstallChrome(parsed_command_line, 668 install_status = InstallChrome(parsed_command_line,
676 installed_version.get(), 669 installed_version.get(),
677 options); 670 prefs.get());
678 } 671 }
679 672
680 CoUninitialize(); 673 CoUninitialize();
681 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 674 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
682 return dist->GetInstallReturnCode(install_status); 675 return dist->GetInstallReturnCode(install_status);
683 } 676 }
OLDNEW
« no previous file with comments | « chrome/installer/setup/install.cc ('k') | chrome/installer/util/browser_distribution.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698