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 // This file contains the definitions of the installer functions that build | 5 // This file contains the definitions of the installer functions that build |
6 // the WorkItemList used to install the application. | 6 // the WorkItemList used to install the application. |
7 | 7 |
8 #include "chrome/installer/setup/install_worker.h" | 8 #include "chrome/installer/setup/install_worker.h" |
9 | 9 |
10 #include <oaidl.h> | 10 #include <oaidl.h> |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 // means that Chrome Frame is being uninstalled, so there's no need to do any | 164 // means that Chrome Frame is being uninstalled, so there's no need to do any |
165 // looping. | 165 // looping. |
166 if (product.is_chrome() && | 166 if (product.is_chrome() && |
167 installer_state.operation() != InstallerState::UNINSTALL) { | 167 installer_state.operation() != InstallerState::UNINSTALL) { |
168 const Product* chrome_frame = | 168 const Product* chrome_frame = |
169 installer_state.FindProduct(BrowserDistribution::CHROME_FRAME); | 169 installer_state.FindProduct(BrowserDistribution::CHROME_FRAME); |
170 if (chrome_frame && chrome_frame->HasOption(kOptionReadyMode)) | 170 if (chrome_frame && chrome_frame->HasOption(kOptionReadyMode)) |
171 chrome_frame->AppendProductFlags(&uninstall_arguments); | 171 chrome_frame->AppendProductFlags(&uninstall_arguments); |
172 } | 172 } |
173 | 173 |
174 std::wstring update_state_key(browser_dist->GetStateKey()); | 174 string16 update_state_key(browser_dist->GetStateKey()); |
175 install_list->AddCreateRegKeyWorkItem(reg_root, update_state_key); | 175 install_list->AddCreateRegKeyWorkItem(reg_root, update_state_key); |
176 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, | 176 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, |
177 installer::kUninstallStringField, installer_path.value(), true); | 177 installer::kUninstallStringField, installer_path.value(), true); |
178 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, | 178 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, |
179 installer::kUninstallArgumentsField, | 179 installer::kUninstallArgumentsField, |
180 uninstall_arguments.GetCommandLineString(), true); | 180 uninstall_arguments.GetCommandLineString(), true); |
181 | 181 |
182 // MSI installations will manage their own uninstall shortcuts. | 182 // MSI installations will manage their own uninstall shortcuts. |
183 if (!installer_state.is_msi() && product.ShouldCreateUninstallEntry()) { | 183 if (!installer_state.is_msi() && product.ShouldCreateUninstallEntry()) { |
184 // We need to quote the command line for the Add/Remove Programs dialog. | 184 // We need to quote the command line for the Add/Remove Programs dialog. |
185 CommandLine quoted_uninstall_cmd(installer_path); | 185 CommandLine quoted_uninstall_cmd(installer_path); |
186 DCHECK_EQ(quoted_uninstall_cmd.GetCommandLineString()[0], '"'); | 186 DCHECK_EQ(quoted_uninstall_cmd.GetCommandLineString()[0], '"'); |
187 quoted_uninstall_cmd.AppendArguments(uninstall_arguments, false); | 187 quoted_uninstall_cmd.AppendArguments(uninstall_arguments, false); |
188 | 188 |
189 std::wstring uninstall_reg = browser_dist->GetUninstallRegPath(); | 189 string16 uninstall_reg = browser_dist->GetUninstallRegPath(); |
190 install_list->AddCreateRegKeyWorkItem(reg_root, uninstall_reg); | 190 install_list->AddCreateRegKeyWorkItem(reg_root, uninstall_reg); |
191 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 191 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, |
192 installer::kUninstallDisplayNameField, | 192 installer::kUninstallDisplayNameField, |
193 browser_dist->GetAppShortCutName(), true); | 193 browser_dist->GetAppShortCutName(), true); |
194 install_list->AddSetRegValueWorkItem(reg_root, | 194 install_list->AddSetRegValueWorkItem(reg_root, |
195 uninstall_reg, installer::kUninstallStringField, | 195 uninstall_reg, installer::kUninstallStringField, |
196 quoted_uninstall_cmd.GetCommandLineString(), true); | 196 quoted_uninstall_cmd.GetCommandLineString(), true); |
197 install_list->AddSetRegValueWorkItem(reg_root, | 197 install_list->AddSetRegValueWorkItem(reg_root, |
198 uninstall_reg, | 198 uninstall_reg, |
199 L"InstallLocation", | 199 L"InstallLocation", |
200 install_path.value(), | 200 install_path.value(), |
201 true); | 201 true); |
202 | 202 |
203 // DisplayIcon, NoModify and NoRepair | 203 // DisplayIcon, NoModify and NoRepair |
204 std::wstring chrome_icon = ShellUtil::GetChromeIcon( | 204 string16 chrome_icon = ShellUtil::GetChromeIcon( |
205 product.distribution(), | 205 product.distribution(), |
206 install_path.Append(installer::kChromeExe).value()); | 206 install_path.Append(installer::kChromeExe).value()); |
207 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 207 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, |
208 L"DisplayIcon", chrome_icon, true); | 208 L"DisplayIcon", chrome_icon, true); |
209 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 209 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, |
210 L"NoModify", static_cast<DWORD>(1), | 210 L"NoModify", static_cast<DWORD>(1), |
211 true); | 211 true); |
212 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, | 212 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, |
213 L"NoRepair", static_cast<DWORD>(1), | 213 L"NoRepair", static_cast<DWORD>(1), |
214 true); | 214 true); |
(...skipping 28 matching lines...) Expand all Loading... | |
243 | 243 |
244 // Create Version key for a product (if not already present) and sets the new | 244 // Create Version key for a product (if not already present) and sets the new |
245 // product version as the last step. | 245 // product version as the last step. |
246 void AddVersionKeyWorkItems(HKEY root, | 246 void AddVersionKeyWorkItems(HKEY root, |
247 BrowserDistribution* dist, | 247 BrowserDistribution* dist, |
248 const Version& new_version, | 248 const Version& new_version, |
249 bool add_language_identifier, | 249 bool add_language_identifier, |
250 WorkItemList* list) { | 250 WorkItemList* list) { |
251 // Create Version key for each distribution (if not already present) and set | 251 // Create Version key for each distribution (if not already present) and set |
252 // the new product version as the last step. | 252 // the new product version as the last step. |
253 std::wstring version_key(dist->GetVersionKey()); | 253 string16 version_key(dist->GetVersionKey()); |
254 list->AddCreateRegKeyWorkItem(root, version_key); | 254 list->AddCreateRegKeyWorkItem(root, version_key); |
255 | 255 |
256 std::wstring product_name(dist->GetAppShortCutName()); | 256 string16 product_name(dist->GetAppShortCutName()); |
257 list->AddSetRegValueWorkItem(root, version_key, google_update::kRegNameField, | 257 list->AddSetRegValueWorkItem(root, version_key, google_update::kRegNameField, |
258 product_name, true); // overwrite name also | 258 product_name, true); // overwrite name also |
259 list->AddSetRegValueWorkItem(root, version_key, | 259 list->AddSetRegValueWorkItem(root, version_key, |
260 google_update::kRegOopcrashesField, | 260 google_update::kRegOopcrashesField, |
261 static_cast<DWORD>(1), | 261 static_cast<DWORD>(1), |
262 false); // set during first install | 262 false); // set during first install |
263 if (add_language_identifier) { | 263 if (add_language_identifier) { |
264 // Write the language identifier of the current translation. Omaha's set of | 264 // Write the language identifier of the current translation. Omaha's set of |
265 // languages is a superset of Chrome's set of translations with this one | 265 // languages is a superset of Chrome's set of translations with this one |
266 // exception: what Chrome calls "en-us", Omaha calls "en". sigh. | 266 // exception: what Chrome calls "en-us", Omaha calls "en". sigh. |
267 std::wstring language(GetCurrentTranslation()); | 267 string16 language(GetCurrentTranslation()); |
268 if (LowerCaseEqualsASCII(language, "en-us")) | 268 if (LowerCaseEqualsASCII(language, "en-us")) |
269 language.resize(2); | 269 language.resize(2); |
270 list->AddSetRegValueWorkItem(root, version_key, | 270 list->AddSetRegValueWorkItem(root, version_key, |
271 google_update::kRegLangField, language, | 271 google_update::kRegLangField, language, |
272 false); // do not overwrite language | 272 false); // do not overwrite language |
273 } | 273 } |
274 list->AddSetRegValueWorkItem(root, version_key, | 274 list->AddSetRegValueWorkItem(root, version_key, |
275 google_update::kRegVersionField, | 275 google_update::kRegVersionField, |
276 ASCIIToWide(new_version.GetString()), | 276 ASCIIToWide(new_version.GetString()), |
277 true); // overwrite version | 277 true); // overwrite version |
278 } | 278 } |
279 | 279 |
280 void AddInstallAppCommandWorkItems(const InstallerState& installer_state, | 280 void AddInstallAppCommandWorkItems(const InstallerState& installer_state, |
281 const InstallationState& machine_state, | 281 const InstallationState& machine_state, |
282 const FilePath* setup_path, | 282 const FilePath* setup_path, |
283 const Version* new_version, | 283 const Version* new_version, |
284 const Product& product, | 284 const Product& product, |
285 WorkItemList* work_item_list) { | 285 WorkItemList* work_item_list) { |
286 DCHECK(product.is_chrome_app_host()); | 286 DCHECK(product.is_chrome_app_host()); |
287 | 287 |
288 std::wstring cmd_key(product.distribution()->GetVersionKey()); | 288 string16 cmd_key(product.distribution()->GetVersionKey()); |
289 cmd_key.append(1, L'\\').append(google_update::kRegCommandsKey) | 289 cmd_key.append(1, L'\\').append(google_update::kRegCommandsKey) |
290 .append(1, L'\\').append(kCmdInstallApp); | 290 .append(1, L'\\').append(kCmdInstallApp); |
291 | 291 |
292 if (installer_state.operation() != InstallerState::UNINSTALL) { | 292 if (installer_state.operation() != InstallerState::UNINSTALL) { |
293 FilePath target_path(installer_state.target_path()); | 293 FilePath target_path(installer_state.target_path()); |
294 CommandLine cmd_line(target_path.Append(installer::kChromeAppHostExe)); | 294 CommandLine cmd_line(target_path.Append(installer::kChromeAppHostExe)); |
295 cmd_line.AppendSwitchASCII(::switches::kAppsInstallFromManifestURL, "%1"); | 295 cmd_line.AppendSwitchASCII(::switches::kAppsInstallFromManifestURL, "%1"); |
296 | 296 |
297 AppCommand cmd(cmd_line.GetCommandLineString(), true, true); | 297 AppCommand cmd(cmd_line.GetCommandLineString()); |
298 cmd.set_sends_pings(true); | |
299 cmd.set_is_web_accessible(true); | |
298 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); | 300 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); |
299 } else { | 301 } else { |
300 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), | 302 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), |
301 cmd_key)->set_log_message( | 303 cmd_key)->set_log_message( |
302 "removing install-application command"); | 304 "removing install-application command"); |
303 } | 305 } |
304 } | 306 } |
305 | 307 |
306 void AddProductSpecificWorkItems(const InstallationState& original_state, | 308 void AddProductSpecificWorkItems(const InstallationState& original_state, |
307 const InstallerState& installer_state, | 309 const InstallerState& installer_state, |
308 const FilePath& setup_path, | 310 const FilePath& setup_path, |
309 const Version& new_version, | 311 const Version& new_version, |
310 WorkItemList* list) { | 312 WorkItemList* list) { |
311 const Products& products = installer_state.products(); | 313 const Products& products = installer_state.products(); |
312 for (size_t i = 0; i < products.size(); ++i) { | 314 for (size_t i = 0; i < products.size(); ++i) { |
313 const Product& p = *products[i]; | 315 const Product& p = *products[i]; |
314 if (p.is_chrome_frame()) { | 316 if (p.is_chrome_frame()) { |
315 AddChromeFrameWorkItems(original_state, installer_state, setup_path, | 317 AddChromeFrameWorkItems(original_state, installer_state, setup_path, |
316 new_version, p, list); | 318 new_version, p, list); |
317 } | 319 } |
318 if (p.is_chrome_app_host()) { | 320 if (p.is_chrome_app_host()) { |
319 AddInstallAppCommandWorkItems(installer_state, original_state, | 321 AddInstallAppCommandWorkItems(installer_state, original_state, |
320 &setup_path, &new_version, p, list); | 322 &setup_path, &new_version, p, list); |
321 } | 323 } |
324 if (p.is_chrome()) { | |
325 AddOsUpgradeWorkItems(installer_state, &setup_path, &new_version, p, | |
326 list); | |
327 } | |
322 } | 328 } |
323 } | 329 } |
324 | 330 |
325 // Mirror oeminstall the first time anything is installed multi. There is no | 331 // Mirror oeminstall the first time anything is installed multi. There is no |
326 // need to update the value on future install/update runs since this value never | 332 // need to update the value on future install/update runs since this value never |
327 // changes. Note that the value is removed by Google Update after EULA | 333 // changes. Note that the value is removed by Google Update after EULA |
328 // acceptance is processed. | 334 // acceptance is processed. |
329 void AddOemInstallWorkItems(const InstallationState& original_state, | 335 void AddOemInstallWorkItems(const InstallationState& original_state, |
330 const InstallerState& installer_state, | 336 const InstallerState& installer_state, |
331 WorkItemList* install_list) { | 337 WorkItemList* install_list) { |
332 DCHECK(installer_state.is_multi_install()); | 338 DCHECK(installer_state.is_multi_install()); |
333 const bool system_install = installer_state.system_install(); | 339 const bool system_install = installer_state.system_install(); |
334 if (!original_state.GetProductState(system_install, | 340 if (!original_state.GetProductState(system_install, |
335 BrowserDistribution::CHROME_BINARIES)) { | 341 BrowserDistribution::CHROME_BINARIES)) { |
336 const HKEY root_key = installer_state.root_key(); | 342 const HKEY root_key = installer_state.root_key(); |
337 std::wstring multi_key( | 343 string16 multi_key( |
338 installer_state.multi_package_binaries_distribution()->GetStateKey()); | 344 installer_state.multi_package_binaries_distribution()->GetStateKey()); |
339 | 345 |
340 // Copy the value from Chrome unless Chrome isn't installed or being | 346 // Copy the value from Chrome unless Chrome isn't installed or being |
341 // installed. | 347 // installed. |
342 BrowserDistribution::Type source_type; | 348 BrowserDistribution::Type source_type; |
343 if (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER)) { | 349 if (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER)) { |
344 source_type = BrowserDistribution::CHROME_BROWSER; | 350 source_type = BrowserDistribution::CHROME_BROWSER; |
345 } else if (!installer_state.products().empty()) { | 351 } else if (!installer_state.products().empty()) { |
346 // Pick a product, any product. | 352 // Pick a product, any product. |
347 source_type = installer_state.products()[0]->distribution()->GetType(); | 353 source_type = installer_state.products()[0]->distribution()->GetType(); |
348 } else { | 354 } else { |
349 // Nothing is being installed? Entirely unexpected, so do no harm. | 355 // Nothing is being installed? Entirely unexpected, so do no harm. |
350 LOG(ERROR) << "No products found in AddOemInstallWorkItems"; | 356 LOG(ERROR) << "No products found in AddOemInstallWorkItems"; |
351 return; | 357 return; |
352 } | 358 } |
353 const ProductState* source_product = | 359 const ProductState* source_product = |
354 original_state.GetNonVersionedProductState(system_install, source_type); | 360 original_state.GetNonVersionedProductState(system_install, source_type); |
355 | 361 |
356 std::wstring oem_install; | 362 string16 oem_install; |
357 if (source_product->GetOemInstall(&oem_install)) { | 363 if (source_product->GetOemInstall(&oem_install)) { |
358 VLOG(1) << "Mirroring oeminstall=\"" << oem_install << "\" from " | 364 VLOG(1) << "Mirroring oeminstall=\"" << oem_install << "\" from " |
359 << BrowserDistribution::GetSpecificDistribution(source_type) | 365 << BrowserDistribution::GetSpecificDistribution(source_type) |
360 ->GetAppShortCutName(); | 366 ->GetAppShortCutName(); |
361 install_list->AddCreateRegKeyWorkItem(root_key, multi_key); | 367 install_list->AddCreateRegKeyWorkItem(root_key, multi_key); |
362 // Always overwrite an old value. | 368 // Always overwrite an old value. |
363 install_list->AddSetRegValueWorkItem(root_key, multi_key, | 369 install_list->AddSetRegValueWorkItem(root_key, multi_key, |
364 google_update::kRegOemInstallField, | 370 google_update::kRegOemInstallField, |
365 oem_install, true); | 371 oem_install, true); |
366 } else { | 372 } else { |
367 // Clear any old value. | 373 // Clear any old value. |
368 install_list->AddDeleteRegValueWorkItem( | 374 install_list->AddDeleteRegValueWorkItem( |
369 root_key, multi_key, google_update::kRegOemInstallField); | 375 root_key, multi_key, google_update::kRegOemInstallField); |
370 } | 376 } |
371 } | 377 } |
372 } | 378 } |
373 | 379 |
374 // Mirror eulaaccepted the first time anything is installed multi. There is no | 380 // Mirror eulaaccepted the first time anything is installed multi. There is no |
375 // need to update the value on future install/update runs since | 381 // need to update the value on future install/update runs since |
376 // GoogleUpdateSettings::SetEULAConsent will modify the value for both the | 382 // GoogleUpdateSettings::SetEULAConsent will modify the value for both the |
377 // relevant product and for the binaries. | 383 // relevant product and for the binaries. |
378 void AddEulaAcceptedWorkItems(const InstallationState& original_state, | 384 void AddEulaAcceptedWorkItems(const InstallationState& original_state, |
379 const InstallerState& installer_state, | 385 const InstallerState& installer_state, |
380 WorkItemList* install_list) { | 386 WorkItemList* install_list) { |
381 DCHECK(installer_state.is_multi_install()); | 387 DCHECK(installer_state.is_multi_install()); |
382 const bool system_install = installer_state.system_install(); | 388 const bool system_install = installer_state.system_install(); |
383 if (!original_state.GetProductState(system_install, | 389 if (!original_state.GetProductState(system_install, |
384 BrowserDistribution::CHROME_BINARIES)) { | 390 BrowserDistribution::CHROME_BINARIES)) { |
385 const HKEY root_key = installer_state.root_key(); | 391 const HKEY root_key = installer_state.root_key(); |
386 std::wstring multi_key( | 392 string16 multi_key( |
387 installer_state.multi_package_binaries_distribution()->GetStateKey()); | 393 installer_state.multi_package_binaries_distribution()->GetStateKey()); |
388 | 394 |
389 // Copy the value from the product with the greatest value. | 395 // Copy the value from the product with the greatest value. |
390 bool have_eula_accepted = false; | 396 bool have_eula_accepted = false; |
391 BrowserDistribution::Type product_type; | 397 BrowserDistribution::Type product_type; |
392 DWORD eula_accepted; | 398 DWORD eula_accepted; |
393 const Products& products = installer_state.products(); | 399 const Products& products = installer_state.products(); |
394 for (size_t i = 0, count = products.size(); i != count; ++i) { | 400 for (size_t i = 0, count = products.size(); i != count; ++i) { |
395 if (products[i]->is_chrome_binaries()) | 401 if (products[i]->is_chrome_binaries()) |
396 continue; | 402 continue; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
430 WorkItemList* install_list) { | 436 WorkItemList* install_list) { |
431 // Is a multi-install product being installed or over-installed? | 437 // Is a multi-install product being installed or over-installed? |
432 if (installer_state.operation() != InstallerState::MULTI_INSTALL && | 438 if (installer_state.operation() != InstallerState::MULTI_INSTALL && |
433 installer_state.operation() != InstallerState::MULTI_UPDATE) { | 439 installer_state.operation() != InstallerState::MULTI_UPDATE) { |
434 VLOG(1) << "AddGoogleUpdateWorkItems noop: " << installer_state.operation(); | 440 VLOG(1) << "AddGoogleUpdateWorkItems noop: " << installer_state.operation(); |
435 return; | 441 return; |
436 } | 442 } |
437 | 443 |
438 const bool system_install = installer_state.system_install(); | 444 const bool system_install = installer_state.system_install(); |
439 const HKEY root_key = installer_state.root_key(); | 445 const HKEY root_key = installer_state.root_key(); |
440 std::wstring multi_key( | 446 string16 multi_key( |
441 installer_state.multi_package_binaries_distribution()->GetStateKey()); | 447 installer_state.multi_package_binaries_distribution()->GetStateKey()); |
442 | 448 |
443 // For system-level installs, make sure the ClientStateMedium key for the | 449 // For system-level installs, make sure the ClientStateMedium key for the |
444 // binaries exists. | 450 // binaries exists. |
445 if (system_install) { | 451 if (system_install) { |
446 install_list->AddCreateRegKeyWorkItem( | 452 install_list->AddCreateRegKeyWorkItem( |
447 root_key, | 453 root_key, |
448 installer_state.multi_package_binaries_distribution()-> | 454 installer_state.multi_package_binaries_distribution()-> |
449 GetStateMediumKey().c_str()); | 455 GetStateMediumKey().c_str()); |
450 } | 456 } |
451 | 457 |
452 // Creating the ClientState key for binaries, if we're migrating to multi then | 458 // Creating the ClientState key for binaries, if we're migrating to multi then |
453 // copy over Chrome's brand code if it has one. Chrome Frame currently never | 459 // copy over Chrome's brand code if it has one. Chrome Frame currently never |
454 // has a brand code. | 460 // has a brand code. |
455 if (installer_state.state_type() != BrowserDistribution::CHROME_BINARIES) { | 461 if (installer_state.state_type() != BrowserDistribution::CHROME_BINARIES) { |
456 const ProductState* chrome_product_state = | 462 const ProductState* chrome_product_state = |
457 original_state.GetNonVersionedProductState( | 463 original_state.GetNonVersionedProductState( |
458 system_install, BrowserDistribution::CHROME_BROWSER); | 464 system_install, BrowserDistribution::CHROME_BROWSER); |
459 | 465 |
460 const std::wstring& brand(chrome_product_state->brand()); | 466 const string16& brand(chrome_product_state->brand()); |
461 if (!brand.empty()) { | 467 if (!brand.empty()) { |
462 install_list->AddCreateRegKeyWorkItem(root_key, multi_key); | 468 install_list->AddCreateRegKeyWorkItem(root_key, multi_key); |
463 // Write Chrome's brand code to the multi key. Never overwrite the value | 469 // Write Chrome's brand code to the multi key. Never overwrite the value |
464 // if one is already present (although this shouldn't happen). | 470 // if one is already present (although this shouldn't happen). |
465 install_list->AddSetRegValueWorkItem(root_key, | 471 install_list->AddSetRegValueWorkItem(root_key, |
466 multi_key, | 472 multi_key, |
467 google_update::kRegBrandField, | 473 google_update::kRegBrandField, |
468 brand, | 474 brand, |
469 false); | 475 false); |
470 } | 476 } |
(...skipping 28 matching lines...) Expand all Loading... | |
499 BrowserDistribution* dist = (*scan)->distribution(); | 505 BrowserDistribution* dist = (*scan)->distribution(); |
500 const ProductState* product_state = | 506 const ProductState* product_state = |
501 original_state.GetNonVersionedProductState( | 507 original_state.GetNonVersionedProductState( |
502 installer_state.system_install(), dist->GetType()); | 508 installer_state.system_install(), dist->GetType()); |
503 value_found = product_state->GetUsageStats(&usagestats); | 509 value_found = product_state->GetUsageStats(&usagestats); |
504 } | 510 } |
505 | 511 |
506 // If a value was found, write it in the appropriate location for the | 512 // If a value was found, write it in the appropriate location for the |
507 // binaries and remove all values from the products. | 513 // binaries and remove all values from the products. |
508 if (value_found) { | 514 if (value_found) { |
509 std::wstring state_key( | 515 string16 state_key( |
510 installer_state.multi_package_binaries_distribution()->GetStateKey()); | 516 installer_state.multi_package_binaries_distribution()->GetStateKey()); |
511 install_list->AddCreateRegKeyWorkItem(root_key, state_key); | 517 install_list->AddCreateRegKeyWorkItem(root_key, state_key); |
512 // Overwrite any existing value so that overinstalls (where Omaha writes a | 518 // Overwrite any existing value so that overinstalls (where Omaha writes a |
513 // new value into a product's state key) pick up the correct value. | 519 // new value into a product's state key) pick up the correct value. |
514 install_list->AddSetRegValueWorkItem(root_key, state_key, | 520 install_list->AddSetRegValueWorkItem(root_key, state_key, |
515 google_update::kRegUsageStatsField, | 521 google_update::kRegUsageStatsField, |
516 usagestats, true); | 522 usagestats, true); |
517 | 523 |
518 for (Products::const_iterator scan = products.begin(), end = products.end(); | 524 for (Products::const_iterator scan = products.begin(), end = products.end(); |
519 scan != end; ++scan) { | 525 scan != end; ++scan) { |
(...skipping 24 matching lines...) Expand all Loading... | |
544 void AddDeleteUninstallShortcutsForMSIWorkItems( | 550 void AddDeleteUninstallShortcutsForMSIWorkItems( |
545 const InstallerState& installer_state, | 551 const InstallerState& installer_state, |
546 const Product& product, | 552 const Product& product, |
547 const FilePath& temp_path, | 553 const FilePath& temp_path, |
548 WorkItemList* work_item_list) { | 554 WorkItemList* work_item_list) { |
549 DCHECK(installer_state.is_msi()) | 555 DCHECK(installer_state.is_msi()) |
550 << "This must only be called for MSI installations!"; | 556 << "This must only be called for MSI installations!"; |
551 | 557 |
552 // First attempt to delete the old installation's ARP dialog entry. | 558 // First attempt to delete the old installation's ARP dialog entry. |
553 HKEY reg_root = installer_state.root_key(); | 559 HKEY reg_root = installer_state.root_key(); |
554 std::wstring uninstall_reg(product.distribution()->GetUninstallRegPath()); | 560 string16 uninstall_reg(product.distribution()->GetUninstallRegPath()); |
555 | 561 |
556 WorkItem* delete_reg_key = work_item_list->AddDeleteRegKeyWorkItem( | 562 WorkItem* delete_reg_key = work_item_list->AddDeleteRegKeyWorkItem( |
557 reg_root, uninstall_reg); | 563 reg_root, uninstall_reg); |
558 delete_reg_key->set_ignore_failure(true); | 564 delete_reg_key->set_ignore_failure(true); |
559 | 565 |
560 // Then attempt to delete the old installation's start menu shortcut. | 566 // Then attempt to delete the old installation's start menu shortcut. |
561 FilePath uninstall_link; | 567 FilePath uninstall_link; |
562 if (installer_state.system_install()) { | 568 if (installer_state.system_install()) { |
563 PathService::Get(base::DIR_COMMON_START_MENU, &uninstall_link); | 569 PathService::Get(base::DIR_COMMON_START_MENU, &uninstall_link); |
564 } else { | 570 } else { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
622 .Append(setup_path.BaseName())); | 628 .Append(setup_path.BaseName())); |
623 | 629 |
624 CommandLine rename(installer_path); | 630 CommandLine rename(installer_path); |
625 rename.AppendSwitch(switches::kRenameChromeExe); | 631 rename.AppendSwitch(switches::kRenameChromeExe); |
626 if (installer_state.system_install()) | 632 if (installer_state.system_install()) |
627 rename.AppendSwitch(switches::kSystemLevel); | 633 rename.AppendSwitch(switches::kSystemLevel); |
628 | 634 |
629 if (installer_state.verbose_logging()) | 635 if (installer_state.verbose_logging()) |
630 rename.AppendSwitch(switches::kVerboseLogging); | 636 rename.AppendSwitch(switches::kVerboseLogging); |
631 | 637 |
632 std::wstring version_key; | 638 string16 version_key; |
633 for (size_t i = 0; i < products.size(); ++i) { | 639 for (size_t i = 0; i < products.size(); ++i) { |
634 BrowserDistribution* dist = products[i]->distribution(); | 640 BrowserDistribution* dist = products[i]->distribution(); |
635 version_key = dist->GetVersionKey(); | 641 version_key = dist->GetVersionKey(); |
636 | 642 |
637 if (current_version != NULL) { | 643 if (current_version != NULL) { |
638 in_use_update_work_items->AddSetRegValueWorkItem(root, version_key, | 644 in_use_update_work_items->AddSetRegValueWorkItem(root, version_key, |
639 google_update::kRegOldVersionField, | 645 google_update::kRegOldVersionField, |
640 ASCIIToWide(current_version->GetString()), true); | 646 ASCIIToWide(current_version->GetString()), true); |
641 } | 647 } |
642 if (critical_version.IsValid()) { | 648 if (critical_version.IsValid()) { |
(...skipping 30 matching lines...) Expand all Loading... | |
673 // Append work items that will be executed if this was NOT an in-use update. | 679 // Append work items that will be executed if this was NOT an in-use update. |
674 { | 680 { |
675 scoped_ptr<WorkItemList> regular_update_work_items( | 681 scoped_ptr<WorkItemList> regular_update_work_items( |
676 WorkItem::CreateConditionalWorkItemList( | 682 WorkItem::CreateConditionalWorkItemList( |
677 new Not(new ConditionRunIfFileExists(new_chrome_exe)))); | 683 new Not(new ConditionRunIfFileExists(new_chrome_exe)))); |
678 regular_update_work_items->set_log_message("RegularUpdateWorkItemList"); | 684 regular_update_work_items->set_log_message("RegularUpdateWorkItemList"); |
679 | 685 |
680 // Since this was not an in-use-update, delete 'opv', 'cpv', and 'cmd' keys. | 686 // Since this was not an in-use-update, delete 'opv', 'cpv', and 'cmd' keys. |
681 for (size_t i = 0; i < products.size(); ++i) { | 687 for (size_t i = 0; i < products.size(); ++i) { |
682 BrowserDistribution* dist = products[i]->distribution(); | 688 BrowserDistribution* dist = products[i]->distribution(); |
683 std::wstring version_key(dist->GetVersionKey()); | 689 string16 version_key(dist->GetVersionKey()); |
684 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, | 690 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, |
685 google_update::kRegOldVersionField); | 691 google_update::kRegOldVersionField); |
686 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, | 692 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, |
687 google_update::kRegCriticalVersionField); | 693 google_update::kRegCriticalVersionField); |
688 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, | 694 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, |
689 google_update::kRegRenameCmdField); | 695 google_update::kRegRenameCmdField); |
690 } | 696 } |
691 | 697 |
692 if (installer_state.FindProduct(BrowserDistribution::CHROME_FRAME)) { | 698 if (installer_state.FindProduct(BrowserDistribution::CHROME_FRAME)) { |
693 AddDeleteOldIELowRightsPolicyWorkItems(installer_state, | 699 AddDeleteOldIELowRightsPolicyWorkItems(installer_state, |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
980 const FilePath& setup_path, | 986 const FilePath& setup_path, |
981 const Version& new_version, | 987 const Version& new_version, |
982 const Product& product, | 988 const Product& product, |
983 WorkItemList* list) { | 989 WorkItemList* list) { |
984 DCHECK(product.is_chrome_frame()); | 990 DCHECK(product.is_chrome_frame()); |
985 if (!installer_state.is_multi_install()) { | 991 if (!installer_state.is_multi_install()) { |
986 VLOG(1) << "Not adding GCF specific work items for single install."; | 992 VLOG(1) << "Not adding GCF specific work items for single install."; |
987 return; | 993 return; |
988 } | 994 } |
989 | 995 |
990 std::wstring version_key(product.distribution()->GetVersionKey()); | 996 string16 version_key(product.distribution()->GetVersionKey()); |
991 bool ready_mode = product.HasOption(kOptionReadyMode); | 997 bool ready_mode = product.HasOption(kOptionReadyMode); |
992 HKEY root = installer_state.root_key(); | 998 HKEY root = installer_state.root_key(); |
993 const bool is_install = | 999 const bool is_install = |
994 (installer_state.operation() != InstallerState::UNINSTALL); | 1000 (installer_state.operation() != InstallerState::UNINSTALL); |
995 bool update_chrome_uninstall_command = false; | 1001 bool update_chrome_uninstall_command = false; |
996 BrowserDistribution* dist = | 1002 BrowserDistribution* dist = |
997 installer_state.multi_package_binaries_distribution(); | 1003 installer_state.multi_package_binaries_distribution(); |
998 if (ready_mode) { | 1004 if (ready_mode) { |
999 // If GCF is being installed in ready mode, we write an entry to the | 1005 // If GCF is being installed in ready mode, we write an entry to the |
1000 // multi-install state key. If the value already exists, we will not | 1006 // multi-install state key. If the value already exists, we will not |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1291 // this is done only as a convenience; there is no need for the GUID of the Low | 1297 // this is done only as a convenience; there is no need for the GUID of the Low |
1292 // Rights policies to match the ChromeFrame class's GUID. Hence, it is safe to | 1298 // Rights policies to match the ChromeFrame class's GUID. Hence, it is safe to |
1293 // use this completely unrelated GUID for the "old" policies. | 1299 // use this completely unrelated GUID for the "old" policies. |
1294 const wchar_t kIELowRightsPolicyOldGuid[] = | 1300 const wchar_t kIELowRightsPolicyOldGuid[] = |
1295 L"{6C288DD7-76FB-4721-B628-56FAC252E199}"; | 1301 L"{6C288DD7-76FB-4721-B628-56FAC252E199}"; |
1296 | 1302 |
1297 const wchar_t kElevationPolicyKeyPath[] = | 1303 const wchar_t kElevationPolicyKeyPath[] = |
1298 L"SOFTWARE\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\"; | 1304 L"SOFTWARE\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\"; |
1299 | 1305 |
1300 void GetIELowRightsElevationPolicyKeyPath(ElevationPolicyId policy, | 1306 void GetIELowRightsElevationPolicyKeyPath(ElevationPolicyId policy, |
1301 std::wstring* key_path) { | 1307 string16* key_path) { |
1302 DCHECK(policy == CURRENT_ELEVATION_POLICY || policy == OLD_ELEVATION_POLICY); | 1308 DCHECK(policy == CURRENT_ELEVATION_POLICY || policy == OLD_ELEVATION_POLICY); |
1303 | 1309 |
1304 key_path->assign(kElevationPolicyKeyPath, | 1310 key_path->assign(kElevationPolicyKeyPath, |
1305 arraysize(kElevationPolicyKeyPath) - 1); | 1311 arraysize(kElevationPolicyKeyPath) - 1); |
1306 if (policy == CURRENT_ELEVATION_POLICY) { | 1312 if (policy == CURRENT_ELEVATION_POLICY) { |
1307 wchar_t cf_clsid[64]; | 1313 wchar_t cf_clsid[64]; |
1308 int len = StringFromGUID2(__uuidof(ChromeFrame), &cf_clsid[0], | 1314 int len = StringFromGUID2(__uuidof(ChromeFrame), &cf_clsid[0], |
1309 arraysize(cf_clsid)); | 1315 arraysize(cf_clsid)); |
1310 key_path->append(&cf_clsid[0], len - 1); | 1316 key_path->append(&cf_clsid[0], len - 1); |
1311 } else { | 1317 } else { |
1312 key_path->append(kIELowRightsPolicyOldGuid, | 1318 key_path->append(kIELowRightsPolicyOldGuid, |
1313 arraysize(kIELowRightsPolicyOldGuid)- 1); | 1319 arraysize(kIELowRightsPolicyOldGuid)- 1); |
1314 } | 1320 } |
1315 } | 1321 } |
1316 | 1322 |
1317 } // namespace | 1323 } // namespace |
1318 | 1324 |
1319 void AddDeleteOldIELowRightsPolicyWorkItems( | 1325 void AddDeleteOldIELowRightsPolicyWorkItems( |
1320 const InstallerState& installer_state, | 1326 const InstallerState& installer_state, |
1321 WorkItemList* install_list) { | 1327 WorkItemList* install_list) { |
1322 DCHECK(install_list); | 1328 DCHECK(install_list); |
1323 | 1329 |
1324 std::wstring key_path; | 1330 string16 key_path; |
1325 GetIELowRightsElevationPolicyKeyPath(OLD_ELEVATION_POLICY, &key_path); | 1331 GetIELowRightsElevationPolicyKeyPath(OLD_ELEVATION_POLICY, &key_path); |
1326 install_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), key_path); | 1332 install_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), key_path); |
1327 } | 1333 } |
1328 | 1334 |
1329 // Adds work items to copy the chrome_launcher IE low rights elevation policy | 1335 // Adds work items to copy the chrome_launcher IE low rights elevation policy |
1330 // from the primary policy GUID to the "old" policy GUID. Take care not to | 1336 // from the primary policy GUID to the "old" policy GUID. Take care not to |
1331 // perform the copy if there is already an old policy present, as the ones under | 1337 // perform the copy if there is already an old policy present, as the ones under |
1332 // the main kElevationPolicyGuid would then correspond to an intermediate | 1338 // the main kElevationPolicyGuid would then correspond to an intermediate |
1333 // version (current_version < pv < new_version). | 1339 // version (current_version < pv < new_version). |
1334 void AddCopyIELowRightsPolicyWorkItems(const InstallerState& installer_state, | 1340 void AddCopyIELowRightsPolicyWorkItems(const InstallerState& installer_state, |
1335 WorkItemList* install_list) { | 1341 WorkItemList* install_list) { |
1336 DCHECK(install_list); | 1342 DCHECK(install_list); |
1337 | 1343 |
1338 std::wstring current_key_path; | 1344 string16 current_key_path; |
1339 std::wstring old_key_path; | 1345 string16 old_key_path; |
1340 | 1346 |
1341 GetIELowRightsElevationPolicyKeyPath(CURRENT_ELEVATION_POLICY, | 1347 GetIELowRightsElevationPolicyKeyPath(CURRENT_ELEVATION_POLICY, |
1342 ¤t_key_path); | 1348 ¤t_key_path); |
1343 GetIELowRightsElevationPolicyKeyPath(OLD_ELEVATION_POLICY, &old_key_path); | 1349 GetIELowRightsElevationPolicyKeyPath(OLD_ELEVATION_POLICY, &old_key_path); |
1344 // Do not clobber existing old policies. | 1350 // Do not clobber existing old policies. |
1345 install_list->AddCopyRegKeyWorkItem(installer_state.root_key(), | 1351 install_list->AddCopyRegKeyWorkItem(installer_state.root_key(), |
1346 current_key_path, old_key_path, | 1352 current_key_path, old_key_path, |
1347 WorkItem::IF_NOT_PRESENT); | 1353 WorkItem::IF_NOT_PRESENT); |
1348 } | 1354 } |
1349 | 1355 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1391 } | 1397 } |
1392 } | 1398 } |
1393 | 1399 |
1394 void AddGenericQuickEnableWorkItems(const InstallerState& installer_state, | 1400 void AddGenericQuickEnableWorkItems(const InstallerState& installer_state, |
1395 const InstallationState& machine_state, | 1401 const InstallationState& machine_state, |
1396 const FilePath* setup_path, | 1402 const FilePath* setup_path, |
1397 const Version* new_version, | 1403 const Version* new_version, |
1398 WorkItemList* work_item_list, | 1404 WorkItemList* work_item_list, |
1399 bool have_child_product, | 1405 bool have_child_product, |
1400 const CommandLine& child_product_switches, | 1406 const CommandLine& child_product_switches, |
1401 const std::wstring& command_id) { | 1407 const string16& command_id) { |
1402 DCHECK(setup_path || | 1408 DCHECK(setup_path || |
1403 installer_state.operation() == InstallerState::UNINSTALL); | 1409 installer_state.operation() == InstallerState::UNINSTALL); |
1404 DCHECK(new_version || | 1410 DCHECK(new_version || |
1405 installer_state.operation() == InstallerState::UNINSTALL); | 1411 installer_state.operation() == InstallerState::UNINSTALL); |
1406 DCHECK(work_item_list); | 1412 DCHECK(work_item_list); |
1407 | 1413 |
1408 const bool system_install = installer_state.system_install(); | 1414 const bool system_install = installer_state.system_install(); |
1409 bool have_chrome_binaries = false; | 1415 bool have_chrome_binaries = false; |
1410 | 1416 |
1411 // STEP 1: Figure out the state of the machine before the operation. | 1417 // STEP 1: Figure out the state of the machine before the operation. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1472 setup_path->BaseName()); | 1478 setup_path->BaseName()); |
1473 } | 1479 } |
1474 } | 1480 } |
1475 | 1481 |
1476 // STEP 4: Take action. | 1482 // STEP 4: Take action. |
1477 if (operation != DO_NOTHING) { | 1483 if (operation != DO_NOTHING) { |
1478 // Get the path to the quick-enable-cf command for the binaries. | 1484 // Get the path to the quick-enable-cf command for the binaries. |
1479 BrowserDistribution* binaries = | 1485 BrowserDistribution* binaries = |
1480 BrowserDistribution::GetSpecificDistribution( | 1486 BrowserDistribution::GetSpecificDistribution( |
1481 BrowserDistribution::CHROME_BINARIES); | 1487 BrowserDistribution::CHROME_BINARIES); |
1482 std::wstring cmd_key(binaries->GetVersionKey()); | 1488 string16 cmd_key(binaries->GetVersionKey()); |
1483 cmd_key.append(1, L'\\').append(google_update::kRegCommandsKey) | 1489 cmd_key.append(1, L'\\').append(google_update::kRegCommandsKey) |
1484 .append(1, L'\\').append(command_id); | 1490 .append(1, L'\\').append(command_id); |
1485 | 1491 |
1486 if (operation == ADD_COMMAND) { | 1492 if (operation == ADD_COMMAND) { |
1487 DCHECK(!binaries_setup_path.empty()); | 1493 DCHECK(!binaries_setup_path.empty()); |
1488 CommandLine cmd_line(binaries_setup_path); | 1494 CommandLine cmd_line(binaries_setup_path); |
1489 cmd_line.AppendArguments(child_product_switches, | 1495 cmd_line.AppendArguments(child_product_switches, |
1490 false); // include_program | 1496 false); // include_program |
1491 if (installer_state.verbose_logging()) | 1497 if (installer_state.verbose_logging()) |
1492 cmd_line.AppendSwitch(switches::kVerboseLogging); | 1498 cmd_line.AppendSwitch(switches::kVerboseLogging); |
1493 AppCommand cmd(cmd_line.GetCommandLineString(), true, true); | 1499 AppCommand cmd(cmd_line.GetCommandLineString()); |
1500 cmd.set_sends_pings(true); | |
1501 cmd.set_is_web_accessible(true); | |
1494 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); | 1502 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); |
1495 } else { | 1503 } else { |
1496 DCHECK(operation == REMOVE_COMMAND); | 1504 DCHECK(operation == REMOVE_COMMAND); |
1497 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), | 1505 work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), |
1498 cmd_key)->set_log_message( | 1506 cmd_key)->set_log_message( |
1499 "removing " + WideToASCII(command_id) + " command"); | 1507 "removing " + WideToASCII(command_id) + " command"); |
1500 } | 1508 } |
1501 } | 1509 } |
1502 } | 1510 } |
1503 | 1511 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1586 AddGenericQuickEnableWorkItems(installer_state, | 1594 AddGenericQuickEnableWorkItems(installer_state, |
1587 machine_state, | 1595 machine_state, |
1588 setup_path, | 1596 setup_path, |
1589 new_version, | 1597 new_version, |
1590 work_item_list, | 1598 work_item_list, |
1591 false, // have_child_product | 1599 false, // have_child_product |
1592 cmd_line, | 1600 cmd_line, |
1593 kCmdQuickEnableApplicationHost); | 1601 kCmdQuickEnableApplicationHost); |
1594 } | 1602 } |
1595 | 1603 |
1604 void AddOsUpgradeWorkItems(const InstallerState& installer_state, | |
1605 const FilePath* setup_path, | |
1606 const Version* new_version, | |
1607 const Product& product, | |
1608 WorkItemList* install_list) { | |
1609 const HKEY root_key = installer_state.root_key(); | |
1610 string16 cmd_key(product.distribution()->GetVersionKey()); | |
1611 cmd_key.append(1, FilePath::kSeparators[0]) | |
1612 .append(google_update::kRegCommandsKey) | |
1613 .append(1, FilePath::kSeparators[0]) | |
1614 .append(kCmdOnOsUpgrade); | |
1615 | |
1616 // This will make Google Update call setup.exe with --on-os-upgrade switch. | |
1617 // For Chrome, this leads to HandleOsUpgradeForBrowser() being called. | |
1618 if (installer_state.operation() != InstallerState::UNINSTALL) { | |
1619 CommandLine cmd_line(installer_state | |
1620 .GetInstallerDirectory(*new_version) | |
1621 .Append(setup_path->BaseName())); | |
1622 // Add the main option to indicate OS upgrade flow. | |
1623 cmd_line.AppendSwitch(installer::switches::kOnOsUpgrade); | |
1624 // Add product-specific options. | |
1625 product.AppendProductFlags(&cmd_line); | |
1626 if (installer_state.system_install()) | |
1627 cmd_line.AppendSwitch(installer::switches::kSystemLevel); | |
1628 // Log everything for now. | |
1629 cmd_line.AppendSwitch(installer::switches::kVerboseLogging); | |
1630 | |
1631 install_list->set_log_message("Adding OS upgrade command"); | |
grt (UTC plus 2)
2012/09/01 01:30:24
delete this line. you should not set a message on
huangs
2012/09/01 21:38:03
Done.
| |
1632 AppCommand cmd(cmd_line.GetCommandLineString()); | |
1633 cmd.set_is_auto_run_on_os_upgrade(true); | |
1634 cmd.AddWorkItems(installer_state.root_key(), cmd_key, install_list); | |
1635 } else { | |
1636 install_list->AddDeleteRegKeyWorkItem(root_key, cmd_key) | |
1637 ->set_log_message("Removing OS upgrade command"); | |
1638 } | |
1639 } | |
1640 | |
1596 } // namespace installer | 1641 } // namespace installer |
OLD | NEW |