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

Side by Side Diff: chrome/installer/util/installer_state.cc

Issue 8517012: Add support for --critical-update-version to installer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/installer/util/installer_state.h" 5 #include "chrome/installer/util/installer_state.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 149
150 if (operand == NULL) { 150 if (operand == NULL) {
151 operand = BrowserDistribution::GetSpecificDistribution( 151 operand = BrowserDistribution::GetSpecificDistribution(
152 prefs.install_chrome() ? 152 prefs.install_chrome() ?
153 BrowserDistribution::CHROME_BROWSER : 153 BrowserDistribution::CHROME_BROWSER :
154 BrowserDistribution::CHROME_FRAME); 154 BrowserDistribution::CHROME_FRAME);
155 } 155 }
156 156
157 state_key_ = operand->GetStateKey(); 157 state_key_ = operand->GetStateKey();
158 state_type_ = operand->GetType(); 158 state_type_ = operand->GetType();
159
160 // Parse --critical-update-version=W.X.Y.Z
161 std::string critical_version_value(
162 command_line.GetSwitchValueASCII(switches::kCriticalUpdateVersion));
163 critical_update_version_ = Version(critical_version_value);
159 } 164 }
160 165
161 void InstallerState::set_level(Level level) { 166 void InstallerState::set_level(Level level) {
162 level_ = level; 167 level_ = level;
163 switch (level) { 168 switch (level) {
164 case USER_LEVEL: 169 case USER_LEVEL:
165 root_key_ = HKEY_CURRENT_USER; 170 root_key_ = HKEY_CURRENT_USER;
166 break; 171 break;
167 case SYSTEM_LEVEL: 172 case SYSTEM_LEVEL:
168 root_key_ = HKEY_LOCAL_MACHINE; 173 root_key_ = HKEY_LOCAL_MACHINE;
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 411
407 if (version == NULL) 412 if (version == NULL)
408 version = &product_state->version(); 413 version = &product_state->version();
409 414
410 current_version.reset(version->Clone()); 415 current_version.reset(version->Clone());
411 } 416 }
412 417
413 return current_version.release(); 418 return current_version.release();
414 } 419 }
415 420
421 Version InstallerState::DetermineCriticalVersion(
422 const Version* current_version,
423 const Version& new_version) const {
424 DCHECK(current_version == NULL || current_version->IsValid());
425 DCHECK(new_version.IsValid());
426 if (critical_update_version_.IsValid() &&
427 (current_version == NULL ||
428 (current_version->CompareTo(critical_update_version_) < 0)) &&
429 new_version.CompareTo(critical_update_version_) >= 0) {
430 return critical_update_version_;
431 }
432 return Version();
433 }
434
416 bool InstallerState::IsChromeFrameRunning( 435 bool InstallerState::IsChromeFrameRunning(
417 const InstallationState& machine_state) const { 436 const InstallationState& machine_state) const {
418 // We check only for the current version (e.g. the version we are upgrading 437 // We check only for the current version (e.g. the version we are upgrading
419 // _from_). We don't need to check interstitial versions if any (as would 438 // _from_). We don't need to check interstitial versions if any (as would
420 // occur in the case of multiple updates) since if they are in use, we are 439 // occur in the case of multiple updates) since if they are in use, we are
421 // guaranteed that the current version is in use too. 440 // guaranteed that the current version is in use too.
422 bool in_use = false; 441 bool in_use = false;
423 scoped_ptr<Version> current_version(GetCurrentVersion(machine_state)); 442 scoped_ptr<Version> current_version(GetCurrentVersion(machine_state));
424 if (current_version != NULL) { 443 if (current_version != NULL) {
425 FilePath cf_install_path( 444 FilePath cf_install_path(
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 if (is_multi_install()) { 617 if (is_multi_install()) {
599 InstallUtil::AddInstallerResultItems( 618 InstallUtil::AddInstallerResultItems(
600 system_install, multi_package_binaries_distribution()->GetStateKey(), 619 system_install, multi_package_binaries_distribution()->GetStateKey(),
601 status, string_resource_id, launch_cmd, install_list.get()); 620 status, string_resource_id, launch_cmd, install_list.get());
602 } 621 }
603 if (!install_list->Do()) 622 if (!install_list->Do())
604 LOG(ERROR) << "Failed to record installer error information in registry."; 623 LOG(ERROR) << "Failed to record installer error information in registry.";
605 } 624 }
606 625
607 } // namespace installer 626 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698