Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: chrome/installer/setup/install.cc

Issue 271099: Re-try r29078: Remove some deprecated file_util wstring functions. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/chrome_plugin_util.cc ('k') | chrome/installer/setup/setup_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include <time.h> 6 #include <time.h>
7 7
8 #include "chrome/installer/setup/install.h" 8 #include "chrome/installer/setup/install.h"
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 L"InstallDate", 150 L"InstallDate",
151 buffer, false); 151 buffer, false);
152 } 152 }
153 } 153 }
154 154
155 // Copy master preferences file provided to installer, in the same folder 155 // Copy master preferences file provided to installer, in the same folder
156 // as chrome.exe so Chrome first run can find it. This function will be called 156 // as chrome.exe so Chrome first run can find it. This function will be called
157 // only on the first install of Chrome. 157 // only on the first install of Chrome.
158 void CopyPreferenceFileForFirstRun(bool system_level, 158 void CopyPreferenceFileForFirstRun(bool system_level,
159 const std::wstring& prefs_source_path) { 159 const std::wstring& prefs_source_path) {
160 std::wstring prefs_dest_path( 160 FilePath prefs_dest_path = FilePath::FromWStringHack(
161 installer::GetChromeInstallPath(system_level)); 161 installer::GetChromeInstallPath(system_level));
162 file_util::AppendToPath(&prefs_dest_path, 162 prefs_dest_path = prefs_dest_path.Append(installer_util::kDefaultMasterPrefs);
163 installer_util::kDefaultMasterPrefs); 163 if (!file_util::CopyFile(FilePath::FromWStringHack(prefs_source_path),
164 if (!file_util::CopyFile(prefs_source_path, prefs_dest_path)) 164 prefs_dest_path)) {
165 LOG(INFO) << "Failed to copy master preferences."; 165 LOG(INFO) << "Failed to copy master preferences.";
166 }
166 } 167 }
167 168
168 // This method creates Chrome shortcuts in Start->Programs for all users or 169 // This method creates Chrome shortcuts in Start->Programs for all users or
169 // only for current user depending on whether it is system wide install or 170 // only for current user depending on whether it is system wide install or
170 // user only install. 171 // user only install.
171 // 172 //
172 // If first_install is true, it creates shortcuts for launching and 173 // If first_install is true, it creates shortcuts for launching and
173 // uninstalling chrome. 174 // uninstalling chrome.
174 // If first_install is false, the function only updates the shortcut for 175 // If first_install is false, the function only updates the shortcut for
175 // uninstalling chrome. According to 176 // uninstalling chrome. According to
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 // false. 298 // false.
298 bool DoPostInstallTasks(HKEY reg_root, 299 bool DoPostInstallTasks(HKEY reg_root,
299 const std::wstring& exe_path, 300 const std::wstring& exe_path,
300 const std::wstring& install_path, 301 const std::wstring& install_path,
301 const std::wstring& new_chrome_exe, 302 const std::wstring& new_chrome_exe,
302 const std::wstring& current_version, 303 const std::wstring& current_version,
303 const installer::Version& new_version) { 304 const installer::Version& new_version) {
304 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 305 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
305 std::wstring version_key = dist->GetVersionKey(); 306 std::wstring version_key = dist->GetVersionKey();
306 307
307 if (file_util::PathExists(new_chrome_exe)) { 308 if (file_util::PathExists(FilePath::FromWStringHack(new_chrome_exe))) {
308 // Looks like this was in use update. So make sure we update the 'opv' key 309 // Looks like this was in use update. So make sure we update the 'opv' key
309 // with the current version that is active and 'cmd' key with the rename 310 // with the current version that is active and 'cmd' key with the rename
310 // command to run. 311 // command to run.
311 if (current_version.empty()) { 312 if (current_version.empty()) {
312 LOG(ERROR) << "New chrome.exe exists but current version is empty!"; 313 LOG(ERROR) << "New chrome.exe exists but current version is empty!";
313 return false; 314 return false;
314 } 315 }
315 scoped_ptr<WorkItemList> inuse_list(WorkItem::CreateWorkItemList()); 316 scoped_ptr<WorkItemList> inuse_list(WorkItem::CreateWorkItemList());
316 inuse_list->AddSetRegValueWorkItem(reg_root, 317 inuse_list->AddSetRegValueWorkItem(reg_root,
317 version_key, 318 version_key,
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 AppendPath(install_path, new_version.GetString()), 486 AppendPath(install_path, new_version.GetString()),
486 temp_dir); 487 temp_dir);
487 } 488 }
488 489
489 // Delete any new_chrome.exe if present (we will end up creating a new one 490 // Delete any new_chrome.exe if present (we will end up creating a new one
490 // if required) and then copy chrome.exe 491 // if required) and then copy chrome.exe
491 std::wstring new_chrome_exe = AppendPath(install_path, 492 std::wstring new_chrome_exe = AppendPath(install_path,
492 installer_util::kChromeNewExe); 493 installer_util::kChromeNewExe);
493 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 494 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
494 RegKey chrome_key(reg_root, dist->GetVersionKey().c_str(), KEY_READ); 495 RegKey chrome_key(reg_root, dist->GetVersionKey().c_str(), KEY_READ);
495 if (file_util::PathExists(new_chrome_exe)) 496 if (file_util::PathExists(FilePath::FromWStringHack(new_chrome_exe)))
496 chrome_key.ReadValue(google_update::kRegOldVersionField, current_version); 497 chrome_key.ReadValue(google_update::kRegOldVersionField, current_version);
497 if (current_version->empty()) 498 if (current_version->empty())
498 chrome_key.ReadValue(google_update::kRegVersionField, current_version); 499 chrome_key.ReadValue(google_update::kRegVersionField, current_version);
499 chrome_key.Close(); 500 chrome_key.Close();
500 501
501 install_list->AddDeleteTreeWorkItem(new_chrome_exe, std::wstring()); 502 install_list->AddDeleteTreeWorkItem(new_chrome_exe, std::wstring());
502 install_list->AddCopyTreeWorkItem( 503 install_list->AddCopyTreeWorkItem(
503 AppendPath(src_path, installer_util::kChromeExe), 504 AppendPath(src_path, installer_util::kChromeExe),
504 AppendPath(install_path, installer_util::kChromeExe), 505 AppendPath(install_path, installer_util::kChromeExe),
505 temp_dir, WorkItem::NEW_NAME_IF_IN_USE, new_chrome_exe); 506 temp_dir, WorkItem::NEW_NAME_IF_IN_USE, new_chrome_exe);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 } 635 }
635 636
636 std::wstring latest_version_to_keep(new_version.GetString()); 637 std::wstring latest_version_to_keep(new_version.GetString());
637 if (!current_version.empty()) 638 if (!current_version.empty())
638 latest_version_to_keep.assign(current_version); 639 latest_version_to_keep.assign(current_version);
639 RemoveOldVersionDirs(install_path, latest_version_to_keep); 640 RemoveOldVersionDirs(install_path, latest_version_to_keep);
640 } 641 }
641 642
642 return result; 643 return result;
643 } 644 }
OLDNEW
« no previous file with comments | « chrome/common/chrome_plugin_util.cc ('k') | chrome/installer/setup/setup_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698