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

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

Issue 15908002: Differential updates for components. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 <windows.h> 5 #include <windows.h>
6 #include <msi.h> 6 #include <msi.h>
7 #include <shellapi.h> 7 #include <shellapi.h>
8 #include <shlobj.h> 8 #include <shlobj.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/at_exit.h" 12 #include "base/at_exit.h"
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/file_util.h" 15 #include "base/file_util.h"
16 #include "base/file_version_info.h" 16 #include "base/file_version_info.h"
17 #include "base/files/file_path.h"
17 #include "base/files/scoped_temp_dir.h" 18 #include "base/files/scoped_temp_dir.h"
18 #include "base/path_service.h" 19 #include "base/path_service.h"
19 #include "base/process_util.h" 20 #include "base/process_util.h"
20 #include "base/string16.h" 21 #include "base/string16.h"
21 #include "base/string_util.h" 22 #include "base/string_util.h"
22 #include "base/stringprintf.h" 23 #include "base/stringprintf.h"
23 #include "base/strings/string_number_conversions.h" 24 #include "base/strings/string_number_conversions.h"
24 #include "base/utf_string_conversions.h" 25 #include "base/utf_string_conversions.h"
25 #include "base/values.h" 26 #include "base/values.h"
26 #include "base/win/registry.h" 27 #include "base/win/registry.h"
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 } 485 }
485 486
486 // Checks app host pre-install conditions, specifically that this is a 487 // Checks app host pre-install conditions, specifically that this is a
487 // user-level multi-install. When the pre-install conditions are not 488 // user-level multi-install. When the pre-install conditions are not
488 // satisfied, the result is written to the registry (via WriteInstallerResult), 489 // satisfied, the result is written to the registry (via WriteInstallerResult),
489 // |status| is set appropriately, and false is returned. 490 // |status| is set appropriately, and false is returned.
490 bool CheckAppHostPreconditions(const InstallationState& original_state, 491 bool CheckAppHostPreconditions(const InstallationState& original_state,
491 InstallerState* installer_state, 492 InstallerState* installer_state,
492 installer::InstallStatus* status) { 493 installer::InstallStatus* status) {
493 if (installer_state->FindProduct(BrowserDistribution::CHROME_APP_HOST)) { 494 if (installer_state->FindProduct(BrowserDistribution::CHROME_APP_HOST)) {
494
495 if (!installer_state->is_multi_install()) { 495 if (!installer_state->is_multi_install()) {
496 LOG(DFATAL) << "App Launcher requires multi install"; 496 LOG(DFATAL) << "App Launcher requires multi install";
497 *status = installer::APP_HOST_REQUIRES_MULTI_INSTALL; 497 *status = installer::APP_HOST_REQUIRES_MULTI_INSTALL;
498 // No message string since there is nothing a user can do. 498 // No message string since there is nothing a user can do.
499 installer_state->WriteInstallerResult(*status, 0, NULL); 499 installer_state->WriteInstallerResult(*status, 0, NULL);
500 return false; 500 return false;
501 } 501 }
502 502
503 if (installer_state->system_install()) { 503 if (installer_state->system_install()) {
504 LOG(DFATAL) << "App Launcher may only be installed at user-level."; 504 LOG(DFATAL) << "App Launcher may only be installed at user-level.";
505 *status = installer::APP_HOST_REQUIRES_USER_LEVEL; 505 *status = installer::APP_HOST_REQUIRES_USER_LEVEL;
506 // No message string since there is nothing a user can do. 506 // No message string since there is nothing a user can do.
507 installer_state->WriteInstallerResult(*status, 0, NULL); 507 installer_state->WriteInstallerResult(*status, 0, NULL);
508 return false; 508 return false;
509 } 509 }
510
511 } 510 }
512 511
513 return true; 512 return true;
514 } 513 }
515 514
516 // Checks for compatibility between the current state of the system and the 515 // Checks for compatibility between the current state of the system and the
517 // desired operation. Also applies policy that mutates the desired operation; 516 // desired operation. Also applies policy that mutates the desired operation;
518 // specifically, the |installer_state| object. 517 // specifically, the |installer_state| object.
519 // Also blocks simultaneous user-level and system-level installs. In the case 518 // Also blocks simultaneous user-level and system-level installs. In the case
520 // of trying to install user-level Chrome when system-level exists, the 519 // of trying to install user-level Chrome when system-level exists, the
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 installer::ChromeFrameReadyModeTempOptOut(original_state, 1464 installer::ChromeFrameReadyModeTempOptOut(original_state,
1466 *installer_state)); 1465 *installer_state));
1467 } else if (cmd_line.HasSwitch( 1466 } else if (cmd_line.HasSwitch(
1468 installer::switches::kChromeFrameReadyModeEndTempOptOut)) { 1467 installer::switches::kChromeFrameReadyModeEndTempOptOut)) {
1469 *exit_code = InstallUtil::GetInstallReturnCode( 1468 *exit_code = InstallUtil::GetInstallReturnCode(
1470 installer::ChromeFrameReadyModeEndTempOptOut(original_state, 1469 installer::ChromeFrameReadyModeEndTempOptOut(original_state,
1471 *installer_state)); 1470 *installer_state));
1472 } else if (cmd_line.HasSwitch(installer::switches::kChromeFrameQuickEnable)) { 1471 } else if (cmd_line.HasSwitch(installer::switches::kChromeFrameQuickEnable)) {
1473 *exit_code = installer::ChromeFrameQuickEnable(original_state, 1472 *exit_code = installer::ChromeFrameQuickEnable(original_state,
1474 installer_state); 1473 installer_state);
1475 } else { 1474 } else if (cmd_line.HasSwitch(installer::switches::kPatch)) {
1476 handled = false; 1475 const std::string patch_type_str(
1476 cmd_line.GetSwitchValueASCII(installer::switches::kPatch));
1477 const base::FilePath input_file(
1478 cmd_line.GetSwitchValuePath(installer::switches::kInputFile));
1479 const base::FilePath patch_file(
1480 cmd_line.GetSwitchValuePath(installer::switches::kPatchFile));
1481 const base::FilePath output_file(
1482 cmd_line.GetSwitchValuePath(installer::switches::kOutputFile));
1483
1484 if (patch_type_str == installer::switches::kCourgette) {
1485 *exit_code = installer::CourgettePatchFiles(input_file,
1486 patch_file,
1487 output_file);
1488 } else if (patch_type_str == installer::switches::kBsdiff) {
1489 *exit_code = installer::BsdiffPatchFiles(input_file,
1490 patch_file,
1491 output_file);
1492 } else {
1493 *exit_code = installer::PATCH_INVALID_ARGUMENTS;
1494 }
1477 } 1495 }
1478 1496
1479 return handled; 1497 return handled;
1480 } 1498 }
1481 1499
1482 bool ShowRebootDialog() { 1500 bool ShowRebootDialog() {
1483 // Get a token for this process. 1501 // Get a token for this process.
1484 HANDLE token; 1502 HANDLE token;
1485 if (!OpenProcessToken(GetCurrentProcess(), 1503 if (!OpenProcessToken(GetCurrentProcess(),
1486 TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, 1504 TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1727 if (!(installer_state.is_msi() && is_uninstall)) 1745 if (!(installer_state.is_msi() && is_uninstall))
1728 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT 1746 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT
1729 // to pass through, since this is only returned on uninstall which is 1747 // to pass through, since this is only returned on uninstall which is
1730 // never invoked directly by Google Update. 1748 // never invoked directly by Google Update.
1731 return_code = InstallUtil::GetInstallReturnCode(install_status); 1749 return_code = InstallUtil::GetInstallReturnCode(install_status);
1732 1750
1733 VLOG(1) << "Installation complete, returning: " << return_code; 1751 VLOG(1) << "Installation complete, returning: " << return_code;
1734 1752
1735 return return_code; 1753 return return_code;
1736 } 1754 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698