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

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

Issue 869153004: Support migrating multi-install Chrome to single-install. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: verifier fix Created 5 years, 10 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
« no previous file with comments | « chrome/installer/setup/setup_main.cc ('k') | chrome/installer/util/installer_state.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Implementation of the installation validator. 5 // Implementation of the installation validator.
6 6
7 #include "chrome/installer/util/installation_validator.h" 7 #include "chrome/installer/util/installation_validator.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 12
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/strings/string16.h"
14 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
15 #include "base/version.h" 16 #include "base/version.h"
17 #include "base/win/registry.h"
16 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
17 #include "chrome/installer/util/browser_distribution.h" 19 #include "chrome/installer/util/browser_distribution.h"
18 #include "chrome/installer/util/google_update_constants.h" 20 #include "chrome/installer/util/google_update_constants.h"
19 #include "chrome/installer/util/helper.h" 21 #include "chrome/installer/util/helper.h"
22 #include "chrome/installer/util/install_util.h"
20 #include "chrome/installer/util/installation_state.h" 23 #include "chrome/installer/util/installation_state.h"
24 #include "chrome/installer/util/updating_app_registration_data.h"
21 25
22 namespace installer { 26 namespace installer {
23 27
24 BrowserDistribution::Type 28 BrowserDistribution::Type
25 InstallationValidator::ChromeRules::distribution_type() const { 29 InstallationValidator::ChromeRules::distribution_type() const {
26 return BrowserDistribution::CHROME_BROWSER; 30 return BrowserDistribution::CHROME_BROWSER;
27 } 31 }
28 32
29 void InstallationValidator::ChromeRules::AddUninstallSwitchExpectations( 33 void InstallationValidator::ChromeRules::AddUninstallSwitchExpectations(
30 const ProductContext& ctx, 34 const ProductContext& ctx,
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 if (product_state != NULL) { 549 if (product_state != NULL) {
546 ChromeRules chrome_rules; 550 ChromeRules chrome_rules;
547 ValidateProduct(machine_state, system_level, *product_state, 551 ValidateProduct(machine_state, system_level, *product_state,
548 chrome_rules, &rock_on); 552 chrome_rules, &rock_on);
549 *type = static_cast<InstallationType>( 553 *type = static_cast<InstallationType>(
550 *type | (product_state->is_multi_install() ? 554 *type | (product_state->is_multi_install() ?
551 ProductBits::CHROME_MULTI : 555 ProductBits::CHROME_MULTI :
552 ProductBits::CHROME_SINGLE)); 556 ProductBits::CHROME_SINGLE));
553 } 557 }
554 558
559 #if defined(GOOGLE_CHROME_BUILD)
560 if (!InstallUtil::IsChromeSxSProcess()) {
561 // Usage of the app launcher is tracked alongside Chrome.
562 const HKEY root_key = system_level ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
563 base::string16 launcher_key(
564 UpdatingAppRegistrationData(kAppLauncherGuid).GetVersionKey());
565 base::win::RegKey key(root_key, launcher_key.c_str(),
566 KEY_QUERY_VALUE | KEY_WOW64_32KEY);
567 bool have_launcher =
568 key.Valid() && key.HasValue(google_update::kRegVersionField);
569
570 BrowserDistribution* chrome_dist =
571 BrowserDistribution::GetSpecificDistribution(
572 BrowserDistribution::CHROME_BROWSER);
573 if (!have_launcher) {
574 LOG_IF(ERROR, product_state) << "App launcher is not installed with "
575 << chrome_dist->GetDisplayName();
576 } else {
577 LOG_IF(ERROR, !product_state) << "App launcher is installed without "
578 << chrome_dist->GetDisplayName();
579 }
580 }
581 #endif // GOOGLE_CHROME_BUILD
582
555 // Is Chrome Frame installed? 583 // Is Chrome Frame installed?
556 product_state = 584 product_state =
557 machine_state.GetProductState(system_level, 585 machine_state.GetProductState(system_level,
558 BrowserDistribution::CHROME_FRAME); 586 BrowserDistribution::CHROME_FRAME);
559 if (product_state != NULL) { 587 if (product_state != NULL) {
560 ChromeFrameRules chrome_frame_rules; 588 ChromeFrameRules chrome_frame_rules;
561 ValidateProduct(machine_state, system_level, *product_state, 589 ValidateProduct(machine_state, system_level, *product_state,
562 chrome_frame_rules, &rock_on); 590 chrome_frame_rules, &rock_on);
563 int cf_bit = !product_state->is_multi_install() ? 591 int cf_bit = !product_state->is_multi_install() ?
564 ProductBits::CHROME_FRAME_SINGLE : 592 ProductBits::CHROME_FRAME_SINGLE :
(...skipping 15 matching lines...) Expand all
580 InstallationType* type) { 608 InstallationType* type) {
581 DCHECK(type); 609 DCHECK(type);
582 InstallationState machine_state; 610 InstallationState machine_state;
583 611
584 machine_state.Initialize(); 612 machine_state.Initialize();
585 613
586 return ValidateInstallationTypeForState(machine_state, system_level, type); 614 return ValidateInstallationTypeForState(machine_state, system_level, type);
587 } 615 }
588 616
589 } // namespace installer 617 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/setup/setup_main.cc ('k') | chrome/installer/util/installer_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698