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 <windows.h> | 5 #include <windows.h> |
6 #include <msi.h> | 6 #include <msi.h> |
7 #include <shellapi.h> | 7 #include <shellapi.h> |
8 #include <shlobj.h> | 8 #include <shlobj.h> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 const Product* chrome_frame = | 353 const Product* chrome_frame = |
354 installer_state->FindProduct(BrowserDistribution::CHROME_FRAME); | 354 installer_state->FindProduct(BrowserDistribution::CHROME_FRAME); |
355 const ProductState* cf_state = | 355 const ProductState* cf_state = |
356 original_state.GetProductState(system_level, | 356 original_state.GetProductState(system_level, |
357 BrowserDistribution::CHROME_FRAME); | 357 BrowserDistribution::CHROME_FRAME); |
358 const ProductState* chrome_state = | 358 const ProductState* chrome_state = |
359 original_state.GetProductState(system_level, | 359 original_state.GetProductState(system_level, |
360 BrowserDistribution::CHROME_BROWSER); | 360 BrowserDistribution::CHROME_BROWSER); |
361 | 361 |
362 if (!binaries) { | 362 if (!binaries) { |
| 363 // This will only be hit if --multi-install is given with no products, or |
| 364 // if the app host is being installed and doesn't need the binaries at |
| 365 // user-level. |
| 366 // The former case might be due to a request by an orphaned Application |
| 367 // Host to re-install the binaries. Thus we add them to the installation. |
| 368 // The latter case is fine and we let it be. |
| 369 // If this is not an app host install and the binaries are not already |
| 370 // present, the installation will fail later due to a lack of products to |
| 371 // install. |
363 if (app_host && !chrome && !chrome_frame && !cf_state && !chrome_state) { | 372 if (app_host && !chrome && !chrome_frame && !cf_state && !chrome_state) { |
364 DCHECK(!system_level); | 373 DCHECK(!system_level); |
365 // App Host may use Chrome/Chrome binaries at system-level. | 374 // App Host may use Chrome/Chrome binaries at system-level. |
366 if (original_state.GetProductState( | 375 if (original_state.GetProductState( |
367 true, // system | 376 true, // system |
368 BrowserDistribution::CHROME_BROWSER) || | 377 BrowserDistribution::CHROME_BROWSER) || |
369 original_state.GetProductState( | 378 original_state.GetProductState( |
370 true, // system | 379 true, // system |
371 BrowserDistribution::CHROME_BINARIES)) { | 380 BrowserDistribution::CHROME_BINARIES)) { |
372 VLOG(1) << "Installing/updating Application Host without binaries."; | 381 VLOG(1) << "Installing/updating Application Host without binaries."; |
373 return true; | |
374 } else { | 382 } else { |
375 // Somehow the binaries were present when the quick-enable app host | 383 // Somehow the binaries were present when the quick-enable app host |
376 // command was run, but now they appear to be missing. | 384 // command was run, but now they appear to be missing. |
377 // TODO(erikwright): should the binaries be implicitly added? | 385 // Force binaries to be installed/updated. |
378 LOG(ERROR) << "Cannot install Application Host without binaries."; | 386 scoped_ptr<Product> binaries_to_add(new Product( |
379 *status = installer::APP_HOST_REQUIRES_BINARIES; | 387 BrowserDistribution::GetSpecificDistribution( |
380 installer_state->WriteInstallerResult(*status, 0, NULL); | 388 BrowserDistribution::CHROME_BINARIES))); |
381 return false; | 389 binaries_to_add->SetOption(installer::kOptionMultiInstall, true); |
| 390 binaries = installer_state->AddProduct(&binaries_to_add); |
| 391 VLOG(1) << "Adding binaries for pre-existing App Host installation."; |
382 } | 392 } |
383 } else { | |
384 // Every other scenario requires the binaries to be installed/updated | |
385 // along with the main product. This will only be hit if | |
386 // --multi-install is given with no products. See | |
387 // CheckPreInstallConditions for handling of this case. | |
388 return true; | |
389 } | 393 } |
| 394 |
| 395 return true; |
390 } | 396 } |
391 | 397 |
392 if (chrome) { | 398 if (chrome) { |
393 if (chrome_frame && | 399 if (chrome_frame && |
394 chrome_frame->HasOption(installer::kOptionReadyMode)) { | 400 chrome_frame->HasOption(installer::kOptionReadyMode)) { |
395 // We're being asked to install Chrome with Chrome Frame in ready-mode. | 401 // We're being asked to install Chrome with Chrome Frame in ready-mode. |
396 // This is an optimistic operation: if a SxS install of Chrome Frame | 402 // This is an optimistic operation: if a SxS install of Chrome Frame |
397 // is already present, don't touch it; if a multi-install of Chrome | 403 // is already present, don't touch it; if a multi-install of Chrome |
398 // Frame is present, preserve its settings (ready-mode). | 404 // Frame is present, preserve its settings (ready-mode). |
399 if (cf_state != NULL) { | 405 if (cf_state != NULL) { |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 if (!(installer_state.is_msi() && is_uninstall)) | 1499 if (!(installer_state.is_msi() && is_uninstall)) |
1494 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1500 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
1495 // to pass through, since this is only returned on uninstall which is | 1501 // to pass through, since this is only returned on uninstall which is |
1496 // never invoked directly by Google Update. | 1502 // never invoked directly by Google Update. |
1497 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1503 return_code = InstallUtil::GetInstallReturnCode(install_status); |
1498 | 1504 |
1499 VLOG(1) << "Installation complete, returning: " << return_code; | 1505 VLOG(1) << "Installation complete, returning: " << return_code; |
1500 | 1506 |
1501 return return_code; | 1507 return return_code; |
1502 } | 1508 } |
OLD | NEW |