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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 69 } |
70 | 70 |
71 InstallerState::InstallerState() | 71 InstallerState::InstallerState() |
72 : operation_(UNINITIALIZED), | 72 : operation_(UNINITIALIZED), |
73 multi_package_distribution_(NULL), | 73 multi_package_distribution_(NULL), |
74 level_(UNKNOWN_LEVEL), | 74 level_(UNKNOWN_LEVEL), |
75 package_type_(UNKNOWN_PACKAGE_TYPE), | 75 package_type_(UNKNOWN_PACKAGE_TYPE), |
76 state_type_(BrowserDistribution::CHROME_BROWSER), | 76 state_type_(BrowserDistribution::CHROME_BROWSER), |
77 root_key_(NULL), | 77 root_key_(NULL), |
78 msi_(false), | 78 msi_(false), |
79 verbose_logging_(false) { | 79 verbose_logging_(false), |
| 80 ensure_google_update_present_(false) { |
80 } | 81 } |
81 | 82 |
82 InstallerState::InstallerState(Level level) | 83 InstallerState::InstallerState(Level level) |
83 : operation_(UNINITIALIZED), | 84 : operation_(UNINITIALIZED), |
84 multi_package_distribution_(NULL), | 85 multi_package_distribution_(NULL), |
85 level_(UNKNOWN_LEVEL), | 86 level_(UNKNOWN_LEVEL), |
86 package_type_(UNKNOWN_PACKAGE_TYPE), | 87 package_type_(UNKNOWN_PACKAGE_TYPE), |
87 state_type_(BrowserDistribution::CHROME_BROWSER), | 88 state_type_(BrowserDistribution::CHROME_BROWSER), |
88 root_key_(NULL), | 89 root_key_(NULL), |
89 msi_(false), | 90 msi_(false), |
90 verbose_logging_(false) { | 91 verbose_logging_(false), |
| 92 ensure_google_update_present_(false) { |
91 // Use set_level() so that root_key_ is updated properly. | 93 // Use set_level() so that root_key_ is updated properly. |
92 set_level(level); | 94 set_level(level); |
93 } | 95 } |
94 | 96 |
95 void InstallerState::Initialize(const CommandLine& command_line, | 97 void InstallerState::Initialize(const CommandLine& command_line, |
96 const MasterPreferences& prefs, | 98 const MasterPreferences& prefs, |
97 const InstallationState& machine_state) { | 99 const InstallationState& machine_state) { |
98 bool pref_bool; | 100 bool pref_bool; |
99 if (!prefs.GetBool(master_preferences::kSystemLevel, &pref_bool)) | 101 if (!prefs.GetBool(master_preferences::kSystemLevel, &pref_bool)) |
100 pref_bool = false; | 102 pref_bool = false; |
101 set_level(pref_bool ? SYSTEM_LEVEL : USER_LEVEL); | 103 set_level(pref_bool ? SYSTEM_LEVEL : USER_LEVEL); |
102 | 104 |
103 if (!prefs.GetBool(master_preferences::kVerboseLogging, &verbose_logging_)) | 105 if (!prefs.GetBool(master_preferences::kVerboseLogging, &verbose_logging_)) |
104 verbose_logging_ = false; | 106 verbose_logging_ = false; |
105 | 107 |
106 if (!prefs.GetBool(master_preferences::kMultiInstall, &pref_bool)) | 108 if (!prefs.GetBool(master_preferences::kMultiInstall, &pref_bool)) |
107 pref_bool = false; | 109 pref_bool = false; |
108 set_package_type(pref_bool ? MULTI_PACKAGE : SINGLE_PACKAGE); | 110 set_package_type(pref_bool ? MULTI_PACKAGE : SINGLE_PACKAGE); |
109 | 111 |
110 if (!prefs.GetBool(master_preferences::kMsi, &msi_)) | 112 if (!prefs.GetBool(master_preferences::kMsi, &msi_)) |
111 msi_ = false; | 113 msi_ = false; |
112 | 114 |
| 115 ensure_google_update_present_ = |
| 116 command_line.HasSwitch(installer::switches::kEnsureGoogleUpdatePresent); |
| 117 |
113 const bool is_uninstall = command_line.HasSwitch(switches::kUninstall); | 118 const bool is_uninstall = command_line.HasSwitch(switches::kUninstall); |
114 | 119 |
115 if (prefs.install_chrome()) { | 120 if (prefs.install_chrome()) { |
116 Product* p = | 121 Product* p = |
117 AddProductFromPreferences(BrowserDistribution::CHROME_BROWSER, prefs, | 122 AddProductFromPreferences(BrowserDistribution::CHROME_BROWSER, prefs, |
118 machine_state); | 123 machine_state); |
119 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") | 124 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") |
120 << " distribution: " << p->distribution()->GetAppShortCutName(); | 125 << " distribution: " << p->distribution()->GetAppShortCutName(); |
121 } | 126 } |
122 if (prefs.install_chrome_frame()) { | 127 if (prefs.install_chrome_frame()) { |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 if (is_multi_install()) { | 740 if (is_multi_install()) { |
736 InstallUtil::AddInstallerResultItems( | 741 InstallUtil::AddInstallerResultItems( |
737 system_install, multi_package_binaries_distribution()->GetStateKey(), | 742 system_install, multi_package_binaries_distribution()->GetStateKey(), |
738 status, string_resource_id, launch_cmd, install_list.get()); | 743 status, string_resource_id, launch_cmd, install_list.get()); |
739 } | 744 } |
740 if (!install_list->Do()) | 745 if (!install_list->Do()) |
741 LOG(ERROR) << "Failed to record installer error information in registry."; | 746 LOG(ERROR) << "Failed to record installer error information in registry."; |
742 } | 747 } |
743 | 748 |
744 } // namespace installer | 749 } // namespace installer |
OLD | NEW |