| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <shlobj.h> | 5 #include <shlobj.h> |
| 6 | 6 |
| 7 #include "chrome/installer/setup/setup.h" | 7 #include "chrome/installer/setup/setup.h" |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 LOG(INFO) << "Adding Chrome to Media player list at " << reg_path; | 33 LOG(INFO) << "Adding Chrome to Media player list at " << reg_path; |
| 34 scoped_ptr<WorkItem> work_item(WorkItem::CreateCreateRegKeyWorkItem( | 34 scoped_ptr<WorkItem> work_item(WorkItem::CreateCreateRegKeyWorkItem( |
| 35 HKEY_LOCAL_MACHINE, reg_path)); | 35 HKEY_LOCAL_MACHINE, reg_path)); |
| 36 | 36 |
| 37 // if the operation fails we log the error but still continue | 37 // if the operation fails we log the error but still continue |
| 38 if (!work_item.get()->Do()) | 38 if (!work_item.get()->Do()) |
| 39 LOG(ERROR) << "Could not add Chrome to media player inclusion list."; | 39 LOG(ERROR) << "Could not add Chrome to media player inclusion list."; |
| 40 | 40 |
| 41 } | 41 } |
| 42 | 42 |
| 43 void DoFirstInstallTasks(std::wstring install_path, int options) { | 43 void RegisterChromeOnMachine(std::wstring install_path, int options) { |
| 44 bool system_level = (options & installer_util::SYSTEM_LEVEL) != 0; | 44 bool system_level = (options & installer_util::SYSTEM_LEVEL) != 0; |
| 45 // Try to add Chrome to Media Player shim inclusion list. We don't do any | 45 // Try to add Chrome to Media Player shim inclusion list. We don't do any |
| 46 // error checking here because this operation will fail if user doesn't | 46 // error checking here because this operation will fail if user doesn't |
| 47 // have admin rights and we want to ignore the error. | 47 // have admin rights and we want to ignore the error. |
| 48 AddChromeToMediaPlayerList(); | 48 AddChromeToMediaPlayerList(); |
| 49 | 49 |
| 50 // We try to register Chrome as a valid browser on local machine. This | 50 // We try to register Chrome as a valid browser on local machine. This |
| 51 // will work only if current user has admin rights. | 51 // will work only if current user has admin rights. |
| 52 std::wstring chrome_exe(install_path); | 52 std::wstring chrome_exe(install_path); |
| 53 file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe); | 53 file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 LOG(INFO) << "Version updated to " << new_version.GetString(); | 229 LOG(INFO) << "Version updated to " << new_version.GetString(); |
| 230 result = installer_util::NEW_VERSION_UPDATED; | 230 result = installer_util::NEW_VERSION_UPDATED; |
| 231 } else { | 231 } else { |
| 232 NOTREACHED(); | 232 NOTREACHED(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 if (!CreateOrUpdateChromeShortcuts(exe_path, options, result, | 235 if (!CreateOrUpdateChromeShortcuts(exe_path, options, result, |
| 236 install_path, new_version.GetString())) | 236 install_path, new_version.GetString())) |
| 237 LOG(WARNING) << "Failed to create/update start menu shortcut."; | 237 LOG(WARNING) << "Failed to create/update start menu shortcut."; |
| 238 | 238 |
| 239 if (result == installer_util::FIRST_INSTALL_SUCCESS || | 239 RemoveOldVersionDirs(install_path, new_version.GetString()); |
| 240 result == installer_util::INSTALL_REPAIRED) { | 240 |
| 241 DoFirstInstallTasks(install_path, options); | 241 RegisterChromeOnMachine(install_path, options); |
| 242 } else { | |
| 243 RemoveOldVersionDirs(install_path, new_version.GetString()); | |
| 244 } | |
| 245 } | 242 } |
| 246 | 243 |
| 247 return result; | 244 return result; |
| 248 } | 245 } |
| OLD | NEW |