Chromium Code Reviews| 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 #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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 package_type_(UNKNOWN_PACKAGE_TYPE), | 87 package_type_(UNKNOWN_PACKAGE_TYPE), |
| 88 state_type_(BrowserDistribution::CHROME_BROWSER), | 88 state_type_(BrowserDistribution::CHROME_BROWSER), |
| 89 root_key_(NULL), | 89 root_key_(NULL), |
| 90 msi_(false), | 90 msi_(false), |
| 91 verbose_logging_(false), | 91 verbose_logging_(false), |
| 92 ensure_google_update_present_(false) { | 92 ensure_google_update_present_(false) { |
| 93 // Use set_level() so that root_key_ is updated properly. | 93 // Use set_level() so that root_key_ is updated properly. |
| 94 set_level(level); | 94 set_level(level); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void InstallerState::Initialize(const CommandLine& command_line, | 97 bool InstallerState::Initialize(const CommandLine& command_line, |
| 98 const MasterPreferences& prefs, | 98 const MasterPreferences& prefs, |
| 99 const InstallationState& machine_state) { | 99 const InstallationState& machine_state) { |
| 100 bool pref_bool; | 100 bool pref_bool; |
| 101 if (!prefs.GetBool(master_preferences::kSystemLevel, &pref_bool)) | 101 if (!prefs.GetBool(master_preferences::kSystemLevel, &pref_bool)) |
| 102 pref_bool = false; | 102 pref_bool = false; |
| 103 set_level(pref_bool ? SYSTEM_LEVEL : USER_LEVEL); | 103 set_level(pref_bool ? SYSTEM_LEVEL : USER_LEVEL); |
| 104 | 104 |
| 105 if (!prefs.GetBool(master_preferences::kVerboseLogging, &verbose_logging_)) | 105 if (!prefs.GetBool(master_preferences::kVerboseLogging, &verbose_logging_)) |
| 106 verbose_logging_ = false; | 106 verbose_logging_ = false; |
| 107 | 107 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 124 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") | 124 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") |
| 125 << " distribution: " << p->distribution()->GetAppShortCutName(); | 125 << " distribution: " << p->distribution()->GetAppShortCutName(); |
| 126 } | 126 } |
| 127 if (prefs.install_chrome_frame()) { | 127 if (prefs.install_chrome_frame()) { |
| 128 Product* p = | 128 Product* p = |
| 129 AddProductFromPreferences(BrowserDistribution::CHROME_FRAME, prefs, | 129 AddProductFromPreferences(BrowserDistribution::CHROME_FRAME, prefs, |
| 130 machine_state); | 130 machine_state); |
| 131 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") | 131 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") |
| 132 << " distribution: " << p->distribution()->GetAppShortCutName(); | 132 << " distribution: " << p->distribution()->GetAppShortCutName(); |
| 133 } | 133 } |
| 134 if (prefs.install_chrome_app_host()) { | 134 if (prefs.install_chrome_app_launcher() || prefs.install_chrome_app_host()) { |
|
erikwright (departed)
2012/10/25 02:23:03
It seems OK to me just to simplify this by treatin
huangs
2012/10/29 21:15:16
Done. So --app-host + --app-launcher = --app-launc
| |
| 135 // TODO(huangs): Revisit all these once App Launcher is default. | |
| 136 if (prefs.install_chrome_app_launcher() && | |
| 137 prefs.install_chrome_app_host()) { | |
| 138 LOG(ERROR) << "Cannot have --" << installer::switches::kChromeAppHost | |
| 139 << " with --" << installer::switches::kChromeAppLauncher; | |
| 140 return false; | |
| 141 } | |
| 142 | |
| 135 Product* p = | 143 Product* p = |
| 136 AddProductFromPreferences(BrowserDistribution::CHROME_APP_HOST, prefs, | 144 AddProductFromPreferences(BrowserDistribution::CHROME_APP_HOST, prefs, |
| 137 machine_state); | 145 machine_state); |
| 138 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") | 146 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") |
| 139 << " distribution: " << p->distribution()->GetAppShortCutName(); | 147 << " distribution: " << p->distribution()->GetAppShortCutName(); |
| 140 } | 148 } |
| 141 | 149 |
| 142 if (!is_uninstall && is_multi_install()) { | 150 if (!is_uninstall && is_multi_install()) { |
| 143 bool need_binaries = false; | 151 bool need_binaries = false; |
| 144 if (FindProduct(BrowserDistribution::CHROME_APP_HOST)) { | 152 if (FindProduct(BrowserDistribution::CHROME_APP_HOST)) { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 operand_distribution_type); | 285 operand_distribution_type); |
| 278 } | 286 } |
| 279 | 287 |
| 280 state_key_ = operand->GetStateKey(); | 288 state_key_ = operand->GetStateKey(); |
| 281 state_type_ = operand->GetType(); | 289 state_type_ = operand->GetType(); |
| 282 | 290 |
| 283 // Parse --critical-update-version=W.X.Y.Z | 291 // Parse --critical-update-version=W.X.Y.Z |
| 284 std::string critical_version_value( | 292 std::string critical_version_value( |
| 285 command_line.GetSwitchValueASCII(switches::kCriticalUpdateVersion)); | 293 command_line.GetSwitchValueASCII(switches::kCriticalUpdateVersion)); |
| 286 critical_update_version_ = Version(critical_version_value); | 294 critical_update_version_ = Version(critical_version_value); |
| 295 return true; | |
| 287 } | 296 } |
| 288 | 297 |
| 289 void InstallerState::set_level(Level level) { | 298 void InstallerState::set_level(Level level) { |
| 290 level_ = level; | 299 level_ = level; |
| 291 switch (level) { | 300 switch (level) { |
| 292 case USER_LEVEL: | 301 case USER_LEVEL: |
| 293 root_key_ = HKEY_CURRENT_USER; | 302 root_key_ = HKEY_CURRENT_USER; |
| 294 break; | 303 break; |
| 295 case SYSTEM_LEVEL: | 304 case SYSTEM_LEVEL: |
| 296 root_key_ = HKEY_LOCAL_MACHINE; | 305 root_key_ = HKEY_LOCAL_MACHINE; |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 740 if (is_multi_install()) { | 749 if (is_multi_install()) { |
| 741 InstallUtil::AddInstallerResultItems( | 750 InstallUtil::AddInstallerResultItems( |
| 742 system_install, multi_package_binaries_distribution()->GetStateKey(), | 751 system_install, multi_package_binaries_distribution()->GetStateKey(), |
| 743 status, string_resource_id, launch_cmd, install_list.get()); | 752 status, string_resource_id, launch_cmd, install_list.get()); |
| 744 } | 753 } |
| 745 if (!install_list->Do()) | 754 if (!install_list->Do()) |
| 746 LOG(ERROR) << "Failed to record installer error information in registry."; | 755 LOG(ERROR) << "Failed to record installer error information in registry."; |
| 747 } | 756 } |
| 748 | 757 |
| 749 } // namespace installer | 758 } // namespace installer |
| OLD | NEW |