| 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/setup/install.h" | 5 #include "chrome/installer/setup/install.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shlobj.h> | 8 #include <shlobj.h> |
| 9 #include <time.h> | 9 #include <time.h> |
| 10 | 10 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 base::FilePath new_chrome_exe( | 205 base::FilePath new_chrome_exe( |
| 206 installer_state.target_path().Append(installer::kChromeNewExe)); | 206 installer_state.target_path().Append(installer::kChromeNewExe)); |
| 207 | 207 |
| 208 installer_state.UpdateStage(installer::EXECUTING); | 208 installer_state.UpdateStage(installer::EXECUTING); |
| 209 | 209 |
| 210 if (!install_list->Do()) { | 210 if (!install_list->Do()) { |
| 211 installer_state.UpdateStage(installer::ROLLINGBACK); | 211 installer_state.UpdateStage(installer::ROLLINGBACK); |
| 212 installer::InstallStatus result = | 212 installer::InstallStatus result = |
| 213 base::PathExists(new_chrome_exe) && current_version->get() && | 213 base::PathExists(new_chrome_exe) && current_version->get() && |
| 214 new_version.Equals(*current_version->get()) ? | 214 new_version == *current_version->get() ? |
| 215 installer::SAME_VERSION_REPAIR_FAILED : | 215 installer::SAME_VERSION_REPAIR_FAILED : |
| 216 installer::INSTALL_FAILED; | 216 installer::INSTALL_FAILED; |
| 217 LOG(ERROR) << "Install failed, rolling back... result: " << result; | 217 LOG(ERROR) << "Install failed, rolling back... result: " << result; |
| 218 install_list->Rollback(); | 218 install_list->Rollback(); |
| 219 LOG(ERROR) << "Rollback complete. "; | 219 LOG(ERROR) << "Rollback complete. "; |
| 220 return result; | 220 return result; |
| 221 } | 221 } |
| 222 | 222 |
| 223 installer_state.UpdateStage(installer::REFRESHING_POLICY); | 223 installer_state.UpdateStage(installer::REFRESHING_POLICY); |
| 224 | 224 |
| 225 installer::RefreshElevationPolicy(); | 225 installer::RefreshElevationPolicy(); |
| 226 | 226 |
| 227 if (!current_version->get()) { | 227 if (!current_version->get()) { |
| 228 VLOG(1) << "First install of version " << new_version.GetString(); | 228 VLOG(1) << "First install of version " << new_version; |
| 229 return installer::FIRST_INSTALL_SUCCESS; | 229 return installer::FIRST_INSTALL_SUCCESS; |
| 230 } | 230 } |
| 231 | 231 |
| 232 if (new_version.Equals(**current_version)) { | 232 if (new_version == **current_version) { |
| 233 VLOG(1) << "Install repaired of version " << new_version.GetString(); | 233 VLOG(1) << "Install repaired of version " << new_version; |
| 234 return installer::INSTALL_REPAIRED; | 234 return installer::INSTALL_REPAIRED; |
| 235 } | 235 } |
| 236 | 236 |
| 237 if (new_version.CompareTo(**current_version) > 0) { | 237 if (new_version > **current_version) { |
| 238 if (base::PathExists(new_chrome_exe)) { | 238 if (base::PathExists(new_chrome_exe)) { |
| 239 VLOG(1) << "Version updated to " << new_version.GetString() | 239 VLOG(1) << "Version updated to " << new_version |
| 240 << " while running " << (*current_version)->GetString(); | 240 << " while running " << **current_version; |
| 241 return installer::IN_USE_UPDATED; | 241 return installer::IN_USE_UPDATED; |
| 242 } | 242 } |
| 243 VLOG(1) << "Version updated to " << new_version.GetString(); | 243 VLOG(1) << "Version updated to " << new_version; |
| 244 return installer::NEW_VERSION_UPDATED; | 244 return installer::NEW_VERSION_UPDATED; |
| 245 } | 245 } |
| 246 | 246 |
| 247 LOG(ERROR) << "Not sure how we got here while updating" | 247 LOG(ERROR) << "Not sure how we got here while updating" |
| 248 << ", new version: " << new_version.GetString() | 248 << ", new version: " << new_version |
| 249 << ", old version: " << (*current_version)->GetString(); | 249 << ", old version: " << **current_version; |
| 250 | 250 |
| 251 return installer::INSTALL_FAILED; | 251 return installer::INSTALL_FAILED; |
| 252 } | 252 } |
| 253 | 253 |
| 254 } // end namespace | 254 } // end namespace |
| 255 | 255 |
| 256 namespace installer { | 256 namespace installer { |
| 257 | 257 |
| 258 void EscapeXmlAttributeValueInSingleQuotes(base::string16* att_value) { | 258 void EscapeXmlAttributeValueInSingleQuotes(base::string16* att_value) { |
| 259 base::ReplaceChars(*att_value, base::ASCIIToUTF16("&"), | 259 base::ReplaceChars(*att_value, base::ASCIIToUTF16("&"), |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 // Read master_preferences copied beside chrome.exe at install. | 653 // Read master_preferences copied beside chrome.exe at install. |
| 654 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); | 654 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); |
| 655 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); | 655 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); |
| 656 CreateOrUpdateShortcuts( | 656 CreateOrUpdateShortcuts( |
| 657 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); | 657 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); |
| 658 | 658 |
| 659 UpdateDefaultBrowserBeaconForPath(chrome_exe); | 659 UpdateDefaultBrowserBeaconForPath(chrome_exe); |
| 660 } | 660 } |
| 661 | 661 |
| 662 } // namespace installer | 662 } // namespace installer |
| OLD | NEW |