OLD | NEW |
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" | |
15 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
16 #include "base/version.h" | 15 #include "base/version.h" |
17 #include "base/win/registry.h" | |
18 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/installer/util/browser_distribution.h" | 17 #include "chrome/installer/util/browser_distribution.h" |
20 #include "chrome/installer/util/google_update_constants.h" | 18 #include "chrome/installer/util/google_update_constants.h" |
21 #include "chrome/installer/util/helper.h" | 19 #include "chrome/installer/util/helper.h" |
22 #include "chrome/installer/util/install_util.h" | |
23 #include "chrome/installer/util/installation_state.h" | 20 #include "chrome/installer/util/installation_state.h" |
24 #include "chrome/installer/util/updating_app_registration_data.h" | |
25 | 21 |
26 namespace installer { | 22 namespace installer { |
27 | 23 |
28 BrowserDistribution::Type | 24 BrowserDistribution::Type |
29 InstallationValidator::ChromeRules::distribution_type() const { | 25 InstallationValidator::ChromeRules::distribution_type() const { |
30 return BrowserDistribution::CHROME_BROWSER; | 26 return BrowserDistribution::CHROME_BROWSER; |
31 } | 27 } |
32 | 28 |
33 void InstallationValidator::ChromeRules::AddUninstallSwitchExpectations( | 29 void InstallationValidator::ChromeRules::AddUninstallSwitchExpectations( |
34 const ProductContext& ctx, | 30 const ProductContext& ctx, |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 if (product_state != NULL) { | 545 if (product_state != NULL) { |
550 ChromeRules chrome_rules; | 546 ChromeRules chrome_rules; |
551 ValidateProduct(machine_state, system_level, *product_state, | 547 ValidateProduct(machine_state, system_level, *product_state, |
552 chrome_rules, &rock_on); | 548 chrome_rules, &rock_on); |
553 *type = static_cast<InstallationType>( | 549 *type = static_cast<InstallationType>( |
554 *type | (product_state->is_multi_install() ? | 550 *type | (product_state->is_multi_install() ? |
555 ProductBits::CHROME_MULTI : | 551 ProductBits::CHROME_MULTI : |
556 ProductBits::CHROME_SINGLE)); | 552 ProductBits::CHROME_SINGLE)); |
557 } | 553 } |
558 | 554 |
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 | |
583 // Is Chrome Frame installed? | 555 // Is Chrome Frame installed? |
584 product_state = | 556 product_state = |
585 machine_state.GetProductState(system_level, | 557 machine_state.GetProductState(system_level, |
586 BrowserDistribution::CHROME_FRAME); | 558 BrowserDistribution::CHROME_FRAME); |
587 if (product_state != NULL) { | 559 if (product_state != NULL) { |
588 ChromeFrameRules chrome_frame_rules; | 560 ChromeFrameRules chrome_frame_rules; |
589 ValidateProduct(machine_state, system_level, *product_state, | 561 ValidateProduct(machine_state, system_level, *product_state, |
590 chrome_frame_rules, &rock_on); | 562 chrome_frame_rules, &rock_on); |
591 int cf_bit = !product_state->is_multi_install() ? | 563 int cf_bit = !product_state->is_multi_install() ? |
592 ProductBits::CHROME_FRAME_SINGLE : | 564 ProductBits::CHROME_FRAME_SINGLE : |
(...skipping 15 matching lines...) Expand all Loading... |
608 InstallationType* type) { | 580 InstallationType* type) { |
609 DCHECK(type); | 581 DCHECK(type); |
610 InstallationState machine_state; | 582 InstallationState machine_state; |
611 | 583 |
612 machine_state.Initialize(); | 584 machine_state.Initialize(); |
613 | 585 |
614 return ValidateInstallationTypeForState(machine_state, system_level, type); | 586 return ValidateInstallationTypeForState(machine_state, system_level, type); |
615 } | 587 } |
616 | 588 |
617 } // namespace installer | 589 } // namespace installer |
OLD | NEW |