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

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

Issue 10665002: Implement installation of the Chrome App Host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: A basic working app host installer/uninstaller. Created 8 years, 5 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 | Annotate | Revision Log
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 #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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 verbose_logging_ = false; 104 verbose_logging_ = false;
105 105
106 if (!prefs.GetBool(master_preferences::kMultiInstall, &pref_bool)) 106 if (!prefs.GetBool(master_preferences::kMultiInstall, &pref_bool))
107 pref_bool = false; 107 pref_bool = false;
108 set_package_type(pref_bool ? MULTI_PACKAGE : SINGLE_PACKAGE); 108 set_package_type(pref_bool ? MULTI_PACKAGE : SINGLE_PACKAGE);
109 109
110 if (!prefs.GetBool(master_preferences::kMsi, &msi_)) 110 if (!prefs.GetBool(master_preferences::kMsi, &msi_))
111 msi_ = false; 111 msi_ = false;
112 112
113 const bool is_uninstall = command_line.HasSwitch(switches::kUninstall); 113 const bool is_uninstall = command_line.HasSwitch(switches::kUninstall);
114 114
grt (UTC plus 2) 2012/07/12 18:37:10 suggestion: add this here const wchar_t* const o
115 if (prefs.install_chrome()) { 115 if (prefs.install_chrome()) {
116 Product* p = 116 Product* p =
117 AddProductFromPreferences(BrowserDistribution::CHROME_BROWSER, prefs, 117 AddProductFromPreferences(BrowserDistribution::CHROME_BROWSER, prefs,
118 machine_state); 118 machine_state);
119 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") 119 VLOG(1) << (is_uninstall ? "Uninstall" : "Install")
120 << " distribution: " << p->distribution()->GetAppShortCutName(); 120 << " distribution: " << p->distribution()->GetAppShortCutName();
121 } 121 }
122 if (prefs.install_chrome_frame()) { 122 if (prefs.install_chrome_frame()) {
123 Product* p = 123 Product* p =
124 AddProductFromPreferences(BrowserDistribution::CHROME_FRAME, prefs, 124 AddProductFromPreferences(BrowserDistribution::CHROME_FRAME, prefs,
125 machine_state); 125 machine_state);
126 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") 126 VLOG(1) << (is_uninstall ? "Uninstall" : "Install")
127 << " distribution: " << p->distribution()->GetAppShortCutName(); 127 << " distribution: " << p->distribution()->GetAppShortCutName();
128 } 128 }
129 if (prefs.install_chrome_app_host()) {
130 Product* p =
131 AddProductFromPreferences(BrowserDistribution::CHROME_APP_HOST, prefs,
132 machine_state);
133 VLOG(1) << (is_uninstall ? "Uninstall" : "Install")
134 << " distribution: " << p->distribution()->GetAppShortCutName();
135 }
129 136
137 if (is_uninstall && prefs.is_multi_install()) {
138 bool keep_binaries = false;
139 // Look for a product that is not the binaries and that is not being
140 // uninstalled. If not found, binaries are uninstalled too.
141 for (size_t i = 0; i < BrowserDistribution::kNumProductTypes; ++i) {
142 if (BrowserDistribution::kProductTypes[i] ==
143 BrowserDistribution::CHROME_BINARIES) {
144 continue;
145 }
146
147 if (machine_state.GetProductState(
148 system_install(),
149 BrowserDistribution::kProductTypes[i]) == NULL) {
150 // The product is not installed.
151 continue;
152 }
153
154 // The product is installed.
155
156 if (!FindProduct(BrowserDistribution::kProductTypes[i])) {
157 // The product is not being uninstalled.
158 keep_binaries = true;
159 break;
160 }
161
162 // The product is being uninstalled.
163 }
164 if (!keep_binaries) {
165 Product* p =
166 AddProductFromPreferences(BrowserDistribution::CHROME_BINARIES, prefs,
167 machine_state);
168 VLOG(1) << (is_uninstall ? "Uninstall" : "Install")
169 << " distribution: " << p->distribution()->GetAppShortCutName();
170 }
171 }
172
130 BrowserDistribution* operand = NULL; 173 BrowserDistribution* operand = NULL;
131 174
132 if (is_uninstall) { 175 if (is_uninstall) {
133 operation_ = UNINSTALL; 176 operation_ = UNINSTALL;
134 } else if (!prefs.is_multi_install()) { 177 } else if (!prefs.is_multi_install()) {
135 // For a single-install, the current browser dist is the operand. 178 // For a single-install, the current browser dist is the operand.
136 operand = BrowserDistribution::GetDistribution(); 179 operand = BrowserDistribution::GetDistribution();
137 operation_ = SINGLE_INSTALL_OR_UPDATE; 180 operation_ = SINGLE_INSTALL_OR_UPDATE;
138 } else if (IsMultiInstallUpdate(prefs, machine_state)) { 181 } else if (IsMultiInstallUpdate(prefs, machine_state)) {
139 // Updates driven by Google Update take place under the multi-installer's 182 // Updates driven by Google Update take place under the multi-installer's
140 // app guid. 183 // app guid.
141 operand = multi_package_distribution_; 184 operand = multi_package_distribution_;
142 operation_ = MULTI_UPDATE; 185 operation_ = MULTI_UPDATE;
143 } else { 186 } else {
144 // Initial and over installs will always take place under one of the 187 // Initial and over installs will always take place under one of the
145 // product app guids. Chrome Frame's will be used if only Chrome Frame 188 // product app guids. Chrome Frame's will be used if only Chrome Frame
grt (UTC plus 2) 2012/07/12 18:37:10 is this comment out of date now? is there such th
erikwright (departed) 2012/07/16 20:13:11 Not driven by Google Update per se, but the App Ho
146 // is being installed. In all other cases, Chrome's is used. 189 // is being installed. In all other cases, Chrome's is used.
147 operation_ = MULTI_INSTALL; 190 operation_ = MULTI_INSTALL;
148 } 191 }
149 192
150 if (operand == NULL) { 193 if (operand == NULL) {
194 BrowserDistribution::Type operand_distribution_type =
195 BrowserDistribution::CHROME_BINARIES;
196 if (prefs.install_chrome())
197 operand_distribution_type = BrowserDistribution::CHROME_BROWSER;
198 else if (prefs.install_chrome_frame())
199 operand_distribution_type = BrowserDistribution::CHROME_FRAME;
200 else if (prefs.install_chrome_app_host())
201 operand_distribution_type = BrowserDistribution::CHROME_APP_HOST;
202 else
203 NOTREACHED();
204
151 operand = BrowserDistribution::GetSpecificDistribution( 205 operand = BrowserDistribution::GetSpecificDistribution(
152 prefs.install_chrome() ? 206 operand_distribution_type);
153 BrowserDistribution::CHROME_BROWSER :
154 BrowserDistribution::CHROME_FRAME);
155 } 207 }
156 208
157 state_key_ = operand->GetStateKey(); 209 state_key_ = operand->GetStateKey();
158 state_type_ = operand->GetType(); 210 state_type_ = operand->GetType();
159 211
160 // Parse --critical-update-version=W.X.Y.Z 212 // Parse --critical-update-version=W.X.Y.Z
161 std::string critical_version_value( 213 std::string critical_version_value(
162 command_line.GetSwitchValueASCII(switches::kCriticalUpdateVersion)); 214 command_line.GetSwitchValueASCII(switches::kCriticalUpdateVersion));
163 critical_update_version_ = Version(critical_version_value); 215 critical_update_version_ = Version(critical_version_value);
164 } 216 }
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 if (is_multi_install()) { 669 if (is_multi_install()) {
618 InstallUtil::AddInstallerResultItems( 670 InstallUtil::AddInstallerResultItems(
619 system_install, multi_package_binaries_distribution()->GetStateKey(), 671 system_install, multi_package_binaries_distribution()->GetStateKey(),
620 status, string_resource_id, launch_cmd, install_list.get()); 672 status, string_resource_id, launch_cmd, install_list.get());
621 } 673 }
622 if (!install_list->Do()) 674 if (!install_list->Do())
623 LOG(ERROR) << "Failed to record installer error information in registry."; 675 LOG(ERROR) << "Failed to record installer error information in registry.";
624 } 676 }
625 677
626 } // namespace installer 678 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698