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> |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 } | 108 } |
109 | 109 |
110 BrowserDistribution::Type | 110 BrowserDistribution::Type |
111 InstallationValidator::ChromeAppHostRules::distribution_type() const { | 111 InstallationValidator::ChromeAppHostRules::distribution_type() const { |
112 return BrowserDistribution::CHROME_APP_HOST; | 112 return BrowserDistribution::CHROME_APP_HOST; |
113 } | 113 } |
114 | 114 |
115 void InstallationValidator::ChromeAppHostRules::AddUninstallSwitchExpectations( | 115 void InstallationValidator::ChromeAppHostRules::AddUninstallSwitchExpectations( |
116 const ProductContext& ctx, | 116 const ProductContext& ctx, |
117 SwitchExpectations* expectations) const { | 117 SwitchExpectations* expectations) const { |
118 DCHECK(!ctx.system_install); | |
119 | |
120 // --app-launcher must be present. | 118 // --app-launcher must be present. |
121 expectations->push_back( | 119 expectations->push_back( |
122 std::make_pair(std::string(switches::kChromeAppLauncher), true)); | 120 std::make_pair(std::string(switches::kChromeAppLauncher), true)); |
123 | 121 |
124 // --chrome must not be present. | 122 // --chrome must not be present. |
125 expectations->push_back(std::make_pair(std::string(switches::kChrome), | 123 expectations->push_back(std::make_pair(std::string(switches::kChrome), |
126 false)); | 124 false)); |
127 // --chrome-frame must not be present. | 125 // --chrome-frame must not be present. |
128 expectations->push_back(std::make_pair(std::string(switches::kChromeFrame), | 126 expectations->push_back(std::make_pair(std::string(switches::kChromeFrame), |
129 false)); | 127 false)); |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 | 858 |
861 // Is Chrome App Host installed? | 859 // Is Chrome App Host installed? |
862 product_state = | 860 product_state = |
863 machine_state.GetProductState(system_level, | 861 machine_state.GetProductState(system_level, |
864 BrowserDistribution::CHROME_APP_HOST); | 862 BrowserDistribution::CHROME_APP_HOST); |
865 if (product_state != NULL) { | 863 if (product_state != NULL) { |
866 ChromeAppHostRules chrome_app_host_rules; | 864 ChromeAppHostRules chrome_app_host_rules; |
867 ValidateProduct(machine_state, system_level, *product_state, | 865 ValidateProduct(machine_state, system_level, *product_state, |
868 chrome_app_host_rules, &rock_on); | 866 chrome_app_host_rules, &rock_on); |
869 *type = static_cast<InstallationType>(*type | ProductBits::CHROME_APP_HOST); | 867 *type = static_cast<InstallationType>(*type | ProductBits::CHROME_APP_HOST); |
870 if (system_level) { | |
871 LOG(ERROR) << | |
872 "Chrome App Launcher must not be installed at system level."; | |
873 rock_on = false; | |
874 } | |
875 if (!product_state->is_multi_install()) { | 868 if (!product_state->is_multi_install()) { |
876 LOG(ERROR) << "Chrome App Launcher must always be multi-install."; | 869 LOG(ERROR) << "Chrome App Launcher must always be multi-install."; |
877 rock_on = false; | 870 rock_on = false; |
878 } | 871 } |
879 } | 872 } |
880 | 873 |
881 DCHECK_NE(std::find(&kInstallationTypes[0], | 874 DCHECK_NE(std::find(&kInstallationTypes[0], |
882 &kInstallationTypes[arraysize(kInstallationTypes)], | 875 &kInstallationTypes[arraysize(kInstallationTypes)], |
883 *type), | 876 *type), |
884 &kInstallationTypes[arraysize(kInstallationTypes)]) | 877 &kInstallationTypes[arraysize(kInstallationTypes)]) |
885 << "Invalid combination of products found on system (" << *type << ")"; | 878 << "Invalid combination of products found on system (" << *type << ")"; |
886 | 879 |
887 return rock_on; | 880 return rock_on; |
888 } | 881 } |
889 | 882 |
890 // static | 883 // static |
891 bool InstallationValidator::ValidateInstallationType(bool system_level, | 884 bool InstallationValidator::ValidateInstallationType(bool system_level, |
892 InstallationType* type) { | 885 InstallationType* type) { |
893 DCHECK(type); | 886 DCHECK(type); |
894 InstallationState machine_state; | 887 InstallationState machine_state; |
895 | 888 |
896 machine_state.Initialize(); | 889 machine_state.Initialize(); |
897 | 890 |
898 return ValidateInstallationTypeForState(machine_state, system_level, type); | 891 return ValidateInstallationTypeForState(machine_state, system_level, type); |
899 } | 892 } |
900 | 893 |
901 } // namespace installer | 894 } // namespace installer |
OLD | NEW |