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

Side by Side Diff: chrome/installer/util/shell_util.cc

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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
OLDNEW
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 // This file defines functions that integrate Chrome in Windows shell. These 5 // This file defines functions that integrate Chrome in Windows shell. These
6 // functions can be used by Chrome as well as Chrome installer. All of the 6 // functions can be used by Chrome as well as Chrome installer. All of the
7 // work is done by the local functions defined in anonymous namespace in 7 // work is done by the local functions defined in anonymous namespace in
8 // this class. 8 // this class.
9 9
10 #include "chrome/installer/util/shell_util.h" 10 #include "chrome/installer/util/shell_util.h"
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 const string16& chrome_exe, 685 const string16& chrome_exe,
686 const string16& suffix, 686 const string16& suffix,
687 const string16& protocol) { 687 const string16& protocol) {
688 // Only user-level installs prior to Windows 8 should need to elevate to 688 // Only user-level installs prior to Windows 8 should need to elevate to
689 // register. 689 // register.
690 DCHECK(InstallUtil::IsPerUserInstall(chrome_exe.c_str())); 690 DCHECK(InstallUtil::IsPerUserInstall(chrome_exe.c_str()));
691 DCHECK_LT(base::win::GetVersion(), base::win::VERSION_WIN8); 691 DCHECK_LT(base::win::GetVersion(), base::win::VERSION_WIN8);
692 base::FilePath exe_path = 692 base::FilePath exe_path =
693 base::FilePath::FromWStringHack(chrome_exe).DirName() 693 base::FilePath::FromWStringHack(chrome_exe).DirName()
694 .Append(installer::kSetupExe); 694 .Append(installer::kSetupExe);
695 if (!file_util::PathExists(exe_path)) { 695 if (!base::PathExists(exe_path)) {
696 HKEY reg_root = InstallUtil::IsPerUserInstall(chrome_exe.c_str()) ? 696 HKEY reg_root = InstallUtil::IsPerUserInstall(chrome_exe.c_str()) ?
697 HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE; 697 HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
698 RegKey key(reg_root, dist->GetUninstallRegPath().c_str(), KEY_READ); 698 RegKey key(reg_root, dist->GetUninstallRegPath().c_str(), KEY_READ);
699 string16 uninstall_string; 699 string16 uninstall_string;
700 key.ReadValue(installer::kUninstallStringField, &uninstall_string); 700 key.ReadValue(installer::kUninstallStringField, &uninstall_string);
701 CommandLine command_line = CommandLine::FromString(uninstall_string); 701 CommandLine command_line = CommandLine::FromString(uninstall_string);
702 exe_path = command_line.GetProgram(); 702 exe_path = command_line.GetProgram();
703 } 703 }
704 704
705 if (file_util::PathExists(exe_path)) { 705 if (base::PathExists(exe_path)) {
706 CommandLine cmd(exe_path); 706 CommandLine cmd(exe_path);
707 cmd.AppendSwitchNative(installer::switches::kRegisterChromeBrowser, 707 cmd.AppendSwitchNative(installer::switches::kRegisterChromeBrowser,
708 chrome_exe); 708 chrome_exe);
709 if (!suffix.empty()) { 709 if (!suffix.empty()) {
710 cmd.AppendSwitchNative( 710 cmd.AppendSwitchNative(
711 installer::switches::kRegisterChromeBrowserSuffix, suffix); 711 installer::switches::kRegisterChromeBrowserSuffix, suffix);
712 } 712 }
713 713
714 CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 714 CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
715 if (browser_command_line.HasSwitch(switches::kChromeFrame)) { 715 if (browser_command_line.HasSwitch(switches::kChromeFrame)) {
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 1431
1432 string16 shortcut_name(ExtractShortcutNameFromProperties(dist, properties)); 1432 string16 shortcut_name(ExtractShortcutNameFromProperties(dist, properties));
1433 system_shortcut_path = system_shortcut_path.Append(shortcut_name); 1433 system_shortcut_path = system_shortcut_path.Append(shortcut_name);
1434 1434
1435 base::FilePath* chosen_path; 1435 base::FilePath* chosen_path;
1436 bool should_install_shortcut = true; 1436 bool should_install_shortcut = true;
1437 if (properties.level == SYSTEM_LEVEL) { 1437 if (properties.level == SYSTEM_LEVEL) {
1438 // Install the system-level shortcut if requested. 1438 // Install the system-level shortcut if requested.
1439 chosen_path = &system_shortcut_path; 1439 chosen_path = &system_shortcut_path;
1440 } else if (operation != SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL || 1440 } else if (operation != SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL ||
1441 !file_util::PathExists(system_shortcut_path)) { 1441 !base::PathExists(system_shortcut_path)) {
1442 // Otherwise install the user-level shortcut, unless the system-level 1442 // Otherwise install the user-level shortcut, unless the system-level
1443 // variant of this shortcut is present on the machine and |operation| states 1443 // variant of this shortcut is present on the machine and |operation| states
1444 // not to create a user-level shortcut in that case. 1444 // not to create a user-level shortcut in that case.
1445 if (!GetShortcutPath(location, dist, CURRENT_USER, &user_shortcut_path)) { 1445 if (!GetShortcutPath(location, dist, CURRENT_USER, &user_shortcut_path)) {
1446 NOTREACHED(); 1446 NOTREACHED();
1447 return false; 1447 return false;
1448 } 1448 }
1449 user_shortcut_path = user_shortcut_path.Append(shortcut_name); 1449 user_shortcut_path = user_shortcut_path.Append(shortcut_name);
1450 chosen_path = &user_shortcut_path; 1450 chosen_path = &user_shortcut_path;
1451 } else { 1451 } else {
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
2081 // are any left...). 2081 // are any left...).
2082 if (free_bits >= 8 && next_byte_index < size) { 2082 if (free_bits >= 8 && next_byte_index < size) {
2083 free_bits -= 8; 2083 free_bits -= 8;
2084 bit_stream += bytes[next_byte_index++] << free_bits; 2084 bit_stream += bytes[next_byte_index++] << free_bits;
2085 } 2085 }
2086 } 2086 }
2087 2087
2088 DCHECK_EQ(ret.length(), encoded_length); 2088 DCHECK_EQ(ret.length(), encoded_length);
2089 return ret; 2089 return ret;
2090 } 2090 }
OLDNEW
« no previous file with comments | « chrome/installer/util/self_cleaning_temp_dir.cc ('k') | chrome/installer/util/shell_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698