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

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

Issue 164390: Merge 22314 - Use alternate icon for Chrome shortcuts if specified in master ... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 years, 4 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/installer/setup/install.cc ('k') | chrome/installer/util/master_preferences.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Modified: svn:mergeinfo
Merged /trunk/src/chrome/installer/setup/setup_main.cc:r22314
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 <string> 5 #include <string>
6 #include <windows.h> 6 #include <windows.h>
7 #include <msi.h> 7 #include <msi.h>
8 #include <shlobj.h> 8 #include <shlobj.h>
9 9
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 installer_util::SetDistroBooleanPreference( 238 installer_util::SetDistroBooleanPreference(
239 prefs, installer_util::master_preferences::kVerboseLogging, true); 239 prefs, installer_util::master_preferences::kVerboseLogging, true);
240 240
241 if (cmd_line.HasSwitch(installer_util::switches::kAltDesktopShortcut)) 241 if (cmd_line.HasSwitch(installer_util::switches::kAltDesktopShortcut))
242 installer_util::SetDistroBooleanPreference( 242 installer_util::SetDistroBooleanPreference(
243 prefs, installer_util::master_preferences::kAltShortcutText, true); 243 prefs, installer_util::master_preferences::kAltShortcutText, true);
244 244
245 return prefs; 245 return prefs;
246 } 246 }
247 247
248 // Copy master preferences file provided to installer, in the same folder
249 // as chrome.exe so Chrome first run can find it. This function will be called
250 // only on the first install of Chrome.
251 void CopyPreferenceFileForFirstRun(bool system_level,
252 const CommandLine& cmd_line) {
253 std::wstring prefs_source_path = cmd_line.GetSwitchValue(
254 installer_util::switches::kInstallerData);
255 std::wstring prefs_dest_path(
256 installer::GetChromeInstallPath(system_level));
257 file_util::AppendToPath(&prefs_dest_path,
258 installer_util::kDefaultMasterPrefs);
259 if (!file_util::CopyFile(prefs_source_path, prefs_dest_path))
260 LOG(ERROR) << "failed copying master profile";
261 }
262
263 bool CheckPreInstallConditions(const installer::Version* installed_version, 248 bool CheckPreInstallConditions(const installer::Version* installed_version,
264 bool system_install, 249 bool system_install,
265 installer_util::InstallStatus& status) { 250 installer_util::InstallStatus& status) {
266 // Check to avoid simultaneous per-user and per-machine installs. 251 // Check to avoid simultaneous per-user and per-machine installs.
267 scoped_ptr<installer::Version> 252 scoped_ptr<installer::Version>
268 chrome_version(InstallUtil::GetChromeVersion(!system_install)); 253 chrome_version(InstallUtil::GetChromeVersion(!system_install));
269 if (chrome_version.get()) { 254 if (chrome_version.get()) {
270 LOG(ERROR) << "Already installed version " << chrome_version->GetString() 255 LOG(ERROR) << "Already installed version " << chrome_version->GetString()
271 << " conflicts with the current install mode."; 256 << " conflicts with the current install mode.";
272 status = system_install ? installer_util::USER_LEVEL_INSTALL_EXISTS : 257 status = system_install ? installer_util::USER_LEVEL_INSTALL_EXISTS :
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 install_status = installer_util::HIGHER_VERSION_EXISTS; 347 install_status = installer_util::HIGHER_VERSION_EXISTS;
363 InstallUtil::WriteInstallerResult(system_level, install_status, 348 InstallUtil::WriteInstallerResult(system_level, install_status,
364 IDS_INSTALL_HIGHER_VERSION_BASE, 349 IDS_INSTALL_HIGHER_VERSION_BASE,
365 NULL); 350 NULL);
366 } else { 351 } else {
367 // We want to keep uncompressed archive (chrome.7z) that we get after 352 // We want to keep uncompressed archive (chrome.7z) that we get after
368 // uncompressing and binary patching. Get the location for this file. 353 // uncompressing and binary patching. Get the location for this file.
369 std::wstring archive_to_copy(temp_path); 354 std::wstring archive_to_copy(temp_path);
370 file_util::AppendToPath(&archive_to_copy, 355 file_util::AppendToPath(&archive_to_copy,
371 std::wstring(installer::kChromeArchive)); 356 std::wstring(installer::kChromeArchive));
357 std::wstring prefs_source_path = cmd_line.GetSwitchValue(
358 installer_util::switches::kInstallerData);
372 install_status = installer::InstallOrUpdateChrome( 359 install_status = installer::InstallOrUpdateChrome(
373 cmd_line.program(), archive_to_copy, temp_path, prefs, 360 cmd_line.program(), archive_to_copy, temp_path, prefs_source_path,
374 *installer_version, installed_version); 361 prefs, *installer_version, installed_version);
375 362
376 int install_msg_base = IDS_INSTALL_FAILED_BASE; 363 int install_msg_base = IDS_INSTALL_FAILED_BASE;
377 std::wstring chrome_exe; 364 std::wstring chrome_exe;
378 if (install_status != installer_util::INSTALL_FAILED) { 365 if (install_status != installer_util::INSTALL_FAILED) {
379 chrome_exe = installer::GetChromeInstallPath(system_level); 366 chrome_exe = installer::GetChromeInstallPath(system_level);
380 if (chrome_exe.empty()) { 367 if (chrome_exe.empty()) {
381 // If we failed to construct install path, it means the OS call to 368 // If we failed to construct install path, it means the OS call to
382 // get %ProgramFiles% or %AppData% failed. Report this as failure. 369 // get %ProgramFiles% or %AppData% failed. Report this as failure.
383 install_msg_base = IDS_INSTALL_OS_ERROR_BASE; 370 install_msg_base = IDS_INSTALL_OS_ERROR_BASE;
384 install_status = installer_util::OS_ERROR; 371 install_status = installer_util::OS_ERROR;
385 } else { 372 } else {
386 file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe); 373 file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe);
387 chrome_exe = L"\"" + chrome_exe + L"\""; 374 chrome_exe = L"\"" + chrome_exe + L"\"";
388 install_msg_base = 0; 375 install_msg_base = 0;
389 } 376 }
390 } 377 }
391 InstallUtil::WriteInstallerResult(system_level, install_status, 378 InstallUtil::WriteInstallerResult(system_level, install_status,
392 install_msg_base, &chrome_exe); 379 install_msg_base, &chrome_exe);
393 if (install_status == installer_util::FIRST_INSTALL_SUCCESS) { 380 if (install_status == installer_util::FIRST_INSTALL_SUCCESS) {
394 LOG(INFO) << "First install successful."; 381 LOG(INFO) << "First install successful.";
395 CopyPreferenceFileForFirstRun(system_level, cmd_line);
396 // We never want to launch Chrome in system level install mode. 382 // We never want to launch Chrome in system level install mode.
397 if (!system_level && !installer_util::GetDistroBooleanPreference(prefs , 383 if (!system_level && !installer_util::GetDistroBooleanPreference(prefs ,
398 installer_util::master_preferences::kDoNotLaunchChrome)) 384 installer_util::master_preferences::kDoNotLaunchChrome))
399 installer::LaunchChrome(system_level); 385 installer::LaunchChrome(system_level);
400 } 386 }
401 } 387 }
402 } 388 }
403 // There might be an experiment (for upgrade usually) that needs to happen. 389 // There might be an experiment (for upgrade usually) that needs to happen.
404 // An experiment's outcome can include chrome's uninstallation. If that is 390 // An experiment's outcome can include chrome's uninstallation. If that is
405 // the case we would not do that directly at this point but in another 391 // the case we would not do that directly at this point but in another
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 } else { 653 } else {
668 install_status = InstallChrome(parsed_command_line, 654 install_status = InstallChrome(parsed_command_line,
669 installed_version.get(), 655 installed_version.get(),
670 prefs.get()); 656 prefs.get());
671 } 657 }
672 658
673 CoUninitialize(); 659 CoUninitialize();
674 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 660 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
675 return dist->GetInstallReturnCode(install_status); 661 return dist->GetInstallReturnCode(install_status);
676 } 662 }
OLDNEW
« no previous file with comments | « chrome/installer/setup/install.cc ('k') | chrome/installer/util/master_preferences.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698