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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 | 71 |
| 72 InstallerState::InstallerState() | 72 InstallerState::InstallerState() |
| 73 : operation_(UNINITIALIZED), | 73 : operation_(UNINITIALIZED), |
| 74 multi_package_distribution_(NULL), | 74 multi_package_distribution_(NULL), |
| 75 level_(UNKNOWN_LEVEL), | 75 level_(UNKNOWN_LEVEL), |
| 76 package_type_(UNKNOWN_PACKAGE_TYPE), | 76 package_type_(UNKNOWN_PACKAGE_TYPE), |
| 77 state_type_(BrowserDistribution::CHROME_BROWSER), | 77 state_type_(BrowserDistribution::CHROME_BROWSER), |
| 78 root_key_(NULL), | 78 root_key_(NULL), |
| 79 msi_(false), | 79 msi_(false), |
| 80 verbose_logging_(false), | 80 verbose_logging_(false), |
| 81 ensure_google_update_present_(false) { | 81 ensure_google_update_present_(false), |
| 82 create_app_launcher_shortcuts_(false) { | |
| 82 } | 83 } |
| 83 | 84 |
| 84 InstallerState::InstallerState(Level level) | 85 InstallerState::InstallerState(Level level) |
| 85 : operation_(UNINITIALIZED), | 86 : operation_(UNINITIALIZED), |
| 86 multi_package_distribution_(NULL), | 87 multi_package_distribution_(NULL), |
| 87 level_(UNKNOWN_LEVEL), | 88 level_(UNKNOWN_LEVEL), |
| 88 package_type_(UNKNOWN_PACKAGE_TYPE), | 89 package_type_(UNKNOWN_PACKAGE_TYPE), |
| 89 state_type_(BrowserDistribution::CHROME_BROWSER), | 90 state_type_(BrowserDistribution::CHROME_BROWSER), |
| 90 root_key_(NULL), | 91 root_key_(NULL), |
| 91 msi_(false), | 92 msi_(false), |
| 92 verbose_logging_(false), | 93 verbose_logging_(false), |
| 93 ensure_google_update_present_(false) { | 94 ensure_google_update_present_(false), |
| 95 create_app_launcher_shortcuts_(false) { | |
| 94 // Use set_level() so that root_key_ is updated properly. | 96 // Use set_level() so that root_key_ is updated properly. |
| 95 set_level(level); | 97 set_level(level); |
| 96 } | 98 } |
| 97 | 99 |
| 98 void InstallerState::Initialize(const CommandLine& command_line, | 100 void InstallerState::Initialize(const CommandLine& command_line, |
| 99 const MasterPreferences& prefs, | 101 const MasterPreferences& prefs, |
| 100 const InstallationState& machine_state) { | 102 const InstallationState& machine_state) { |
| 101 bool pref_bool; | 103 bool pref_bool; |
| 102 if (!prefs.GetBool(master_preferences::kSystemLevel, &pref_bool)) | 104 if (!prefs.GetBool(master_preferences::kSystemLevel, &pref_bool)) |
| 103 pref_bool = false; | 105 pref_bool = false; |
| 104 set_level(pref_bool ? SYSTEM_LEVEL : USER_LEVEL); | 106 set_level(pref_bool ? SYSTEM_LEVEL : USER_LEVEL); |
| 105 | 107 |
| 106 if (!prefs.GetBool(master_preferences::kVerboseLogging, &verbose_logging_)) | 108 if (!prefs.GetBool(master_preferences::kVerboseLogging, &verbose_logging_)) |
| 107 verbose_logging_ = false; | 109 verbose_logging_ = false; |
| 108 | 110 |
| 109 if (!prefs.GetBool(master_preferences::kMultiInstall, &pref_bool)) | 111 if (!prefs.GetBool(master_preferences::kMultiInstall, &pref_bool)) |
| 110 pref_bool = false; | 112 pref_bool = false; |
| 111 set_package_type(pref_bool ? MULTI_PACKAGE : SINGLE_PACKAGE); | 113 set_package_type(pref_bool ? MULTI_PACKAGE : SINGLE_PACKAGE); |
| 112 | 114 |
| 113 if (!prefs.GetBool(master_preferences::kMsi, &msi_)) | 115 if (!prefs.GetBool(master_preferences::kMsi, &msi_)) |
| 114 msi_ = false; | 116 msi_ = false; |
| 115 | 117 |
| 116 ensure_google_update_present_ = | 118 ensure_google_update_present_ = |
| 117 command_line.HasSwitch(installer::switches::kEnsureGoogleUpdatePresent); | 119 command_line.HasSwitch(installer::switches::kEnsureGoogleUpdatePresent); |
| 118 | 120 |
| 119 const bool is_uninstall = command_line.HasSwitch(switches::kUninstall); | 121 const bool is_uninstall = command_line.HasSwitch(switches::kUninstall); |
| 120 | 122 |
| 121 if (prefs.install_chrome()) { | 123 // App Launcher and Chrome are unified. |
|
gab
2013/04/29 20:25:41
The Chrome product (i.e. the shortcuts) is always
huangs
2013/04/30 14:01:49
This is the main premise of the Chrome / App Launc
| |
| 122 Product* p = AddProductFromPreferences( | 124 if (prefs.install_chrome() || prefs.install_chrome_app_launcher()) { |
| 125 Product* p1 = AddProductFromPreferences( | |
| 123 BrowserDistribution::CHROME_BROWSER, prefs, machine_state); | 126 BrowserDistribution::CHROME_BROWSER, prefs, machine_state); |
| 124 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") | 127 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") |
| 125 << " distribution: " << p->distribution()->GetAppShortCutName(); | 128 << " distribution: " << p1->distribution()->GetAppShortCutName(); |
| 129 | |
| 130 if (is_multi_install()) { | |
| 131 Product* p2 = AddProductFromPreferences( | |
| 132 BrowserDistribution::CHROME_APP_HOST, prefs, machine_state); | |
| 133 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") | |
| 134 << " distribution: " << p2->distribution()->GetAppShortCutName(); | |
| 135 } | |
| 126 } | 136 } |
| 137 // TODO(huangs): Remove by M29. | |
| 138 // Create App Launcher shortcuts if --app-launcher is specified. | |
| 139 create_app_launcher_shortcuts_ = prefs.install_chrome_app_launcher(); | |
| 140 | |
| 127 if (prefs.install_chrome_frame()) { | 141 if (prefs.install_chrome_frame()) { |
| 128 Product* p = AddProductFromPreferences( | 142 Product* p = AddProductFromPreferences( |
| 129 BrowserDistribution::CHROME_FRAME, prefs, machine_state); | 143 BrowserDistribution::CHROME_FRAME, prefs, machine_state); |
| 130 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") | 144 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") |
| 131 << " distribution: " << p->distribution()->GetAppShortCutName(); | 145 << " distribution: " << p->distribution()->GetAppShortCutName(); |
| 132 } | 146 } |
| 133 | 147 |
| 134 if (prefs.install_chrome_app_launcher()) { | |
| 135 Product* p = AddProductFromPreferences( | |
| 136 BrowserDistribution::CHROME_APP_HOST, prefs, machine_state); | |
| 137 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") | |
| 138 << " distribution: " << p->distribution()->GetAppShortCutName(); | |
| 139 } | |
| 140 | |
| 141 if (!is_uninstall && is_multi_install()) { | 148 if (!is_uninstall && is_multi_install()) { |
| 142 bool need_binaries = false; | 149 bool need_binaries = false; |
| 143 if (FindProduct(BrowserDistribution::CHROME_APP_HOST)) { | 150 // Chrome/Chrome Frame/App Launcher multi need Binaries at their own level. |
| 144 // App Host will happily use Chrome at system level, or binaries at system | |
| 145 // level, even if app host is user level. | |
| 146 const ProductState* chrome_state = machine_state.GetProductState( | |
| 147 true, // system level | |
| 148 BrowserDistribution::CHROME_BROWSER); | |
| 149 // If Chrome is at system-level, multi- or otherwise. We'll use it. | |
| 150 if (!chrome_state) { | |
| 151 const ProductState* binaries_state = machine_state.GetProductState( | |
| 152 true, // system level | |
| 153 BrowserDistribution::CHROME_BINARIES); | |
| 154 if (!binaries_state) | |
| 155 need_binaries = true; | |
| 156 } | |
| 157 } | |
| 158 | |
| 159 // Chrome/Chrome Frame multi need Binaries at their own level. | |
| 160 if (FindProduct(BrowserDistribution::CHROME_BROWSER)) | 151 if (FindProduct(BrowserDistribution::CHROME_BROWSER)) |
| 161 need_binaries = true; | 152 need_binaries = true; |
| 162 | 153 |
| 163 if (FindProduct(BrowserDistribution::CHROME_FRAME)) | 154 if (FindProduct(BrowserDistribution::CHROME_FRAME)) |
| 164 need_binaries = true; | 155 need_binaries = true; |
| 165 | 156 |
| 157 if (FindProduct(BrowserDistribution::CHROME_APP_HOST)) | |
|
gab
2013/04/29 20:25:41
Why does CHROME_APP_HOST even still exist if it is
huangs
2013/04/30 14:01:49
Because we need to create the Omaha Product / Prod
| |
| 158 need_binaries = true; | |
| 159 | |
| 166 if (need_binaries && !FindProduct(BrowserDistribution::CHROME_BINARIES)) { | 160 if (need_binaries && !FindProduct(BrowserDistribution::CHROME_BINARIES)) { |
| 167 // Force binaries to be installed/updated. | 161 // Force binaries to be installed/updated. |
| 168 Product* p = AddProductFromPreferences( | 162 Product* p = AddProductFromPreferences( |
| 169 BrowserDistribution::CHROME_BINARIES, prefs, machine_state); | 163 BrowserDistribution::CHROME_BINARIES, prefs, machine_state); |
| 170 VLOG(1) << "Install distribution: " | 164 VLOG(1) << "Install distribution: " |
| 171 << p->distribution()->GetAppShortCutName(); | 165 << p->distribution()->GetAppShortCutName(); |
| 172 } | 166 } |
| 173 } | 167 } |
| 174 | 168 |
| 175 if (is_uninstall && prefs.is_multi_install()) { | 169 if (is_uninstall && prefs.is_multi_install()) { |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 790 } | 784 } |
| 791 if (!install_list->Do()) | 785 if (!install_list->Do()) |
| 792 LOG(ERROR) << "Failed to record installer error information in registry."; | 786 LOG(ERROR) << "Failed to record installer error information in registry."; |
| 793 } | 787 } |
| 794 | 788 |
| 795 bool InstallerState::RequiresActiveSetup() const { | 789 bool InstallerState::RequiresActiveSetup() const { |
| 796 return system_install() && FindProduct(BrowserDistribution::CHROME_BROWSER); | 790 return system_install() && FindProduct(BrowserDistribution::CHROME_BROWSER); |
| 797 } | 791 } |
| 798 | 792 |
| 799 } // namespace installer | 793 } // namespace installer |
| OLD | NEW |