OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 10 #include <string> |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // new_chrome.exe to chrome.exe and delete 'opv' key in one atomic operation. | 119 // new_chrome.exe to chrome.exe and delete 'opv' key in one atomic operation. |
120 installer_util::InstallStatus RenameChromeExecutables( | 120 installer_util::InstallStatus RenameChromeExecutables( |
121 const Package& installation) { | 121 const Package& installation) { |
122 FilePath chrome_exe(installation.path().Append(installer_util::kChromeExe)); | 122 FilePath chrome_exe(installation.path().Append(installer_util::kChromeExe)); |
123 FilePath chrome_old_exe(installation.path().Append( | 123 FilePath chrome_old_exe(installation.path().Append( |
124 installer_util::kChromeOldExe)); | 124 installer_util::kChromeOldExe)); |
125 FilePath chrome_new_exe(installation.path().Append( | 125 FilePath chrome_new_exe(installation.path().Append( |
126 installer_util::kChromeNewExe)); | 126 installer_util::kChromeNewExe)); |
127 | 127 |
128 scoped_ptr<WorkItemList> install_list(WorkItem::CreateWorkItemList()); | 128 scoped_ptr<WorkItemList> install_list(WorkItem::CreateWorkItemList()); |
129 install_list->AddDeleteTreeWorkItem(chrome_old_exe.value(), std::wstring()); | 129 install_list->AddDeleteTreeWorkItem(chrome_old_exe); |
130 FilePath temp_path; | 130 FilePath temp_path; |
131 if (!file_util::CreateNewTempDirectory(L"chrome_", &temp_path)) { | 131 if (!file_util::CreateNewTempDirectory(L"chrome_", &temp_path)) { |
132 LOG(ERROR) << "Failed to create Temp directory " << temp_path.value(); | 132 LOG(ERROR) << "Failed to create Temp directory " << temp_path.value(); |
133 return installer_util::RENAME_FAILED; | 133 return installer_util::RENAME_FAILED; |
134 } | 134 } |
135 | 135 |
136 install_list->AddCopyTreeWorkItem(chrome_new_exe.value(), | 136 install_list->AddCopyTreeWorkItem(chrome_new_exe.value(), |
137 chrome_exe.value(), | 137 chrome_exe.value(), |
138 temp_path.ToWStringHack(), | 138 temp_path.ToWStringHack(), |
139 WorkItem::IF_DIFFERENT, | 139 WorkItem::IF_DIFFERENT, |
140 std::wstring()); | 140 std::wstring()); |
141 install_list->AddDeleteTreeWorkItem(chrome_new_exe.value(), std::wstring()); | 141 install_list->AddDeleteTreeWorkItem(chrome_new_exe); |
142 | 142 |
143 HKEY reg_root = installation.system_level() ? HKEY_LOCAL_MACHINE : | 143 HKEY reg_root = installation.system_level() ? HKEY_LOCAL_MACHINE : |
144 HKEY_CURRENT_USER; | 144 HKEY_CURRENT_USER; |
145 const Products& products = installation.products(); | 145 const Products& products = installation.products(); |
146 for (size_t i = 0; i < products.size(); ++i) { | 146 for (size_t i = 0; i < products.size(); ++i) { |
147 const Product* product = products[i]; | 147 const Product* product = products[i]; |
148 BrowserDistribution* browser_dist = product->distribution(); | 148 BrowserDistribution* browser_dist = product->distribution(); |
149 std::wstring version_key(browser_dist->GetVersionKey()); | 149 std::wstring version_key(browser_dist->GetVersionKey()); |
150 install_list->AddDeleteRegValueWorkItem(reg_root, | 150 install_list->AddDeleteRegValueWorkItem(reg_root, |
151 version_key, | 151 version_key, |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 // to pass through, since this is only returned on uninstall which is | 839 // to pass through, since this is only returned on uninstall which is |
840 // never invoked directly by Google Update. | 840 // never invoked directly by Google Update. |
841 return_code = BrowserDistribution::GetInstallReturnCode(install_status); | 841 return_code = BrowserDistribution::GetInstallReturnCode(install_status); |
842 } | 842 } |
843 } | 843 } |
844 | 844 |
845 VLOG(1) << "Installation complete, returning: " << return_code; | 845 VLOG(1) << "Installation complete, returning: " << return_code; |
846 | 846 |
847 return return_code; | 847 return return_code; |
848 } | 848 } |
OLD | NEW |