OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "base/win/registry.h" | 17 #include "base/win/registry.h" |
18 #include "chrome/installer/util/delete_tree_work_item.h" | 18 #include "chrome/installer/util/delete_tree_work_item.h" |
19 #include "chrome/installer/util/helper.h" | 19 #include "chrome/installer/util/helper.h" |
20 #include "chrome/installer/util/install_util.h" | 20 #include "chrome/installer/util/install_util.h" |
21 #include "chrome/installer/util/installation_state.h" | 21 #include "chrome/installer/util/installation_state.h" |
22 #include "chrome/installer/util/master_preferences.h" | 22 #include "chrome/installer/util/master_preferences.h" |
23 #include "chrome/installer/util/master_preferences_constants.h" | 23 #include "chrome/installer/util/master_preferences_constants.h" |
24 #include "chrome/installer/util/product.h" | 24 #include "chrome/installer/util/product.h" |
25 #include "chrome/installer/util/work_item.h" | 25 #include "chrome/installer/util/work_item.h" |
| 26 #include "chrome/installer/util/work_item_list.h" |
26 | 27 |
27 namespace installer { | 28 namespace installer { |
28 | 29 |
29 bool InstallerState::IsMultiInstallUpdate(const MasterPreferences& prefs, | 30 bool InstallerState::IsMultiInstallUpdate(const MasterPreferences& prefs, |
30 const InstallationState& machine_state) { | 31 const InstallationState& machine_state) { |
31 // First, is the package present? | 32 // First, is the package present? |
32 const ProductState* package = | 33 const ProductState* package = |
33 machine_state.GetProductState(level_ == SYSTEM_LEVEL, | 34 machine_state.GetProductState(level_ == SYSTEM_LEVEL, |
34 BrowserDistribution::CHROME_BINARIES); | 35 BrowserDistribution::CHROME_BINARIES); |
35 if (package == NULL) { | 36 if (package == NULL) { |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 LOG(ERROR) << "Failed opening key " << dist->GetStateKey() | 526 LOG(ERROR) << "Failed opening key " << dist->GetStateKey() |
526 << " to update app channels; result: " << result; | 527 << " to update app channels; result: " << result; |
527 } | 528 } |
528 } | 529 } |
529 } else { | 530 } else { |
530 LOG(ERROR) << "Failed opening key " << state_key_ | 531 LOG(ERROR) << "Failed opening key " << state_key_ |
531 << " to update app channels; result: " << result; | 532 << " to update app channels; result: " << result; |
532 } | 533 } |
533 } | 534 } |
534 | 535 |
| 536 void InstallerState::WriteInstallerResult( |
| 537 InstallStatus status, |
| 538 int string_resource_id, |
| 539 const std::wstring* const launch_cmd) const { |
| 540 DWORD installer_result = |
| 541 (InstallUtil::GetInstallReturnCode(status) == 0) ? 0 : 1; |
| 542 // Use a no-rollback list since this is a best-effort deal. |
| 543 scoped_ptr<WorkItemList> install_list( |
| 544 WorkItem::CreateNoRollbackWorkItemList()); |
| 545 const bool system_install = this->system_install(); |
| 546 // Write the value for all products upon which we're operating. |
| 547 Products::const_iterator end = products().end(); |
| 548 for (Products::const_iterator scan = products().begin(); scan != end; |
| 549 ++scan) { |
| 550 InstallUtil::AddInstallerResultItems( |
| 551 system_install, (*scan)->distribution()->GetStateKey(), status, |
| 552 string_resource_id, launch_cmd, install_list.get()); |
| 553 } |
| 554 // And for the binaries if this is a multi-install. |
| 555 if (is_multi_install()) { |
| 556 InstallUtil::AddInstallerResultItems( |
| 557 system_install, multi_package_binaries_distribution()->GetStateKey(), |
| 558 status, string_resource_id, launch_cmd, install_list.get()); |
| 559 } |
| 560 if (!install_list->Do()) |
| 561 LOG(ERROR) << "Failed to record installer error information in registry."; |
| 562 } |
| 563 |
535 } // namespace installer | 564 } // namespace installer |
OLD | NEW |