summaryrefslogtreecommitdiff
path: root/chrome/installer
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2014-03-18 10:20:56 +0000
committerTorne (Richard Coles) <torne@google.com>2014-03-18 10:20:56 +0000
commita1401311d1ab56c4ed0a474bd38c108f75cb0cd9 (patch)
tree3437151d9ae1ce20a1e53a0d98c19ca01c786394 /chrome/installer
parentaf5066f1e36c6579e74752647e6c584438f80f94 (diff)
downloadchromium_org-a1401311d1ab56c4ed0a474bd38c108f75cb0cd9.tar.gz
Merge from Chromium at DEPS revision 257591
This commit was generated by merge_to_master.py. Change-Id: I0010df2ec3fbb5d4947cd026de2feb150ce7a6b5
Diffstat (limited to 'chrome/installer')
-rw-r--r--chrome/installer/installer_tools.gyp2
-rwxr-xr-xchrome/installer/linux/debian/build.sh16
-rw-r--r--chrome/installer/linux/debian/expected_deps2
-rwxr-xr-xchrome/installer/mac/dmgdiffer.sh12
-rwxr-xr-xchrome/installer/mac/keystone_install.sh46
-rw-r--r--chrome/installer/mini_installer.gyp2
-rw-r--r--chrome/installer/mini_installer/mini_installer_exe_version.rc.version6
-rw-r--r--chrome/installer/mini_installer_syzygy.gyp4
-rw-r--r--chrome/installer/setup/install.cc5
-rw-r--r--chrome/installer/setup/install_unittest.cc2
-rw-r--r--chrome/installer/setup/install_worker.cc17
-rw-r--r--chrome/installer/setup/install_worker.h4
-rw-r--r--chrome/installer/setup/setup.vcproj137
-rw-r--r--chrome/installer/setup/setup.vsprops29
-rw-r--r--chrome/installer/setup/setup_debug.vsprops8
-rw-r--r--chrome/installer/setup/setup_exe_version.rc.version6
-rw-r--r--chrome/installer/setup/setup_main.cc33
-rw-r--r--chrome/installer/setup/setup_main.h5
-rw-r--r--chrome/installer/setup/setup_release.vsprops8
-rw-r--r--chrome/installer/setup/setup_util.cc8
-rw-r--r--chrome/installer/setup/setup_util.h10
-rw-r--r--chrome/installer/setup/setup_util_unittest.cc6
-rw-r--r--chrome/installer/setup/uninstall.cc72
-rw-r--r--chrome/installer/setup/uninstall.h4
-rw-r--r--chrome/installer/test/alternate_version_generator.cc53
-rw-r--r--chrome/installer/upgrade_test.gyp2
-rw-r--r--chrome/installer/util/browser_distribution.cc8
-rw-r--r--chrome/installer/util/chrome_app_host_operations.h6
-rw-r--r--chrome/installer/util/chrome_binaries_operations.h6
-rw-r--r--chrome/installer/util/chrome_browser_operations.h6
-rw-r--r--chrome/installer/util/chrome_browser_sxs_operations.h4
-rw-r--r--chrome/installer/util/chrome_frame_operations.h6
-rw-r--r--chrome/installer/util/eula_util.cc14
-rw-r--r--chrome/installer/util/fake_product_state.h2
-rw-r--r--chrome/installer/util/google_chrome_distribution.cc8
-rw-r--r--chrome/installer/util/google_chrome_sxs_distribution.cc9
-rw-r--r--chrome/installer/util/google_update_settings.cc21
-rw-r--r--chrome/installer/util/google_update_settings.h4
-rw-r--r--chrome/installer/util/google_update_util.cc43
-rw-r--r--chrome/installer/util/google_update_util.h7
-rw-r--r--chrome/installer/util/helper.cc1
-rw-r--r--chrome/installer/util/install_util.cc88
-rw-r--r--chrome/installer/util/install_util.h19
-rw-r--r--chrome/installer/util/install_util_unittest.cc2
-rw-r--r--chrome/installer/util/installation_state.cc7
-rw-r--r--chrome/installer/util/installation_state.h6
-rw-r--r--chrome/installer/util/installation_validator.h7
-rw-r--r--chrome/installer/util/installer_state.cc4
-rw-r--r--chrome/installer/util/installer_state.h4
-rw-r--r--chrome/installer/util/installer_state_unittest.cc2
-rw-r--r--chrome/installer/util/logging_installer.cc25
-rw-r--r--chrome/installer/util/logging_installer_unittest.cc28
-rw-r--r--chrome/installer/util/master_preferences.h4
-rw-r--r--chrome/installer/util/master_preferences_unittest.cc8
-rw-r--r--chrome/installer/util/move_tree_work_item_unittest.cc5
-rw-r--r--chrome/installer/util/product.h11
-rw-r--r--chrome/installer/util/product_operations.h9
-rw-r--r--chrome/installer/util/self_cleaning_temp_dir_unittest.cc4
-rw-r--r--chrome/installer/util/shell_util.cc64
-rw-r--r--chrome/installer/util/shell_util.h5
-rw-r--r--chrome/installer/util/shell_util_unittest.cc14
-rw-r--r--chrome/installer/util/user_experiment.cc2
-rw-r--r--chrome/installer/util/user_experiment.h5
-rw-r--r--chrome/installer/util/util_constants.cc4
-rw-r--r--chrome/installer/util/util_constants.h7
65 files changed, 385 insertions, 593 deletions
diff --git a/chrome/installer/installer_tools.gyp b/chrome/installer/installer_tools.gyp
index 7af6c489db..b9508fda54 100644
--- a/chrome/installer/installer_tools.gyp
+++ b/chrome/installer/installer_tools.gyp
@@ -4,7 +4,7 @@
{
'variables': {
- 'version_py': '<(DEPTH)/chrome/tools/build/version.py',
+ 'version_py': '<(DEPTH)/build/util/version.py',
'version_path': '<(DEPTH)/chrome/VERSION',
'lastchange_path': '<(DEPTH)/build/util/LASTCHANGE',
# 'branding_dir' is set in the 'conditions' section at the bottom.
diff --git a/chrome/installer/linux/debian/build.sh b/chrome/installer/linux/debian/build.sh
index 4db53cb98b..b25a757339 100755
--- a/chrome/installer/linux/debian/build.sh
+++ b/chrome/installer/linux/debian/build.sh
@@ -65,11 +65,7 @@ stage_install_debian() {
# Avoid file collisions between channels.
local INSTALLDIR="${INSTALLDIR}-${CHANNEL}"
- # TODO(phajdan.jr): Do that for all packages for SxS,
- # http://crbug.com/38598 .
- if [ "$CHANNEL" = "trunk" ] || [ "$CHANNEL" = "asan" ]; then
- local PACKAGE="${PACKAGE}-${CHANNEL}"
- fi
+ local PACKAGE="${PACKAGE}-${CHANNEL}"
# Make it possible to distinguish between menu entries
# for different channels.
@@ -104,13 +100,9 @@ do_package() {
echo "Packaging ${ARCHITECTURE}..."
PREDEPENDS="$COMMON_PREDEPS"
DEPENDS="${COMMON_DEPS}"
- # Trunk is a special package, mostly for development testing, so don't make
- # it replace any installed release packages.
- if [ "$CHANNEL" != "trunk" ] && [ "$CHANNEL" != "asan" ]; then
- REPLACES="${PACKAGE}"
- CONFLICTS="${PACKAGE}"
- PROVIDES="${PACKAGE}, www-browser"
- fi
+ REPLACES=""
+ CONFLICTS=""
+ PROVIDES="www-browser"
gen_changelog
process_template "${SCRIPTDIR}/control.template" "${DEB_CONTROL}"
export DEB_HOST_ARCH="${ARCHITECTURE}"
diff --git a/chrome/installer/linux/debian/expected_deps b/chrome/installer/linux/debian/expected_deps
index ffe7ef28f5..a0a49c9366 100644
--- a/chrome/installer/linux/debian/expected_deps
+++ b/chrome/installer/linux/debian/expected_deps
@@ -24,7 +24,7 @@ libxcomposite1 (>= 1:0.3-1)
libxcursor1 (>> 1.1.2)
libxdamage1 (>= 1:1.1)
libxext6
-libxfixes3 (>= 1:5.0)
+libxfixes3
libxi6 (>= 2:1.2.99.4)
libxrandr2 (>= 2:1.2.99.2)
libxrender1
diff --git a/chrome/installer/mac/dmgdiffer.sh b/chrome/installer/mac/dmgdiffer.sh
index e70ed3eb73..dbdeb9b34e 100755
--- a/chrome/installer/mac/dmgdiffer.sh
+++ b/chrome/installer/mac/dmgdiffer.sh
@@ -243,18 +243,6 @@ make_patch_fs() {
exit 13
fi
- local patch_keychain_reauthorize_dir="${patch_fs}/.keychain_reauthorize"
- if ! mkdir "${patch_keychain_reauthorize_dir}"; then
- err "could not mkdir patch_keychain_reauthorize_dir"
- exit 13
- fi
-
- if ! cp -p "${SCRIPT_DIR}/.keychain_reauthorize/${old_app_bundleid}" \
- "${patch_keychain_reauthorize_dir}/${old_app_bundleid}"; then
- err "could not copy keychain_reauthorize"
- exit 13
- fi
-
local patch_dotpatch_dir="${patch_fs}/.patch"
if ! mkdir "${patch_dotpatch_dir}"; then
err "could not mkdir patch_dotpatch_dir"
diff --git a/chrome/installer/mac/keystone_install.sh b/chrome/installer/mac/keystone_install.sh
index 6f08c12799..7673926bd8 100755
--- a/chrome/installer/mac/keystone_install.sh
+++ b/chrome/installer/mac/keystone_install.sh
@@ -720,7 +720,6 @@ main() {
readonly KS_BRAND_KEY="KSBrandID"
readonly QUARANTINE_ATTR="com.apple.quarantine"
- readonly KEYCHAIN_REAUTHORIZE_DIR=".keychain_reauthorize"
# Don't use rsync -a, because -a expands to -rlptgoD. -g and -o copy owners
# and groups, respectively, from the source, and that is undesirable in this
@@ -1610,51 +1609,6 @@ main() {
2> /dev/null
fi
- # Do Keychain reauthorization. This involves running a stub executable on
- # the dmg that loads the newly-updated framework and jumps to it to perform
- # the reauthorization. The stub executable can be signed by the old
- # certificate even after the rest of Chrome switches to the new certificate,
- # so it still has access to the old Keychain items. The stub executable is
- # an unbundled flat file executable whose name matches the real
- # application's bundle identifier, so it's permitted access to the Keychain
- # items. Doing a reauthorization step at update time reauthorizes Keychain
- # items for users who never bother restarting Chrome, and provides a
- # mechanism to continue doing reauthorizations even after the certificate
- # changes. However, it only works for non-system ticket installations of
- # Chrome, because the updater runs as root when on a system ticket, and root
- # can't access individual user Keychains.
- #
- # Even if the reauthorization tool is launched, it doesn't necessarily try
- # to do anything. It will only attempt to perform a reauthorization if one
- # hasn't yet been done at update time.
- note "maybe reauthorizing Keychain"
-
- if [[ -z "${system_ticket}" ]]; then
- local new_bundleid_app
- new_bundleid_app="$(infoplist_read "${installed_app_plist}" \
- "${APP_BUNDLEID_KEY}" || true)"
- note "new_bundleid_app = ${new_bundleid_app}"
-
- local keychain_reauthorize_dir="\
-${update_dmg_mount_point}/${KEYCHAIN_REAUTHORIZE_DIR}"
- local keychain_reauthorize_path="\
-${keychain_reauthorize_dir}/${new_bundleid_app}"
- note "keychain_reauthorize_path = ${keychain_reauthorize_path}"
-
- if [[ -x "${keychain_reauthorize_path}" ]]; then
- local framework_dir="${new_versioned_dir}/${FRAMEWORK_DIR}"
- local framework_code_path="${framework_dir}/${FRAMEWORK_NAME}"
- note "framework_code_path = ${framework_code_path}"
-
- if [[ -f "${framework_code_path}" ]]; then
- note "reauthorizing Keychain"
- "${keychain_reauthorize_path}" "${framework_code_path}"
- fi
- fi
- else
- note "system ticket, not reauthorizing Keychain"
- fi
-
# Great success!
note "done!"
diff --git a/chrome/installer/mini_installer.gyp b/chrome/installer/mini_installer.gyp
index 3352274694..bb92eb25b9 100644
--- a/chrome/installer/mini_installer.gyp
+++ b/chrome/installer/mini_installer.gyp
@@ -1,6 +1,6 @@
{
'variables': {
- 'version_py': '../../chrome/tools/build/version.py',
+ 'version_py': '<(DEPTH)/build/util/version.py',
'version_path': '../../chrome/VERSION',
'lastchange_path': '<(DEPTH)/build/util/LASTCHANGE',
# 'branding_dir' is set in the 'conditions' section at the bottom.
diff --git a/chrome/installer/mini_installer/mini_installer_exe_version.rc.version b/chrome/installer/mini_installer/mini_installer_exe_version.rc.version
index 8d383cfb31..2862d6b50a 100644
--- a/chrome/installer/mini_installer/mini_installer_exe_version.rc.version
+++ b/chrome/installer/mini_installer/mini_installer_exe_version.rc.version
@@ -25,14 +25,14 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "@COMPANY_FULLNAME@"
- VALUE "FileDescription", "@PRODUCT_FULLNAME@"
+ VALUE "FileDescription", "@PRODUCT_INSTALLER_FULLNAME@"
VALUE "FileVersion", "@MAJOR@.@MINOR@.@BUILD@.@PATCH@"
VALUE "InternalName", "mini_installer"
VALUE "LegalCopyright", "@COPYRIGHT@"
- VALUE "ProductName", "@PRODUCT_FULLNAME@"
+ VALUE "ProductName", "@PRODUCT_INSTALLER_FULLNAME@"
VALUE "ProductVersion", "@MAJOR@.@MINOR@.@BUILD@.@PATCH@"
VALUE "CompanyShortName", "@COMPANY_SHORTNAME@"
- VALUE "ProductShortName", "@PRODUCT_SHORTNAME@"
+ VALUE "ProductShortName", "@PRODUCT_INSTALLER_SHORTNAME@"
VALUE "LastChange", "@LASTCHANGE@"
VALUE "Official Build", "@OFFICIAL_BUILD@"
END
diff --git a/chrome/installer/mini_installer_syzygy.gyp b/chrome/installer/mini_installer_syzygy.gyp
index 6c9934720b..4d19617b2f 100644
--- a/chrome/installer/mini_installer_syzygy.gyp
+++ b/chrome/installer/mini_installer_syzygy.gyp
@@ -3,7 +3,7 @@
# found in the LICENSE file.
{
'variables': {
- 'version_py': '<(DEPTH)/chrome/tools/build/version.py',
+ 'version_py': '<(DEPTH)/build/util/version.py',
'version_path': '<(DEPTH)/chrome/VERSION',
'lastchange_path': '<(DEPTH)/build/util/LASTCHANGE',
# 'branding_dir' is set in the 'conditions' section at the bottom.
@@ -14,7 +14,7 @@
'../../build/win_precompile.gypi',
],
'conditions': [
- # This target won't build in fastbuild, since there are no PDBs.
+ # This target won't build in fastbuild, since there are no PDBs.
['OS=="win" and fastbuild==0', {
'conditions': [
['chrome_multiple_dll==0', {
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc
index 3aed444fa1..078a9ac7ff 100644
--- a/chrome/installer/setup/install.cc
+++ b/chrome/installer/setup/install.cc
@@ -42,9 +42,6 @@
#include "chrome/installer/util/util_constants.h"
#include "chrome/installer/util/work_item_list.h"
-// Build-time generated include file.
-#include "registered_dlls.h" // NOLINT
-
using base::ASCIIToUTF16;
using base::UTF16ToUTF8;
using installer::InstallerState;
@@ -352,7 +349,7 @@ bool CreateVisualElementsManifest(const base::FilePath& src_path,
// Write the manifest to |src_path|.
const std::string manifest(UTF16ToUTF8(manifest16));
int size = base::checked_cast<int>(manifest.size());
- if (file_util::WriteFile(
+ if (base::WriteFile(
src_path.Append(installer::kVisualElementsManifest),
manifest.c_str(), size) == size) {
VLOG(1) << "Successfully wrote " << installer::kVisualElementsManifest
diff --git a/chrome/installer/setup/install_unittest.cc b/chrome/installer/setup/install_unittest.cc
index 99337d0164..10fe418787 100644
--- a/chrome/installer/setup/install_unittest.cc
+++ b/chrome/installer/setup/install_unittest.cc
@@ -76,7 +76,7 @@ class InstallShortcutTest : public testing::Test {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
chrome_exe_ = temp_dir_.path().Append(installer::kChromeExe);
- EXPECT_EQ(0, file_util::WriteFile(chrome_exe_, "", 0));
+ EXPECT_EQ(0, base::WriteFile(chrome_exe_, "", 0));
ShellUtil::ShortcutProperties chrome_properties(ShellUtil::CURRENT_USER);
product_->AddDefaultShortcutProperties(chrome_exe_, &chrome_properties);
diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc
index 1713fe5884..de2d1276d0 100644
--- a/chrome/installer/setup/install_worker.cc
+++ b/chrome/installer/setup/install_worker.cc
@@ -215,7 +215,7 @@ void AddCommandWithParameterWorkItems(const InstallerState& installer_state,
if (installer_state.operation() == InstallerState::UNINSTALL) {
work_item_list->AddDeleteRegKeyWorkItem(
installer_state.root_key(), full_cmd_key)->set_log_message(
- "removing " + WideToASCII(command_key) + " command");
+ "removing " + base::UTF16ToASCII(command_key) + " command");
} else {
CommandLine cmd_line(installer_state.target_path().Append(app));
cmd_line.AppendSwitchASCII(command_with_parameter, "%1");
@@ -500,19 +500,6 @@ void AddChromeWorkItems(const InstallationState& original_state,
temp_path);
}
- // For the component build to work with the installer, we need to also drop
- // chrome.exe.manifest (other manifests are already contained in the version
- // directory in the archive so no explicit work is required for them).
-#if defined(COMPONENT_BUILD)
- static const base::FilePath::CharType kChromeExeManifest[] =
- FILE_PATH_LITERAL("chrome.exe.manifest");
- install_list->AddMoveTreeWorkItem(
- src_path.Append(kChromeExeManifest).value(),
- target_path.Append(kChromeExeManifest).value(),
- temp_path.value(),
- WorkItem::ALWAYS_MOVE);
-#endif // defined(COMPONENT_BUILD)
-
// In the past, we copied rather than moved for system level installs so that
// the permissions of %ProgramFiles% would be picked up. Now that |temp_path|
// is in %ProgramFiles% for system level installs (and in %LOCALAPPDATA%
@@ -1459,7 +1446,7 @@ void AddQuickEnableChromeFrameWorkItems(const InstallerState& installer_state,
// not left behind in any case.
work_item_list->AddDeleteRegKeyWorkItem(
installer_state.root_key(), cmd_key)->set_log_message(
- "removing " + WideToASCII(kCmdQuickEnableCf) + " command");
+ "removing " + base::UTF16ToASCII(kCmdQuickEnableCf) + " command");
}
diff --git a/chrome/installer/setup/install_worker.h b/chrome/installer/setup/install_worker.h
index abcd1e563c..41d1b042d9 100644
--- a/chrome/installer/setup/install_worker.h
+++ b/chrome/installer/setup/install_worker.h
@@ -13,10 +13,10 @@
#include <vector>
class BrowserDistribution;
-class CommandLine;
class WorkItemList;
namespace base {
+class CommandLine;
class FilePath;
class Version;
}
@@ -161,7 +161,7 @@ void AddDeleteOldIELowRightsPolicyWorkItems(
// Utility method currently shared between install.cc and install_worker.cc
void AppendUninstallCommandLineFlags(const InstallerState& installer_state,
const Product& product,
- CommandLine* uninstall_cmd);
+ base::CommandLine* uninstall_cmd);
// Refreshes the elevation policy on platforms where it is supported.
void RefreshElevationPolicy();
diff --git a/chrome/installer/setup/setup.vcproj b/chrome/installer/setup/setup.vcproj
deleted file mode 100644
index 00792ce9be..0000000000
--- a/chrome/installer/setup/setup.vcproj
+++ /dev/null
@@ -1,137 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="setup"
- ProjectGUID="{21C76E6E-8B38-44D6-8148-B589C13B9554}"
- RootNamespace="setup"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- <ToolFile
- RelativePath="..\..\tools\build\win\version.rules"
- />
- <ToolFile
- RelativePath="..\..\tools\build\win\server.rules"
- />
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="1"
- InheritedPropertySheets=".\setup_debug.vsprops;$(SolutionDir)installer\util\using_util.vsprops"
- >
- <Tool
- Name="Version"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="1"
- InheritedPropertySheets=".\setup_release.vsprops;$(SolutionDir)installer\util\using_util.vsprops"
- >
- <Tool
- Name="Version"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="resources"
- >
- <File
- RelativePath=".\setup.ico"
- >
- </File>
- <File
- RelativePath=".\setup.rc"
- >
- </File>
- <File
- RelativePath=".\setup_exe_version.rc.version"
- >
- </File>
- <File
- RelativePath=".\setup_resource.h"
- >
- </File>
- </Filter>
- <File
- RelativePath="..\mini_installer\chrome.release"
- >
- </File>
- <File
- RelativePath=".\install.cc"
- >
- </File>
- <File
- RelativePath=".\main.cc"
- >
- </File>
- <File
- RelativePath=".\setup.cc"
- >
- </File>
- <File
- RelativePath=".\setup.h"
- >
- </File>
- <File
- RelativePath=".\setup_util.cc"
- >
- </File>
- <File
- RelativePath=".\setup_util.h"
- >
- </File>
- <File
- RelativePath=".\setup_constants.cc"
- >
- </File>
- <File
- RelativePath=".\setup_constants.h"
- >
- </File>
- <File
- RelativePath=".\uninstall.cc"
- >
- </File>
- <File
- RelativePath=".\uninstall.h"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/chrome/installer/setup/setup.vsprops b/chrome/installer/setup/setup.vsprops
deleted file mode 100644
index e55085f871..0000000000
--- a/chrome/installer/setup/setup.vsprops
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="setup"
- InheritedPropertySheets="$(SolutionDir)..\build\common.vsprops"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="$(OutDir);$(IntDir)"
- EnableIntrinsicFunctions="true"
- BasicRuntimeChecks="0"
- BufferSecurityCheck="false"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateMapFile="true"
- SubSystem="2"
- OptimizeForWindows98="1"
- />
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories="$(OutDir);$(IntDir)"
- />
- <Tool
- Name="VCManifestTool"
- AdditionalManifestFiles="$(SolutionDir)installer\setup\setup.exe.manifest"
- />
-</VisualStudioPropertySheet>
diff --git a/chrome/installer/setup/setup_debug.vsprops b/chrome/installer/setup/setup_debug.vsprops
deleted file mode 100644
index 873c6f1114..0000000000
--- a/chrome/installer/setup/setup_debug.vsprops
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="setup_debug"
- InheritedPropertySheets="$(SolutionDir)..\build\debug.vsprops;.\setup.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/chrome/installer/setup/setup_exe_version.rc.version b/chrome/installer/setup/setup_exe_version.rc.version
index b7054a1a94..93517edced 100644
--- a/chrome/installer/setup/setup_exe_version.rc.version
+++ b/chrome/installer/setup/setup_exe_version.rc.version
@@ -27,14 +27,14 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "@COMPANY_FULLNAME@"
- VALUE "FileDescription", "@PRODUCT_FULLNAME@"
+ VALUE "FileDescription", "@PRODUCT_INSTALLER_FULLNAME@"
VALUE "FileVersion", "@MAJOR@.@MINOR@.@BUILD@.@PATCH@"
VALUE "InternalName", "setup"
VALUE "LegalCopyright", "@COPYRIGHT@"
- VALUE "ProductName", "@PRODUCT_FULLNAME@"
+ VALUE "ProductName", "@PRODUCT_INSTALLER_FULLNAME@"
VALUE "ProductVersion", "@MAJOR@.@MINOR@.@BUILD@.@PATCH@"
VALUE "CompanyShortName", "@COMPANY_SHORTNAME@"
- VALUE "ProductShortName", "@PRODUCT_SHORTNAME@"
+ VALUE "ProductShortName", "@PRODUCT_INSTALLER_SHORTNAME@"
VALUE "LastChange", "@LASTCHANGE@"
VALUE "Official Build", "@OFFICIAL_BUILD@"
END
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc
index 4a3741c86d..2562be0823 100644
--- a/chrome/installer/setup/setup_main.cc
+++ b/chrome/installer/setup/setup_main.cc
@@ -664,11 +664,6 @@ installer::InstallStatus UninstallProducts(
const CommandLine& cmd_line) {
const Products& products = installer_state.products();
- // Decide whether Active Setup should be triggered and/or system-level Chrome
- // should be launched post-uninstall. This needs to be done outside the
- // UninstallProduct calls as some of them might terminate the processes
- // launched by a previous one otherwise...
- bool trigger_active_setup = false;
// System-level Chrome will be launched via this command if its program gets
// set below.
CommandLine system_level_cmd(CommandLine::NO_PROGRAM);
@@ -689,17 +684,6 @@ installer::InstallStatus UninstallProducts(
installer::GetChromeInstallPath(true, dist)
.Append(installer::kChromeExe));
system_level_cmd.SetProgram(system_exe_path);
-
- base::FilePath first_run_sentinel;
- InstallUtil::GetSentinelFilePath(
- chrome::kFirstRunSentinel, dist, &first_run_sentinel);
- if (base::PathExists(first_run_sentinel)) {
- // If the Chrome being self-destructed has already undergone First Run,
- // trigger Active Setup and make sure the system-level Chrome doesn't go
- // through first run.
- trigger_active_setup = true;
- system_level_cmd.AppendSwitch(::switches::kCancelFirstRun);
- }
}
}
if (installer_state.FindProduct(BrowserDistribution::CHROME_BINARIES)) {
@@ -730,7 +714,10 @@ installer::InstallStatus UninstallProducts(
// delete them.
installer::DeleteChromeDirectoriesIfEmpty(installer_state.target_path());
- if (trigger_active_setup)
+ // Trigger Active Setup if it was requested for the chrome product. This needs
+ // to be done after the UninstallProduct calls as some of them might
+ // otherwise terminate the process launched by TriggerActiveSetupCommand().
+ if (chrome && cmd_line.HasSwitch(installer::switches::kTriggerActiveSetup))
InstallUtil::TriggerActiveSetupCommand();
if (!system_level_cmd.GetProgram().empty())
@@ -867,13 +854,13 @@ installer::InstallStatus ShowEULADialog(const base::string16& inner_frame) {
// accepted.
bool CreateEULASentinel(BrowserDistribution* dist) {
base::FilePath eula_sentinel;
- if (!InstallUtil::GetSentinelFilePath(installer::kEULASentinelFile,
- dist, &eula_sentinel)) {
+ if (!InstallUtil::GetSentinelFilePath(installer::kEULASentinelFile, dist,
+ &eula_sentinel)) {
return false;
}
return (base::CreateDirectory(eula_sentinel.DirName()) &&
- file_util::WriteFile(eula_sentinel, "", 0) != -1);
+ base::WriteFile(eula_sentinel, "", 0) != -1);
}
void ActivateMetroChrome() {
@@ -1686,6 +1673,12 @@ InstallStatus InstallProductsHelper(
int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
wchar_t* command_line, int show_command) {
+ // Check to see if the CPU is supported before doing anything else. There's
+ // very little than can safely be accomplished if the CPU isn't supported
+ // since dependent libraries (e.g., base) may use invalid instructions.
+ if (!installer::IsProcessorSupported())
+ return installer::CPU_NOT_SUPPORTED;
+
// The exit manager is in charge of calling the dtors of singletons.
base::AtExitManager exit_manager;
CommandLine::Init(0, NULL);
diff --git a/chrome/installer/setup/setup_main.h b/chrome/installer/setup/setup_main.h
index 45f92d84d9..5bcf457fb9 100644
--- a/chrome/installer/setup/setup_main.h
+++ b/chrome/installer/setup/setup_main.h
@@ -10,9 +10,8 @@
#include "chrome/installer/util/util_constants.h"
-class CommandLine;
-
namespace base {
+class CommandLine;
class FilePath;
} // namespace base
@@ -28,7 +27,7 @@ class MasterPreferences;
// |true| if installation was delegated to a pre-existing higher version.
InstallStatus InstallProductsHelper(const InstallationState& original_state,
const base::FilePath& setup_exe,
- const CommandLine& cmd_line,
+ const base::CommandLine& cmd_line,
const MasterPreferences& prefs,
const InstallerState& installer_state,
base::FilePath* installer_directory,
diff --git a/chrome/installer/setup/setup_release.vsprops b/chrome/installer/setup/setup_release.vsprops
deleted file mode 100644
index ee6094cd4e..0000000000
--- a/chrome/installer/setup/setup_release.vsprops
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="setup_release"
- InheritedPropertySheets="$(SolutionDir)..\build\release.vsprops;.\setup.vsprops"
- >
-</VisualStudioPropertySheet>
diff --git a/chrome/installer/setup/setup_util.cc b/chrome/installer/setup/setup_util.cc
index d21abf97bd..c588406ac6 100644
--- a/chrome/installer/setup/setup_util.cc
+++ b/chrome/installer/setup/setup_util.cc
@@ -9,6 +9,7 @@
#include <windows.h>
#include "base/command_line.h"
+#include "base/cpu.h"
#include "base/file_util.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
@@ -17,6 +18,7 @@
#include "base/process/launch.h"
#include "base/process/process_handle.h"
#include "base/strings/string_util.h"
+#include "base/strings/utf_string_conversions.h"
#include "base/version.h"
#include "base/win/registry.h"
#include "base/win/windows_version.h"
@@ -154,7 +156,7 @@ Version* GetMaxVersionFromArchiveDir(const base::FilePath& chrome_path) {
VLOG(1) << "directory found: " << find_data.GetName().value();
scoped_ptr<Version> found_version(
- new Version(WideToASCII(find_data.GetName().value())));
+ new Version(base::UTF16ToASCII(find_data.GetName().value())));
if (found_version->IsValid() &&
found_version->CompareTo(*max_version.get()) > 0) {
max_version.reset(found_version.release());
@@ -449,6 +451,10 @@ bool ContainsUnsupportedSwitch(const CommandLine& cmd_line) {
return false;
}
+bool IsProcessorSupported() {
+ return base::CPU().has_sse2();
+}
+
ScopedTokenPrivilege::ScopedTokenPrivilege(const wchar_t* privilege_name)
: is_enabled_(false) {
HANDLE temp_handle;
diff --git a/chrome/installer/setup/setup_util.h b/chrome/installer/setup/setup_util.h
index 205198ea55..1d91cb892a 100644
--- a/chrome/installer/setup/setup_util.h
+++ b/chrome/installer/setup/setup_util.h
@@ -17,9 +17,8 @@
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/util_constants.h"
-class CommandLine;
-
namespace base {
+class CommandLine;
class FilePath;
class Version;
}
@@ -79,7 +78,7 @@ bool GetExistingHigherInstaller(const InstallationState& original_state,
// invoked |setup_exe| runs the newly installed product prior to exiting.
// Returns true if |setup_exe| was launched, false otherwise.
bool DeferToExistingInstall(const base::FilePath& setup_exe,
- const CommandLine& command_line,
+ const base::CommandLine& command_line,
const InstallerState& installer_state,
const base::FilePath& temp_path,
InstallStatus* install_status);
@@ -111,7 +110,10 @@ void MigrateGoogleUpdateStateMultiToSingle(
bool IsUninstallSuccess(InstallStatus install_status);
// Returns true if |cmd_line| contains unsupported (legacy) switches.
-bool ContainsUnsupportedSwitch(const CommandLine& cmd_line);
+bool ContainsUnsupportedSwitch(const base::CommandLine& cmd_line);
+
+// Returns true if the processor is supported by chrome.
+bool IsProcessorSupported();
// This class will enable the privilege defined by |privilege_name| on the
// current process' token. The privilege will be disabled upon the
diff --git a/chrome/installer/setup/setup_util_unittest.cc b/chrome/installer/setup/setup_util_unittest.cc
index c08e2b77af..7f58d897a0 100644
--- a/chrome/installer/setup/setup_util_unittest.cc
+++ b/chrome/installer/setup/setup_util_unittest.cc
@@ -137,7 +137,7 @@ TEST_F(SetupUtilTestWithDir, DeleteFileFromTempProcess) {
base::FilePath test_file;
base::CreateTemporaryFileInDir(test_dir_.path(), &test_file);
ASSERT_TRUE(base::PathExists(test_file));
- file_util::WriteFile(test_file, "foo", 3);
+ base::WriteFile(test_file, "foo", 3);
EXPECT_TRUE(installer::DeleteFileFromTempProcess(test_file, 0));
base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(200));
EXPECT_FALSE(base::PathExists(test_file));
@@ -307,10 +307,10 @@ class FindArchiveToPatchTest : public SetupUtilTestWithDir {
// Create archives in the two version dirs.
ASSERT_TRUE(
base::CreateDirectory(GetProductVersionArchivePath().DirName()));
- ASSERT_EQ(1, file_util::WriteFile(GetProductVersionArchivePath(), "a", 1));
+ ASSERT_EQ(1, base::WriteFile(GetProductVersionArchivePath(), "a", 1));
ASSERT_TRUE(
base::CreateDirectory(GetMaxVersionArchivePath().DirName()));
- ASSERT_EQ(1, file_util::WriteFile(GetMaxVersionArchivePath(), "b", 1));
+ ASSERT_EQ(1, base::WriteFile(GetMaxVersionArchivePath(), "b", 1));
}
virtual void TearDown() OVERRIDE {
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc
index dd23146cee..d1b67ffbc8 100644
--- a/chrome/installer/setup/uninstall.cc
+++ b/chrome/installer/setup/uninstall.cc
@@ -10,6 +10,7 @@
#include <vector>
+#include "base/base_paths.h"
#include "base/file_util.h"
#include "base/files/file_enumerator.h"
#include "base/path_service.h"
@@ -48,9 +49,6 @@
#include "extensions/common/constants.h"
#include "rlz/lib/rlz_lib.h"
-// Build-time generated include file.
-#include "registered_dlls.h" // NOLINT
-
using base::win::RegKey;
using installer::InstallStatus;
using installer::MasterPreferences;
@@ -178,7 +176,7 @@ void ClearRlzProductState() {
// If chrome has been reactivated, clear all events for this brand as well.
base::string16 reactivation_brand_wide;
if (GoogleUpdateSettings::GetReactivationBrand(&reactivation_brand_wide)) {
- std::string reactivation_brand(WideToASCII(reactivation_brand_wide));
+ std::string reactivation_brand(base::UTF16ToASCII(reactivation_brand_wide));
rlz_lib::SupplementaryBranding branding(reactivation_brand.c_str());
rlz_lib::ClearProductState(rlz_lib::CHROME, points);
}
@@ -247,10 +245,8 @@ bool RemoveInstallerFiles(const base::FilePath& installer_directory,
base::FilePath setup_exe_base_name(installer::kSetupExe);
- while (true) {
- base::FilePath to_delete(file_enumerator.Next());
- if (to_delete.empty())
- break;
+ for (base::FilePath to_delete = file_enumerator.Next(); !to_delete.empty();
+ to_delete = file_enumerator.Next()) {
if (!remove_setup && to_delete.BaseName() == setup_exe_base_name)
continue;
@@ -472,30 +468,58 @@ DeleteResult DeleteLocalState(
// install directory, deletion will fail as a result of the open handle.
bool MoveSetupOutOfInstallFolder(const InstallerState& installer_state,
const base::FilePath& setup_exe) {
- bool ret = false;
+ // The list of files which setup.exe depends on at runtime. Typically this is
+ // solely setup.exe itself, but in component builds this also includes the
+ // DLLs installed by setup.exe.
+ std::vector<base::FilePath> setup_files;
+ setup_files.push_back(setup_exe);
+#if defined(COMPONENT_BUILD)
+ base::FileEnumerator file_enumerator(
+ setup_exe.DirName(), false, base::FileEnumerator::FILES, L"*.dll");
+ for (base::FilePath setup_dll = file_enumerator.Next(); !setup_dll.empty();
+ setup_dll = file_enumerator.Next()) {
+ setup_files.push_back(setup_dll);
+ }
+#endif // defined(COMPONENT_BUILD)
+
base::FilePath tmp_dir;
base::FilePath temp_file;
if (!PathService::Get(base::DIR_TEMP, &tmp_dir)) {
NOTREACHED();
- } else if (!base::CreateTemporaryFileInDir(tmp_dir, &temp_file)) {
- LOG(ERROR) << "Failed to create temporary file for setup.exe.";
- } else {
- VLOG(1) << "Changing current directory to: " << tmp_dir.value();
- if (!file_util::SetCurrentDirectory(tmp_dir))
- PLOG(ERROR) << "Failed to change the current directory.";
+ return false;
+ }
- VLOG(1) << "Attempting to move setup to: " << temp_file.value();
- ret = base::Move(setup_exe, temp_file);
- PLOG_IF(ERROR, !ret) << "Failed to move setup to " << temp_file.value();
+ // Change the current directory to the TMP directory. See method comment above
+ // for details.
+ VLOG(1) << "Changing current directory to: " << tmp_dir.value();
+ if (!base::SetCurrentDirectory(tmp_dir))
+ PLOG(ERROR) << "Failed to change the current directory.";
+
+ for (std::vector<base::FilePath>::const_iterator it = setup_files.begin();
+ it != setup_files.end(); ++it) {
+ const base::FilePath& setup_file = *it;
+ if (!base::CreateTemporaryFileInDir(tmp_dir, &temp_file)) {
+ LOG(ERROR) << "Failed to create temporary file for "
+ << setup_file.BaseName().value();
+ return false;
+ }
+
+ VLOG(1) << "Attempting to move " << setup_file.BaseName().value() << " to: "
+ << temp_file.value();
+ if (!base::Move(setup_file, temp_file)) {
+ PLOG(ERROR) << "Failed to move " << setup_file.BaseName().value()
+ << " to " << temp_file.value();
+ return false;
+ }
// We cannot delete the file right away, but try to delete it some other
// way. Either with the help of a different process or the system.
- if (ret && !base::DeleteFileAfterReboot(temp_file)) {
- static const uint32 kDeleteAfterMs = 10 * 1000;
+ if (!base::DeleteFileAfterReboot(temp_file)) {
+ const uint32 kDeleteAfterMs = 10 * 1000;
installer::DeleteFileFromTempProcess(temp_file, kDeleteAfterMs);
}
}
- return ret;
+ return true;
}
DeleteResult DeleteChromeDirectoriesIfEmpty(
@@ -565,10 +589,8 @@ DeleteResult DeleteChromeFilesAndFolders(const InstallerState& installer_state,
// installer directory).
base::FileEnumerator file_enumerator(target_path, true,
base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES);
- while (true) {
- base::FilePath to_delete(file_enumerator.Next());
- if (to_delete.empty())
- break;
+ for (base::FilePath to_delete = file_enumerator.Next(); !to_delete.empty();
+ to_delete = file_enumerator.Next()) {
if (to_delete.BaseName().value() == installer::kChromeAppHostExe)
continue;
if (!installer_directory.empty() &&
diff --git a/chrome/installer/setup/uninstall.h b/chrome/installer/setup/uninstall.h
index 96c34110a4..2c9151c25d 100644
--- a/chrome/installer/setup/uninstall.h
+++ b/chrome/installer/setup/uninstall.h
@@ -13,9 +13,9 @@
#include "chrome/installer/util/util_constants.h"
class BrowserDistribution;
-class CommandLine;
namespace base {
+class CommandLine;
class FilePath;
}
@@ -76,7 +76,7 @@ installer::InstallStatus UninstallProduct(
const Product& dist,
bool remove_all,
bool force_uninstall,
- const CommandLine& cmd_line);
+ const base::CommandLine& cmd_line);
// Cleans up the installation directory after all uninstall operations have
// completed. Depending on what products are remaining, setup.exe and the
diff --git a/chrome/installer/test/alternate_version_generator.cc b/chrome/installer/test/alternate_version_generator.cc
index 6b65aa1285..146f1b05d0 100644
--- a/chrome/installer/test/alternate_version_generator.cc
+++ b/chrome/installer/test/alternate_version_generator.cc
@@ -34,14 +34,15 @@
#include "base/basictypes.h"
#include "base/command_line.h"
#include "base/file_util.h"
+#include "base/files/file.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/path_service.h"
-#include "base/platform_file.h"
#include "base/process/launch.h"
#include "base/process/process_handle.h"
#include "base/strings/string_util.h"
+#include "base/strings/utf_string_conversions.h"
#include "base/version.h"
#include "base/win/pe_image.h"
#include "base/win/scoped_handle.h"
@@ -151,11 +152,13 @@ class MappedFile {
public:
MappedFile() : size_(), mapping_(), view_() { }
~MappedFile();
- bool Initialize(base::PlatformFile file);
+ bool Initialize(base::File file);
void* data() const { return view_; }
size_t size() const { return size_; }
+
private:
size_t size_;
+ base::File file_;
HANDLE mapping_;
void* view_;
DISALLOW_COPY_AND_ASSIGN(MappedFile);
@@ -174,16 +177,16 @@ MappedFile::~MappedFile() {
}
}
-bool MappedFile::Initialize(base::PlatformFile file) {
+bool MappedFile::Initialize(base::File file) {
DCHECK(mapping_ == NULL);
bool result = false;
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
- if (base::GetPlatformFileInfo(file, &file_info)) {
+ if (file.GetInfo(&file_info)) {
if (file_info.size <=
static_cast<int64>(std::numeric_limits<DWORD>::max())) {
- mapping_ = CreateFileMapping(file, NULL, PAGE_READWRITE, 0,
- static_cast<DWORD>(file_info.size), NULL);
+ mapping_ = CreateFileMapping(file.GetPlatformFile(), NULL, PAGE_READWRITE,
+ 0, static_cast<DWORD>(file_info.size), NULL);
if (mapping_ != NULL) {
view_ = MapViewOfFile(mapping_, FILE_MAP_WRITE, 0, 0,
static_cast<size_t>(file_info.size));
@@ -202,6 +205,7 @@ bool MappedFile::Initialize(base::PlatformFile file) {
} else {
PLOG(DFATAL) << "GetPlatformFileInfo failed";
}
+ file_ = file.Pass();
return result;
}
@@ -352,29 +356,24 @@ bool UpdateVersionIfMatch(const base::FilePath& image_file,
}
bool result = false;
- base::win::ScopedHandle image_handle(base::CreatePlatformFile(
- image_file,
- (base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ |
- base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_EXCLUSIVE_READ |
- base::PLATFORM_FILE_EXCLUSIVE_WRITE), NULL, NULL));
+ uint32 flags = base::File::FLAG_OPEN | base::File::FLAG_READ |
+ base::File::FLAG_WRITE | base::File::FLAG_EXCLUSIVE_READ |
+ base::File::FLAG_EXCLUSIVE_WRITE;
+ base::File file(image_file, flags);
// It turns out that the underlying CreateFile can fail due to unhelpful
// security software locking the newly created DLL. So add a few brief
// retries to help tests that use this pass on machines thusly encumbered.
int retries = 3;
- while (!image_handle.IsValid() && retries-- > 0) {
+ while (!file.IsValid() && retries-- > 0) {
LOG(WARNING) << "Failed to open \"" << image_file.value() << "\"."
<< " Retrying " << retries << " more times.";
Sleep(1000);
- image_handle.Set(base::CreatePlatformFile(
- image_file,
- (base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ |
- base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_EXCLUSIVE_READ |
- base::PLATFORM_FILE_EXCLUSIVE_WRITE), NULL, NULL));
+ file.Initialize(image_file, flags);
}
- if (image_handle.IsValid()) {
+ if (file.IsValid()) {
MappedFile image_mapping;
- if (image_mapping.Initialize(image_handle)) {
+ if (image_mapping.Initialize(file.Pass())) {
base::win::PEImageAsData image(
reinterpret_cast<HMODULE>(image_mapping.data()));
// PEImage class does not support other-architecture images.
@@ -545,9 +544,9 @@ bool GenerateAlternateVersion(const base::FilePath& original_installer_path,
if (!resource_loader.Load(&kSetupEx_[0], &kBl[0], &resource_data))
return false;
int written =
- file_util::WriteFile(setup_ex_,
- reinterpret_cast<const char*>(resource_data.first),
- static_cast<int>(resource_data.second));
+ base::WriteFile(setup_ex_,
+ reinterpret_cast<const char*>(resource_data.first),
+ static_cast<int>(resource_data.second));
if (written != resource_data.second) {
LOG(DFATAL) << "Failed writing \"" << setup_ex_.value() << "\"";
return false;
@@ -557,9 +556,9 @@ bool GenerateAlternateVersion(const base::FilePath& original_installer_path,
if (!resource_loader.Load(&kChromePacked7z[0], &kB7[0], &resource_data))
return false;
written =
- file_util::WriteFile(chrome_packed_7z,
- reinterpret_cast<const char*>(resource_data.first),
- static_cast<int>(resource_data.second));
+ base::WriteFile(chrome_packed_7z,
+ reinterpret_cast<const char*>(resource_data.first),
+ static_cast<int>(resource_data.second));
if (written != resource_data.second) {
LOG(DFATAL) << "Failed writing \"" << chrome_packed_7z.value() << "\"";
return false;
@@ -669,7 +668,7 @@ bool GenerateAlternatePEFileVersion(const base::FilePath& original_file,
return false;
}
- Version new_version(WideToASCII(ctx.new_version_str));
+ Version new_version(base::UTF16ToASCII(ctx.new_version_str));
GenerateSpecificPEFileVersion(original_file, target_file, new_version);
return true;
diff --git a/chrome/installer/upgrade_test.gyp b/chrome/installer/upgrade_test.gyp
index 82c60da69b..061604ed6e 100644
--- a/chrome/installer/upgrade_test.gyp
+++ b/chrome/installer/upgrade_test.gyp
@@ -4,7 +4,7 @@
{
'variables': {
- 'version_py': '../../chrome/tools/build/version.py',
+ 'version_py': '<(DEPTH)/build/util/version.py',
'version_path': '../../chrome/VERSION',
'lastchange_path': '<(DEPTH)/build/util/LASTCHANGE',
# 'branding_dir' is set in the 'conditions' section at the bottom.
diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc
index 8909f9fa3d..2fa926d9de 100644
--- a/chrome/installer/util/browser_distribution.cc
+++ b/chrome/installer/util/browser_distribution.cc
@@ -16,6 +16,7 @@
#include "base/path_service.h"
#include "base/win/registry.h"
#include "base/win/windows_version.h"
+#include "chrome/common/chrome_icon_resources_win.h"
#include "chrome/common/env_vars.h"
#include "chrome/installer/util/chrome_app_host_distribution.h"
#include "chrome/installer/util/chrome_frame_distribution.h"
@@ -39,9 +40,6 @@ const wchar_t kChromiumActiveSetupGuid[] =
const wchar_t kCommandExecuteImplUuid[] =
L"{A2DF06F9-A21A-44A8-8A99-8B9C84F29160}";
-// The Chromium App Launcher icon is index 1; see chrome_exe.rc.
-const int kAppLauncherIconIndex = 1;
-
// The BrowserDistribution objects are never freed.
BrowserDistribution* g_browser_distribution = NULL;
BrowserDistribution* g_chrome_frame_distribution = NULL;
@@ -167,10 +165,10 @@ base::string16 BrowserDistribution::GetShortcutName(
int BrowserDistribution::GetIconIndex(ShortcutType shortcut_type) {
if (shortcut_type == SHORTCUT_APP_LAUNCHER)
- return kAppLauncherIconIndex;
+ return icon_resources::kAppLauncherIndex;
DCHECK(shortcut_type == SHORTCUT_CHROME ||
shortcut_type == SHORTCUT_CHROME_ALTERNATE) << shortcut_type;
- return 0;
+ return icon_resources::kApplicationIndex;
}
base::string16 BrowserDistribution::GetIconFilename() {
diff --git a/chrome/installer/util/chrome_app_host_operations.h b/chrome/installer/util/chrome_app_host_operations.h
index cb954a58d9..bbd75ba069 100644
--- a/chrome/installer/util/chrome_app_host_operations.h
+++ b/chrome/installer/util/chrome_app_host_operations.h
@@ -20,7 +20,7 @@ class ChromeAppHostOperations : public ProductOperations {
virtual void ReadOptions(const MasterPreferences& prefs,
std::set<base::string16>* options) const OVERRIDE;
- virtual void ReadOptions(const CommandLine& uninstall_command,
+ virtual void ReadOptions(const base::CommandLine& uninstall_command,
std::set<base::string16>* options) const OVERRIDE;
virtual void AddKeyFiles(
@@ -32,10 +32,10 @@ class ChromeAppHostOperations : public ProductOperations {
std::vector<base::FilePath>* com_dll_list) const OVERRIDE;
virtual void AppendProductFlags(const std::set<base::string16>& options,
- CommandLine* cmd_line) const OVERRIDE;
+ base::CommandLine* cmd_line) const OVERRIDE;
virtual void AppendRenameFlags(const std::set<base::string16>& options,
- CommandLine* cmd_line) const OVERRIDE;
+ base::CommandLine* cmd_line) const OVERRIDE;
virtual bool SetChannelFlags(const std::set<base::string16>& options,
bool set,
diff --git a/chrome/installer/util/chrome_binaries_operations.h b/chrome/installer/util/chrome_binaries_operations.h
index d1015ed96c..929fa436e0 100644
--- a/chrome/installer/util/chrome_binaries_operations.h
+++ b/chrome/installer/util/chrome_binaries_operations.h
@@ -20,7 +20,7 @@ class ChromeBinariesOperations : public ProductOperations {
virtual void ReadOptions(const MasterPreferences& prefs,
std::set<base::string16>* options) const OVERRIDE;
- virtual void ReadOptions(const CommandLine& uninstall_command,
+ virtual void ReadOptions(const base::CommandLine& uninstall_command,
std::set<base::string16>* options) const OVERRIDE;
virtual void AddKeyFiles(
@@ -32,10 +32,10 @@ class ChromeBinariesOperations : public ProductOperations {
std::vector<base::FilePath>* com_dll_list) const OVERRIDE;
virtual void AppendProductFlags(const std::set<base::string16>& options,
- CommandLine* cmd_line) const OVERRIDE;
+ base::CommandLine* cmd_line) const OVERRIDE;
virtual void AppendRenameFlags(const std::set<base::string16>& options,
- CommandLine* cmd_line) const OVERRIDE;
+ base::CommandLine* cmd_line) const OVERRIDE;
virtual bool SetChannelFlags(const std::set<base::string16>& options,
bool set,
diff --git a/chrome/installer/util/chrome_browser_operations.h b/chrome/installer/util/chrome_browser_operations.h
index e0e6e4d0a5..06bdb5586d 100644
--- a/chrome/installer/util/chrome_browser_operations.h
+++ b/chrome/installer/util/chrome_browser_operations.h
@@ -19,7 +19,7 @@ class ChromeBrowserOperations : public ProductOperations {
virtual void ReadOptions(const MasterPreferences& prefs,
std::set<base::string16>* options) const OVERRIDE;
- virtual void ReadOptions(const CommandLine& uninstall_command,
+ virtual void ReadOptions(const base::CommandLine& uninstall_command,
std::set<base::string16>* options) const OVERRIDE;
virtual void AddKeyFiles(
@@ -31,10 +31,10 @@ class ChromeBrowserOperations : public ProductOperations {
std::vector<base::FilePath>* com_dll_list) const OVERRIDE;
virtual void AppendProductFlags(const std::set<base::string16>& options,
- CommandLine* cmd_line) const OVERRIDE;
+ base::CommandLine* cmd_line) const OVERRIDE;
virtual void AppendRenameFlags(const std::set<base::string16>& options,
- CommandLine* cmd_line) const OVERRIDE;
+ base::CommandLine* cmd_line) const OVERRIDE;
virtual bool SetChannelFlags(const std::set<base::string16>& options,
bool set,
diff --git a/chrome/installer/util/chrome_browser_sxs_operations.h b/chrome/installer/util/chrome_browser_sxs_operations.h
index 5c82a3c2df..6a189d1aa6 100644
--- a/chrome/installer/util/chrome_browser_sxs_operations.h
+++ b/chrome/installer/util/chrome_browser_sxs_operations.h
@@ -17,10 +17,10 @@ class ChromeBrowserSxSOperations : public ChromeBrowserOperations {
ChromeBrowserSxSOperations() {}
virtual void AppendProductFlags(const std::set<base::string16>& options,
- CommandLine* cmd_line) const OVERRIDE;
+ base::CommandLine* cmd_line) const OVERRIDE;
virtual void AppendRenameFlags(const std::set<base::string16>& options,
- CommandLine* cmd_line) const OVERRIDE;
+ base::CommandLine* cmd_line) const OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserSxSOperations);
diff --git a/chrome/installer/util/chrome_frame_operations.h b/chrome/installer/util/chrome_frame_operations.h
index fb35a07f5f..497a151581 100644
--- a/chrome/installer/util/chrome_frame_operations.h
+++ b/chrome/installer/util/chrome_frame_operations.h
@@ -19,7 +19,7 @@ class ChromeFrameOperations : public ProductOperations {
virtual void ReadOptions(const MasterPreferences& prefs,
std::set<base::string16>* options) const OVERRIDE;
- virtual void ReadOptions(const CommandLine& uninstall_command,
+ virtual void ReadOptions(const base::CommandLine& uninstall_command,
std::set<base::string16>* options) const OVERRIDE;
virtual void AddKeyFiles(
@@ -31,10 +31,10 @@ class ChromeFrameOperations : public ProductOperations {
std::vector<base::FilePath>* com_dll_list) const OVERRIDE;
virtual void AppendProductFlags(const std::set<base::string16>& options,
- CommandLine* cmd_line) const OVERRIDE;
+ base::CommandLine* cmd_line) const OVERRIDE;
virtual void AppendRenameFlags(const std::set<base::string16>& options,
- CommandLine* cmd_line) const OVERRIDE;
+ base::CommandLine* cmd_line) const OVERRIDE;
virtual bool SetChannelFlags(const std::set<base::string16>& options,
bool set,
diff --git a/chrome/installer/util/eula_util.cc b/chrome/installer/util/eula_util.cc
index 25bcba86f2..9bbf502981 100644
--- a/chrome/installer/util/eula_util.cc
+++ b/chrome/installer/util/eula_util.cc
@@ -23,10 +23,9 @@ bool IsChromeFirstRunPending(BrowserDistribution* dist) {
// first-run flow. Assume Chrome has been run if the path to the sentinel
// cannot be determined.
base::FilePath first_run_sentinel;
- return InstallUtil::GetSentinelFilePath(chrome::kFirstRunSentinel,
- dist,
- &first_run_sentinel)
- && !base::PathExists(first_run_sentinel);
+ return InstallUtil::GetSentinelFilePath(chrome::kFirstRunSentinel, dist,
+ &first_run_sentinel) &&
+ !base::PathExists(first_run_sentinel);
}
bool IsEULAAcceptanceFlagged(BrowserDistribution* dist) {
@@ -34,10 +33,9 @@ bool IsEULAAcceptanceFlagged(BrowserDistribution* dist) {
// doing so is required by master_preferences. Assume the EULA has not been
// accepted if the path to the sentinel cannot be determined.
base::FilePath eula_sentinel;
- return InstallUtil::GetSentinelFilePath(kEULASentinelFile,
- dist,
- &eula_sentinel)
- && base::PathExists(eula_sentinel);
+ return InstallUtil::GetSentinelFilePath(kEULASentinelFile, dist,
+ &eula_sentinel) &&
+ base::PathExists(eula_sentinel);
}
scoped_ptr<MasterPreferences> GetMasterPrefs(const ProductState& prod_state) {
diff --git a/chrome/installer/util/fake_product_state.h b/chrome/installer/util/fake_product_state.h
index 27946b744b..8b6e866fb3 100644
--- a/chrome/installer/util/fake_product_state.h
+++ b/chrome/installer/util/fake_product_state.h
@@ -23,7 +23,7 @@ class FakeProductState : public ProductState {
}
void clear_usagestats() { has_usagestats_ = false; }
void SetUninstallProgram(const base::FilePath& setup_exe) {
- uninstall_command_ = CommandLine(setup_exe);
+ uninstall_command_ = base::CommandLine(setup_exe);
}
void AddUninstallSwitch(const std::string& option) {
uninstall_command_.AppendSwitch(option);
diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc
index e49ba91380..c263c6b375 100644
--- a/chrome/installer/util/google_chrome_distribution.cc
+++ b/chrome/installer/util/google_chrome_distribution.cc
@@ -17,6 +17,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/win/registry.h"
#include "base/win/windows_version.h"
+#include "chrome/common/chrome_icon_resources_win.h"
#include "chrome/common/net/test_server_locations.h"
#include "chrome/installer/util/channel_info.h"
#include "chrome/installer/util/google_update_constants.h"
@@ -40,9 +41,6 @@ const wchar_t kBrowserProgIdDesc[] = L"Chrome HTML Document";
const wchar_t kCommandExecuteImplUuid[] =
L"{5C65F4B0-3651-4514-B207-D10CB699B14B}";
-// The Google Chrome App Launcher icon is index 5; see chrome_exe.rc.
-const int kAppLauncherIconIndex = 5;
-
// Substitute the locale parameter in uninstall URL with whatever
// Google Update tells us is the locale. In case we fail to find
// the locale, we use US English.
@@ -149,10 +147,10 @@ base::string16 GoogleChromeDistribution::GetShortcutName(
int GoogleChromeDistribution::GetIconIndex(ShortcutType shortcut_type) {
if (shortcut_type == SHORTCUT_APP_LAUNCHER)
- return kAppLauncherIconIndex;
+ return icon_resources::kAppLauncherIndex;
DCHECK(shortcut_type == SHORTCUT_CHROME ||
shortcut_type == SHORTCUT_CHROME_ALTERNATE) << shortcut_type;
- return 0;
+ return icon_resources::kApplicationIndex;
}
base::string16 GoogleChromeDistribution::GetBaseAppId() {
diff --git a/chrome/installer/util/google_chrome_sxs_distribution.cc b/chrome/installer/util/google_chrome_sxs_distribution.cc
index ad8f715da9..773bf39093 100644
--- a/chrome/installer/util/google_chrome_sxs_distribution.cc
+++ b/chrome/installer/util/google_chrome_sxs_distribution.cc
@@ -8,6 +8,7 @@
#include "base/command_line.h"
#include "base/logging.h"
+#include "chrome/common/chrome_icon_resources_win.h"
#include "installer_util_strings.h" // NOLINT
@@ -18,13 +19,9 @@ const wchar_t kChannelName[] = L"canary";
const wchar_t kBrowserAppId[] = L"ChromeCanary";
const wchar_t kBrowserProgIdPrefix[] = L"ChromeSSHTM";
const wchar_t kBrowserProgIdDesc[] = L"Chrome Canary HTML Document";
-const int kSxSIconIndex = 4;
const wchar_t kCommandExecuteImplUuid[] =
L"{1BEAC3E3-B852-44F4-B468-8906C062422E}";
-// The Chrome App Launcher Canary icon is index 6; see chrome_exe.rc.
-const int kSxSAppLauncherIconIndex = 6;
-
} // namespace
GoogleChromeSxSDistribution::GoogleChromeSxSDistribution()
@@ -94,10 +91,10 @@ BrowserDistribution::DefaultBrowserControlPolicy
int GoogleChromeSxSDistribution::GetIconIndex(ShortcutType shortcut_type) {
if (shortcut_type == SHORTCUT_APP_LAUNCHER)
- return kSxSAppLauncherIconIndex;
+ return icon_resources::kSxSAppLauncherIndex;
DCHECK(shortcut_type == SHORTCUT_CHROME ||
shortcut_type == SHORTCUT_CHROME_ALTERNATE) << shortcut_type;
- return kSxSIconIndex;
+ return icon_resources::kSxSApplicationIndex;
}
bool GoogleChromeSxSDistribution::GetChromeChannel(base::string16* channel) {
diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc
index 8d4fbd7f9b..e29f987a72 100644
--- a/chrome/installer/util/google_update_settings.cc
+++ b/chrome/installer/util/google_update_settings.cc
@@ -8,6 +8,9 @@
#include <string>
#include "base/command_line.h"
+#include "base/files/file_path.h"
+#include "base/logging.h"
+#include "base/metrics/histogram.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
@@ -571,6 +574,22 @@ GoogleUpdateSettings::UpdatePolicy GoogleUpdateSettings::GetAppUpdatePolicy(
return update_policy;
}
+void GoogleUpdateSettings::RecordChromeUpdatePolicyHistograms() {
+ const bool is_multi_install = InstallUtil::IsMultiInstall(
+ BrowserDistribution::GetDistribution(), IsSystemInstall());
+ const base::string16 app_guid =
+ BrowserDistribution::GetSpecificDistribution(
+ is_multi_install ? BrowserDistribution::CHROME_BINARIES :
+ BrowserDistribution::CHROME_BROWSER)->GetAppGuid();
+
+ bool is_overridden = false;
+ const UpdatePolicy update_policy = GetAppUpdatePolicy(app_guid,
+ &is_overridden);
+ UMA_HISTOGRAM_BOOLEAN("GoogleUpdate.UpdatePolicyIsOverridden", is_overridden);
+ UMA_HISTOGRAM_ENUMERATION("GoogleUpdate.EffectivePolicy", update_policy,
+ UPDATE_POLICIES_COUNT);
+}
+
base::string16 GoogleUpdateSettings::GetUninstallCommandLine(
bool system_install) {
const HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
@@ -658,7 +677,7 @@ bool GoogleUpdateSettings::GetUpdateDetailForApp(bool system_install,
(clientstate.ReadValue(google_update::kRegVersionField,
&version) == ERROR_SUCCESS)) {
product_found = true;
- data->version = WideToASCII(version);
+ data->version = base::UTF16ToASCII(version);
data->last_success = base::Time::FromTimeT(dword_value);
data->last_result = 0;
data->last_error_code = 0;
diff --git a/chrome/installer/util/google_update_settings.h b/chrome/installer/util/google_update_settings.h
index 8e99978f8f..dfd948c6d5 100644
--- a/chrome/installer/util/google_update_settings.h
+++ b/chrome/installer/util/google_update_settings.h
@@ -31,6 +31,7 @@ class GoogleUpdateSettings {
AUTOMATIC_UPDATES = 1,
MANUAL_UPDATES_ONLY = 2,
AUTO_UPDATES_ONLY = 3,
+ UPDATE_POLICIES_COUNT
};
// Defines product data that is tracked/used by Google Update.
@@ -227,6 +228,9 @@ class GoogleUpdateSettings {
static UpdatePolicy GetAppUpdatePolicy(const std::wstring& app_guid,
bool* is_overridden);
+ // Records UMA stats about Chrome's update policy.
+ static void RecordChromeUpdatePolicyHistograms();
+
// Returns Google Update's uninstall command line, or an empty string if none
// is found.
static base::string16 GetUninstallCommandLine(bool system_install);
diff --git a/chrome/installer/util/google_update_util.cc b/chrome/installer/util/google_update_util.cc
index 748e3f6c2f..18ea762e8f 100644
--- a/chrome/installer/util/google_update_util.cc
+++ b/chrome/installer/util/google_update_util.cc
@@ -34,7 +34,7 @@ namespace {
const int kGoogleUpdateTimeoutMs = 20 * 1000;
const char kEnvVariableUntrustedData[] = "GoogleUpdateUntrustedData";
-const int kEnvVariableUntrustedDataMaxLength = 4096;
+const int kUntrustedDataMaxLength = 4096;
// Returns true if Google Update is present at the given level.
bool IsGoogleUpdatePresent(bool system_install) {
@@ -132,24 +132,19 @@ bool IsUntrustedDataKeyValid(const std::string& key) {
== key.end();
}
-// Reads and parses untrusted data passed from Google Update as key-value
-// pairs, then overwrites |untrusted_data_map| with the result.
-// Returns true if data are successfully read.
-bool GetGoogleUpdateUntrustedData(
+// Parses |data_string| as key-value pairs and overwrites |untrusted_data| with
+// the result. Returns true if the data could be parsed.
+bool ParseUntrustedData(
+ const std::string& data_string,
std::map<std::string, std::string>* untrusted_data) {
DCHECK(untrusted_data);
- scoped_ptr<base::Environment> env(base::Environment::Create());
- std::string data_string;
- if (env == NULL || !env->GetVar(kEnvVariableUntrustedData, &data_string))
- return false;
-
- if (data_string.length() > kEnvVariableUntrustedDataMaxLength ||
+ if (data_string.length() > kUntrustedDataMaxLength ||
!IsStringPrintable(data_string)) {
- LOG(ERROR) << "Invalid value in " << kEnvVariableUntrustedData;
+ LOG(ERROR) << "Invalid value in untrusted data string.";
return false;
}
- VLOG(1) << kEnvVariableUntrustedData << ": " << data_string;
+ VLOG(1) << "Untrusted data string: " << data_string;
std::vector<std::pair<std::string, std::string> > kv_pairs;
if (!base::SplitStringIntoKeyValuePairs(data_string, '=', '&', &kv_pairs)) {
@@ -171,6 +166,19 @@ bool GetGoogleUpdateUntrustedData(
return true;
}
+// Reads and parses untrusted data passed from Google Update as key-value
+// pairs, then overwrites |untrusted_data_map| with the result.
+// Returns true if data are successfully read.
+bool GetGoogleUpdateUntrustedData(
+ std::map<std::string, std::string>* untrusted_data) {
+ scoped_ptr<base::Environment> env(base::Environment::Create());
+ std::string data_string;
+ if (!env || !env->GetVar(kEnvVariableUntrustedData, &data_string))
+ return false;
+
+ return ParseUntrustedData(data_string, untrusted_data);
+}
+
} // namespace
bool EnsureUserLevelGoogleUpdatePresent() {
@@ -221,4 +229,13 @@ std::string GetUntrustedDataValue(const std::string& key) {
return std::string();
}
+std::string GetUntrustedDataValueFromTag(const std::string& tag,
+ const std::string& key) {
+ std::map<std::string, std::string> untrusted_data;
+ if (ParseUntrustedData(tag, &untrusted_data))
+ return untrusted_data[key];
+
+ return std::string();
+}
+
} // namespace google_update
diff --git a/chrome/installer/util/google_update_util.h b/chrome/installer/util/google_update_util.h
index 30d77e95b6..8ef2b9a753 100644
--- a/chrome/installer/util/google_update_util.h
+++ b/chrome/installer/util/google_update_util.h
@@ -27,6 +27,13 @@ bool UninstallGoogleUpdate(bool system_install);
// contains non-printable characters.
std::string GetUntrustedDataValue(const std::string& key);
+// Returns the value corresponding to |key| in untrusted data passed from
+// |tag|. |tag| should be a printable list of key-value pairs, e.g.
+// "key1=value1&key2=value2". Returns an empty string if |key| is absent or if
+// its value contains non-printable characters.
+std::string GetUntrustedDataValueFromTag(const std::string& tag,
+ const std::string& key);
+
} // namespace google_update
#endif // CHROME_INSTALLER_UTIL_GOOGLE_UPDATE_UTIL_H_
diff --git a/chrome/installer/util/helper.cc b/chrome/installer/util/helper.cc
index 10a21563a5..a3c8d3ec54 100644
--- a/chrome/installer/util/helper.cc
+++ b/chrome/installer/util/helper.cc
@@ -43,6 +43,7 @@ base::FilePath GetChromeInstallPath(bool system_install,
return GetChromeInstallBasePath(system_install, dist, kInstallBinaryDir);
}
+// TODO(gab): Cleanup this method (kMetroChromeUserDataSubDir is deprecated).
void GetChromeUserDataPaths(BrowserDistribution* dist,
std::vector<base::FilePath>* paths) {
const bool has_metro_data =
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
index 3dacaa35b6..570386e84f 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -21,6 +21,7 @@
#include "base/platform_file.h"
#include "base/process/launch.h"
#include "base/strings/string_util.h"
+#include "base/strings/utf_string_conversions.h"
#include "base/sys_info.h"
#include "base/values.h"
#include "base/version.h"
@@ -173,7 +174,7 @@ bool InstallUtil::ExecuteExeAsAdmin(const CommandLine& cmd, DWORD* exit_code) {
params = params.substr(program.length());
}
- TrimWhitespace(params, TRIM_ALL, &params);
+ base::TrimWhitespace(params, base::TRIM_ALL, &params);
HWND uac_foreground_window = CreateUACForegroundWindow();
@@ -230,7 +231,7 @@ void InstallUtil::GetChromeVersion(BrowserDistribution* dist,
if (result == ERROR_SUCCESS && !version_str.empty()) {
VLOG(1) << "Existing " << dist->GetDisplayName() << " version found "
<< version_str;
- *version = Version(WideToASCII(version_str));
+ *version = Version(base::UTF16ToASCII(version_str));
} else {
DCHECK_EQ(ERROR_FILE_NOT_FOUND, result);
VLOG(1) << "No existing " << dist->GetDisplayName()
@@ -256,7 +257,7 @@ void InstallUtil::GetCriticalUpdateVersion(BrowserDistribution* dist,
if (result == ERROR_SUCCESS && !version_str.empty()) {
VLOG(1) << "Critical Update version for " << dist->GetDisplayName()
<< " found " << version_str;
- *version = Version(WideToASCII(version_str));
+ *version = Version(base::UTF16ToASCII(version_str));
} else {
DCHECK_EQ(ERROR_FILE_NOT_FOUND, result);
VLOG(1) << "No existing " << dist->GetDisplayName()
@@ -355,8 +356,7 @@ bool InstallUtil::IsMultiInstall(BrowserDistribution* dist,
bool system_install) {
DCHECK(dist);
ProductState state;
- return state.Initialize(system_install, dist->GetType()) &&
- state.is_multi_install();
+ return state.Initialize(system_install, dist) && state.is_multi_install();
}
bool CheckIsChromeSxSProcess() {
@@ -399,41 +399,16 @@ bool InstallUtil::IsChromeSxSProcess() {
return sxs;
}
-bool InstallUtil::GetSentinelFilePath(const base::FilePath::CharType* file,
- BrowserDistribution* dist,
- base::FilePath* path) {
- base::FilePath exe_path;
- if (!PathService::Get(base::DIR_EXE, &exe_path))
- return false;
-
- if (IsPerUserInstall(exe_path.value().c_str())) {
- const base::FilePath maybe_product_dir(exe_path.DirName().DirName());
- if (base::PathExists(exe_path.Append(installer::kChromeExe))) {
- // DIR_EXE is most likely Chrome's directory in which case |exe_path| is
- // the user-level sentinel path.
- *path = exe_path;
- } else if (base::PathExists(
- maybe_product_dir.Append(installer::kChromeExe))) {
- // DIR_EXE can also be the Installer directory if this is called from a
- // setup.exe running from Application\<version>\Installer (see
- // InstallerState::GetInstallerDirectory) in which case Chrome's directory
- // is two levels up.
- *path = maybe_product_dir;
- } else {
- NOTREACHED();
- return false;
- }
- } else {
- std::vector<base::FilePath> user_data_dir_paths;
- installer::GetChromeUserDataPaths(dist, &user_data_dir_paths);
-
- if (!user_data_dir_paths.empty())
- *path = user_data_dir_paths[0];
- else
- return false;
- }
+bool InstallUtil::GetSentinelFilePath(
+ const base::FilePath::CharType* file,
+ BrowserDistribution* dist,
+ base::FilePath* path) {
+ std::vector<base::FilePath> user_data_dir_paths;
+ installer::GetChromeUserDataPaths(dist, &user_data_dir_paths);
- *path = path->Append(file);
+ if (user_data_dir_paths.empty())
+ return false;
+ *path = user_data_dir_paths[0].Append(file);
return true;
}
@@ -560,38 +535,35 @@ base::string16 InstallUtil::GetCurrentDate() {
}
// Open |path| with minimal access to obtain information about it, returning
-// true and populating |handle| on success.
+// true and populating |file| on success.
// static
bool InstallUtil::ProgramCompare::OpenForInfo(const base::FilePath& path,
- base::win::ScopedHandle* handle) {
- DCHECK(handle);
- handle->Set(base::CreatePlatformFile(path, base::PLATFORM_FILE_OPEN, NULL,
- NULL));
- return handle->IsValid();
+ base::File* file) {
+ DCHECK(file);
+ file->Initialize(path, base::File::FLAG_OPEN);
+ return file->IsValid();
}
-// Populate |info| for |handle|, returning true on success.
+// Populate |info| for |file|, returning true on success.
// static
-bool InstallUtil::ProgramCompare::GetInfo(const base::win::ScopedHandle& handle,
+bool InstallUtil::ProgramCompare::GetInfo(const base::File& file,
BY_HANDLE_FILE_INFORMATION* info) {
- DCHECK(handle.IsValid());
- return GetFileInformationByHandle(
- const_cast<base::win::ScopedHandle&>(handle), info) != 0;
+ DCHECK(file.IsValid());
+ return GetFileInformationByHandle(file.GetPlatformFile(), info) != 0;
}
InstallUtil::ProgramCompare::ProgramCompare(const base::FilePath& path_to_match)
: path_to_match_(path_to_match),
- file_handle_(base::kInvalidPlatformFileValue),
file_info_() {
DCHECK(!path_to_match_.empty());
- if (!OpenForInfo(path_to_match_, &file_handle_)) {
+ if (!OpenForInfo(path_to_match_, &file_)) {
PLOG(WARNING) << "Failed opening " << path_to_match_.value()
<< "; falling back to path string comparisons.";
- } else if (!GetInfo(file_handle_, &file_info_)) {
+ } else if (!GetInfo(file_, &file_info_)) {
PLOG(WARNING) << "Failed getting information for "
<< path_to_match_.value()
<< "; falling back to path string comparisons.";
- file_handle_.Close();
+ file_.Close();
}
}
@@ -621,15 +593,15 @@ bool InstallUtil::ProgramCompare::EvaluatePath(
// If the paths don't match and we couldn't open the expected file, we've done
// our best.
- if (!file_handle_.IsValid())
+ if (!file_.IsValid())
return false;
// Open the program and see if it references the expected file.
- base::win::ScopedHandle handle;
+ base::File file;
BY_HANDLE_FILE_INFORMATION info = {};
- return (OpenForInfo(path, &handle) &&
- GetInfo(handle, &info) &&
+ return (OpenForInfo(path, &file) &&
+ GetInfo(file, &info) &&
info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber &&
info.nFileIndexHigh == file_info_.nFileIndexHigh &&
info.nFileIndexLow == file_info_.nFileIndexLow);
diff --git a/chrome/installer/util/install_util.h b/chrome/installer/util/install_util.h
index eaa9e9e4b4..5bc6b912af 100644
--- a/chrome/installer/util/install_util.h
+++ b/chrome/installer/util/install_util.h
@@ -14,6 +14,7 @@
#include "base/basictypes.h"
#include "base/command_line.h"
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/strings/string16.h"
#include "base/win/scoped_handle.h"
@@ -40,12 +41,12 @@ class InstallUtil {
static void TriggerActiveSetupCommand();
// Launches given exe as admin on Vista.
- static bool ExecuteExeAsAdmin(const CommandLine& cmd, DWORD* exit_code);
+ static bool ExecuteExeAsAdmin(const base::CommandLine& cmd, DWORD* exit_code);
// Reads the uninstall command for Chromium from registry and returns it.
// If system_install is true the command is read from HKLM, otherwise
// from HKCU.
- static CommandLine GetChromeUninstallCmd(
+ static base::CommandLine GetChromeUninstallCmd(
bool system_install,
BrowserDistribution::Type distribution_type);
@@ -105,9 +106,8 @@ class InstallUtil {
// by either --chrome-sxs or the executable path).
static bool IsChromeSxSProcess();
- // Populates |path| with the path to |file| in the sentinel directory. This is
- // the application directory for user-level installs, and the default user
- // data dir for system-level installs. Returns false on error.
+ // Populates |path| with the path to |file| in the sentinel directory for
+ // |dist|. Returns false on error.
static bool GetSentinelFilePath(const base::FilePath::CharType* file,
BrowserDistribution* dist,
base::FilePath* path);
@@ -173,7 +173,7 @@ class InstallUtil {
// Composes |program| and |arguments| into |command_line|.
static void MakeUninstallCommand(const base::string16& program,
const base::string16& arguments,
- CommandLine* command_line);
+ base::CommandLine* command_line);
// Returns a string in the form YYYYMMDD of the current date.
static base::string16 GetCurrentDate();
@@ -190,13 +190,12 @@ class InstallUtil {
bool EvaluatePath(const base::FilePath& path) const;
protected:
- static bool OpenForInfo(const base::FilePath& path,
- base::win::ScopedHandle* handle);
- static bool GetInfo(const base::win::ScopedHandle& handle,
+ static bool OpenForInfo(const base::FilePath& path, base::File* file);
+ static bool GetInfo(const base::File& file,
BY_HANDLE_FILE_INFORMATION* info);
base::FilePath path_to_match_;
- base::win::ScopedHandle file_handle_;
+ base::File file_;
BY_HANDLE_FILE_INFORMATION file_info_;
private:
diff --git a/chrome/installer/util/install_util_unittest.cc b/chrome/installer/util/install_util_unittest.cc
index 9d37df50fd..f1234b8c10 100644
--- a/chrome/installer/util/install_util_unittest.cc
+++ b/chrome/installer/util/install_util_unittest.cc
@@ -417,7 +417,7 @@ TEST_F(InstallUtilTest, ProgramCompare) {
// Tests where the expected file exists.
static const char data[] = "data";
ASSERT_TRUE(base::CreateDirectory(some_long_dir));
- ASSERT_NE(-1, file_util::WriteFile(expect, data, arraysize(data) - 1));
+ ASSERT_NE(-1, base::WriteFile(expect, data, arraysize(data) - 1));
// Paths don't match.
EXPECT_FALSE(InstallUtil::ProgramCompare(expect).Evaluate(
L"\"" + other.value() + L"\""));
diff --git a/chrome/installer/util/installation_state.cc b/chrome/installer/util/installation_state.cc
index d6d06abc5b..91631b1473 100644
--- a/chrome/installer/util/installation_state.cc
+++ b/chrome/installer/util/installation_state.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "base/strings/string_util.h"
+#include "base/strings/utf_string_conversions.h"
#include "base/version.h"
#include "base/win/registry.h"
#include "chrome/installer/util/google_update_constants.h"
@@ -57,10 +58,10 @@ bool ProductState::Initialize(bool system_install,
// Read from the Clients key.
if (key.Open(root_key, version_key.c_str(),
KEY_QUERY_VALUE) == ERROR_SUCCESS) {
- std::wstring version_str;
+ base::string16 version_str;
if (key.ReadValue(google_update::kRegVersionField,
&version_str) == ERROR_SUCCESS) {
- version_.reset(new Version(WideToASCII(version_str)));
+ version_.reset(new Version(base::UTF16ToASCII(version_str)));
if (!version_->IsValid())
version_.reset();
}
@@ -70,7 +71,7 @@ bool ProductState::Initialize(bool system_install,
// only be accessible via InstallationState::GetNonVersionedProductState.
if (key.ReadValue(google_update::kRegOldVersionField,
&version_str) == ERROR_SUCCESS) {
- old_version_.reset(new Version(WideToASCII(version_str)));
+ old_version_.reset(new Version(base::UTF16ToASCII(version_str)));
if (!old_version_->IsValid())
old_version_.reset();
}
diff --git a/chrome/installer/util/installation_state.h b/chrome/installer/util/installation_state.h
index 153760d27d..28630cc7f4 100644
--- a/chrome/installer/util/installation_state.h
+++ b/chrome/installer/util/installation_state.h
@@ -83,7 +83,9 @@ class ProductState {
bool is_msi() const { return msi_; }
// The command to uninstall the product; may be empty.
- const CommandLine& uninstall_command() const { return uninstall_command_; }
+ const base::CommandLine& uninstall_command() const {
+ return uninstall_command_;
+ }
// True if |uninstall_command| contains --multi-install.
bool is_multi_install() const { return multi_install_; }
@@ -107,7 +109,7 @@ class ProductState {
std::wstring brand_;
std::wstring rename_cmd_;
std::wstring oem_install_;
- CommandLine uninstall_command_;
+ base::CommandLine uninstall_command_;
AppCommands commands_;
DWORD eula_accepted_;
DWORD usagestats_;
diff --git a/chrome/installer/util/installation_validator.h b/chrome/installer/util/installation_validator.h
index 3dcc583a5f..46212f6bc1 100644
--- a/chrome/installer/util/installation_validator.h
+++ b/chrome/installer/util/installation_validator.h
@@ -15,9 +15,8 @@
#include "base/strings/string16.h"
#include "chrome/installer/util/browser_distribution.h"
-class CommandLine;
-
namespace base {
+class CommandLine;
class FilePath;
}
@@ -231,12 +230,12 @@ class InstallationValidator {
const base::string16& purpose,
bool* is_valid);
static void ValidateCommandExpectations(const ProductContext& ctx,
- const CommandLine& command,
+ const base::CommandLine& command,
const SwitchExpectations& expected,
const base::string16& source,
bool* is_valid);
static void ValidateUninstallCommand(const ProductContext& ctx,
- const CommandLine& command,
+ const base::CommandLine& command,
const base::string16& source,
bool* is_valid);
static void ValidateRenameCommand(const ProductContext& ctx,
diff --git a/chrome/installer/util/installer_state.cc b/chrome/installer/util/installer_state.cc
index 500aadce45..a5ed9d96e8 100644
--- a/chrome/installer/util/installer_state.cc
+++ b/chrome/installer/util/installer_state.cc
@@ -662,7 +662,7 @@ void InstallerState::GetExistingExeVersions(
if (file_version_info) {
base::string16 version_string = file_version_info->file_version();
if (!version_string.empty() && IsStringASCII(version_string))
- existing_versions->insert(WideToASCII(version_string));
+ existing_versions->insert(base::UTF16ToASCII(version_string));
}
}
}
@@ -689,7 +689,7 @@ void InstallerState::RemoveOldVersionDirectories(
for (base::FilePath next_version = version_enum.Next(); !next_version.empty();
next_version = version_enum.Next()) {
base::FilePath dir_name(next_version.BaseName());
- version = Version(WideToASCII(dir_name.value()));
+ version = Version(base::UTF16ToASCII(dir_name.value()));
// Delete the version folder if it is less than the new version and not
// equal to the old version (if we have an old version).
if (version.IsValid() &&
diff --git a/chrome/installer/util/installer_state.h b/chrome/installer/util/installer_state.h
index fd65574c34..7b22cf6ec3 100644
--- a/chrome/installer/util/installer_state.h
+++ b/chrome/installer/util/installer_state.h
@@ -23,7 +23,9 @@
#include <windows.h> // NOLINT
#endif
+namespace base {
class CommandLine;
+}
namespace installer {
@@ -73,7 +75,7 @@ class InstallerState {
explicit InstallerState(Level level);
// Initializes this object based on the current operation.
- void Initialize(const CommandLine& command_line,
+ void Initialize(const base::CommandLine& command_line,
const MasterPreferences& prefs,
const InstallationState& machine_state);
diff --git a/chrome/installer/util/installer_state_unittest.cc b/chrome/installer/util/installer_state_unittest.cc
index 3818712f2f..a9e4f06ef5 100644
--- a/chrome/installer/util/installer_state_unittest.cc
+++ b/chrome/installer/util/installer_state_unittest.cc
@@ -589,7 +589,7 @@ TEST_F(InstallerStateTest, RemoveOldVersionDirs) {
for (base::FilePath next_version = version_enum.Next(); !next_version.empty();
next_version = version_enum.Next()) {
base::FilePath dir_name(next_version.BaseName());
- Version version(WideToASCII(dir_name.value()));
+ Version version(base::UTF16ToASCII(dir_name.value()));
if (version.IsValid()) {
EXPECT_TRUE(expected_remaining_dirs.erase(version.GetString()))
<< "Unexpected version dir found: " << version.GetString();
diff --git a/chrome/installer/util/logging_installer.cc b/chrome/installer/util/logging_installer.cc
index 5839989df2..18a734ec75 100644
--- a/chrome/installer/util/logging_installer.cc
+++ b/chrome/installer/util/logging_installer.cc
@@ -8,11 +8,11 @@
#include "base/command_line.h"
#include "base/file_util.h"
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/logging_win.h"
#include "base/path_service.h"
-#include "base/platform_file.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/scoped_handle.h"
@@ -37,12 +37,11 @@ TruncateResult TruncateLogFileIfNeeded(const base::FilePath& log_file) {
if (base::GetFileSize(log_file, &log_size) &&
log_size > kMaxInstallerLogFileSize) {
// Cause the old log file to be deleted when we are done with it.
- const int file_flags = base::PLATFORM_FILE_OPEN |
- base::PLATFORM_FILE_READ |
- base::PLATFORM_FILE_SHARE_DELETE |
- base::PLATFORM_FILE_DELETE_ON_CLOSE;
- base::win::ScopedHandle old_log_file(
- base::CreatePlatformFile(log_file, file_flags, NULL, NULL));
+ uint32 file_flags = base::File::FLAG_OPEN |
+ base::File::FLAG_READ |
+ base::File::FLAG_SHARE_DELETE |
+ base::File::FLAG_DELETE_ON_CLOSE;
+ base::File old_log_file(log_file, file_flags);
if (old_log_file.IsValid()) {
result = LOGFILE_DELETED;
@@ -51,14 +50,12 @@ TruncateResult TruncateLogFileIfNeeded(const base::FilePath& log_file) {
if (base::Move(log_file, tmp_log)) {
int64 offset = log_size - kTruncatedInstallerLogFileSize;
std::string old_log_data(kTruncatedInstallerLogFileSize, 0);
- int bytes_read = base::ReadPlatformFile(old_log_file,
- offset,
- &old_log_data[0],
- kTruncatedInstallerLogFileSize);
+ int bytes_read = old_log_file.Read(offset,
+ &old_log_data[0],
+ kTruncatedInstallerLogFileSize);
if (bytes_read > 0 &&
- (bytes_read == file_util::WriteFile(log_file,
- &old_log_data[0],
- bytes_read) ||
+ (bytes_read == base::WriteFile(log_file, &old_log_data[0],
+ bytes_read) ||
base::PathExists(log_file))) {
result = LOGFILE_TRUNCATED;
}
diff --git a/chrome/installer/util/logging_installer_unittest.cc b/chrome/installer/util/logging_installer_unittest.cc
index 7bc1c4532f..19eef2f747 100644
--- a/chrome/installer/util/logging_installer_unittest.cc
+++ b/chrome/installer/util/logging_installer_unittest.cc
@@ -5,9 +5,9 @@
#include <string>
#include "base/file_util.h"
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/platform_file.h"
#include "base/win/scoped_handle.h"
#include "chrome/installer/util/logging_installer.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -20,7 +20,7 @@ TEST(LoggingInstallerTest, TestTruncate) {
base::FilePath temp_file = temp_dir.path().Append(L"temp");
EXPECT_EQ(test_data.size(),
- file_util::WriteFile(temp_file, &test_data[0], test_data.size()));
+ base::WriteFile(temp_file, &test_data[0], test_data.size()));
ASSERT_TRUE(base::PathExists(temp_file));
int64 file_size = 0;
@@ -45,7 +45,7 @@ TEST(LoggingInstallerTest, TestTruncationNotNeeded) {
base::FilePath temp_file = temp_dir.path().Append(L"temp");
EXPECT_EQ(test_data.size(),
- file_util::WriteFile(temp_file, &test_data[0], test_data.size()));
+ base::WriteFile(temp_file, &test_data[0], test_data.size()));
ASSERT_TRUE(base::PathExists(temp_file));
int64 file_size = 0;
@@ -67,18 +67,17 @@ TEST(LoggingInstallerTest, TestInUseNeedsTruncation) {
base::FilePath temp_file = temp_dir.path().Append(L"temp");
EXPECT_EQ(test_data.size(),
- file_util::WriteFile(temp_file, &test_data[0], test_data.size()));
+ base::WriteFile(temp_file, &test_data[0], test_data.size()));
ASSERT_TRUE(base::PathExists(temp_file));
int64 file_size = 0;
EXPECT_TRUE(base::GetFileSize(temp_file, &file_size));
EXPECT_EQ(test_data.size(), file_size);
// Prevent the log file from being moved or deleted.
- const int file_flags = base::PLATFORM_FILE_OPEN |
- base::PLATFORM_FILE_READ |
- base::PLATFORM_FILE_EXCLUSIVE_READ;
- base::win::ScopedHandle temp_platform_file(
- base::CreatePlatformFile(temp_file, file_flags, NULL, NULL));
+ uint32 file_flags = base::File::FLAG_OPEN |
+ base::File::FLAG_READ |
+ base::File::FLAG_EXCLUSIVE_READ;
+ base::File temp_platform_file(temp_file, file_flags);
ASSERT_TRUE(temp_platform_file.IsValid());
EXPECT_EQ(installer::LOGFILE_UNTOUCHED,
@@ -96,7 +95,7 @@ TEST(LoggingInstallerTest, TestMoveFailsNeedsTruncation) {
base::FilePath temp_file = temp_dir.path().Append(L"temp");
EXPECT_EQ(test_data.size(),
- file_util::WriteFile(temp_file, &test_data[0], test_data.size()));
+ base::WriteFile(temp_file, &test_data[0], test_data.size()));
ASSERT_TRUE(base::PathExists(temp_file));
int64 file_size = 0;
EXPECT_TRUE(base::GetFileSize(temp_file, &file_size));
@@ -104,13 +103,12 @@ TEST(LoggingInstallerTest, TestMoveFailsNeedsTruncation) {
// Create an inconvenient, non-deletable file in the location that
// TruncateLogFileIfNeeded would like to move the log file to.
- const int file_flags = base::PLATFORM_FILE_CREATE |
- base::PLATFORM_FILE_READ |
- base::PLATFORM_FILE_EXCLUSIVE_READ;
+ uint32 file_flags = base::File::FLAG_CREATE |
+ base::File::FLAG_READ |
+ base::File::FLAG_EXCLUSIVE_READ;
base::FilePath temp_file_move_dest(
temp_file.value() + FILE_PATH_LITERAL(".tmp"));
- base::win::ScopedHandle temp_move_destination_file(
- base::CreatePlatformFile(temp_file_move_dest, file_flags, NULL, NULL));
+ base::File temp_move_destination_file(temp_file_move_dest, file_flags);
ASSERT_TRUE(temp_move_destination_file.IsValid());
EXPECT_EQ(installer::LOGFILE_DELETED,
diff --git a/chrome/installer/util/master_preferences.h b/chrome/installer/util/master_preferences.h
index b068b462fd..83f1150025 100644
--- a/chrome/installer/util/master_preferences.h
+++ b/chrome/installer/util/master_preferences.h
@@ -85,7 +85,7 @@ class MasterPreferences {
// is present in the command line.
// The options from the preference file and command line are merged, with the
// ones from the command line taking precedence in case of a conflict.
- explicit MasterPreferences(const CommandLine& cmd_line);
+ explicit MasterPreferences(const base::CommandLine& cmd_line);
// Parses a specific preferences file and does not merge any command line
// switches with the distribution dictionary.
@@ -191,7 +191,7 @@ class MasterPreferences {
static const MasterPreferences& ForCurrentProcess();
protected:
- void InitializeFromCommandLine(const CommandLine& cmd_line);
+ void InitializeFromCommandLine(const base::CommandLine& cmd_line);
// Initializes the instance from a given JSON string, returning true if the
// string was successfully parsed.
diff --git a/chrome/installer/util/master_preferences_unittest.cc b/chrome/installer/util/master_preferences_unittest.cc
index ba8edfccc5..4a6182f192 100644
--- a/chrome/installer/util/master_preferences_unittest.cc
+++ b/chrome/installer/util/master_preferences_unittest.cc
@@ -76,7 +76,7 @@ TEST_F(MasterPreferencesTest, ParseDistroParams) {
" }\n"
"} \n";
- EXPECT_TRUE(file_util::WriteFile(prefs_file(), text, strlen(text)));
+ EXPECT_TRUE(base::WriteFile(prefs_file(), text, strlen(text)));
installer::MasterPreferences prefs(prefs_file());
EXPECT_TRUE(prefs.read_from_file());
@@ -135,7 +135,7 @@ TEST_F(MasterPreferencesTest, ParseMissingDistroParams) {
" }\n"
"} \n";
- EXPECT_TRUE(file_util::WriteFile(prefs_file(), text, strlen(text)));
+ EXPECT_TRUE(base::WriteFile(prefs_file(), text, strlen(text)));
installer::MasterPreferences prefs(prefs_file());
EXPECT_TRUE(prefs.read_from_file());
@@ -194,7 +194,7 @@ TEST_F(MasterPreferencesTest, FirstRunTabs) {
" ]\n"
"} \n";
- EXPECT_TRUE(file_util::WriteFile(prefs_file(), text, strlen(text)));
+ EXPECT_TRUE(base::WriteFile(prefs_file(), text, strlen(text)));
installer::MasterPreferences prefs(prefs_file());
typedef std::vector<std::string> TabsVector;
TabsVector tabs = prefs.GetFirstRunTabs();
@@ -252,7 +252,7 @@ TEST_F(MasterPreferencesTest, GetInstallPreferencesTest) {
" \"verbose_logging\": false\n"
" }\n"
"} \n";
- EXPECT_TRUE(file_util::WriteFile(prefs_file, text, strlen(text)));
+ EXPECT_TRUE(base::WriteFile(prefs_file, text, strlen(text)));
// Make sure command line values override the values in master preferences.
std::wstring cmd_str(
diff --git a/chrome/installer/util/move_tree_work_item_unittest.cc b/chrome/installer/util/move_tree_work_item_unittest.cc
index e51d88fa5c..8d60bd691c 100644
--- a/chrome/installer/util/move_tree_work_item_unittest.cc
+++ b/chrome/installer/util/move_tree_work_item_unittest.cc
@@ -12,6 +12,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
+#include "base/strings/utf_string_conversions.h"
#include "chrome/installer/util/installer_util_test_common.h"
#include "chrome/installer/util/move_tree_work_item.h"
#include "chrome/installer/util/work_item.h"
@@ -33,7 +34,7 @@ class MoveTreeWorkItemTest : public testing::Test {
void CreateTextFile(const std::wstring& filename,
const std::wstring& contents) {
std::wofstream file;
- file.open(WideToASCII(filename).c_str());
+ file.open(base::UTF16ToASCII(filename).c_str());
ASSERT_TRUE(file.is_open());
file << contents;
file.close();
@@ -43,7 +44,7 @@ void CreateTextFile(const std::wstring& filename,
std::wstring ReadTextFile(const base::FilePath& path) {
WCHAR contents[64];
std::wifstream file;
- file.open(WideToASCII(path.value()).c_str());
+ file.open(base::UTF16ToASCII(path.value()).c_str());
EXPECT_TRUE(file.is_open());
file.getline(contents, arraysize(contents));
file.close();
diff --git a/chrome/installer/util/product.h b/chrome/installer/util/product.h
index 9ff763b9b0..4e70b424b5 100644
--- a/chrome/installer/util/product.h
+++ b/chrome/installer/util/product.h
@@ -14,7 +14,9 @@
#include "chrome/installer/util/shell_util.h"
#include "chrome/installer/util/util_constants.h"
+namespace base {
class CommandLine;
+}
namespace installer {
@@ -40,7 +42,8 @@ class Product {
void InitializeFromPreferences(const MasterPreferences& prefs);
- void InitializeFromUninstallCommand(const CommandLine& uninstall_command);
+ void InitializeFromUninstallCommand(
+ const base::CommandLine& uninstall_command);
BrowserDistribution* distribution() const {
return distribution_;
@@ -98,7 +101,7 @@ class Product {
// NOTE: The 'options' CommandLine object should only contain parameters.
// The program part will be ignored.
bool LaunchChromeAndWait(const base::FilePath& application_path,
- const CommandLine& options,
+ const base::CommandLine& options,
int32* exit_code) const;
// Sets the boolean MSI marker for this installation if set is true or clears
@@ -117,10 +120,10 @@ class Product {
void AddComDllList(std::vector<base::FilePath>* com_dll_list) const;
// See ProductOperations::AppendProductFlags.
- void AppendProductFlags(CommandLine* command_line) const;
+ void AppendProductFlags(base::CommandLine* command_line) const;
// See ProductOperations::AppendRenameFlags.
- void AppendRenameFlags(CommandLine* command_line) const;
+ void AppendRenameFlags(base::CommandLine* command_line) const;
// See Productoperations::SetChannelFlags.
bool SetChannelFlags(bool set, ChannelInfo* channel_info) const;
diff --git a/chrome/installer/util/product_operations.h b/chrome/installer/util/product_operations.h
index bb6c208968..d84a1b9e89 100644
--- a/chrome/installer/util/product_operations.h
+++ b/chrome/installer/util/product_operations.h
@@ -15,7 +15,10 @@
#include "chrome/installer/util/util_constants.h"
class BrowserDistribution;
+
+namespace base {
class CommandLine;
+}
namespace installer {
@@ -35,7 +38,7 @@ class ProductOperations {
std::set<base::string16>* options) const = 0;
// Reads product-specific options from |command|, adding them to |options|.
- virtual void ReadOptions(const CommandLine& command,
+ virtual void ReadOptions(const base::CommandLine& command,
std::set<base::string16>* options) const = 0;
// A key-file is a file such as a DLL on Windows that is expected to be in use
@@ -59,11 +62,11 @@ class ProductOperations {
// required for product-specific uninstall commands, but are of use for any
// invocation of setup.exe for the product.
virtual void AppendProductFlags(const std::set<base::string16>& options,
- CommandLine* cmd_line) const = 0;
+ base::CommandLine* cmd_line) const = 0;
// Given a command line, appends the set of product-specific rename flags.
virtual void AppendRenameFlags(const std::set<base::string16>& options,
- CommandLine* cmd_line) const = 0;
+ base::CommandLine* cmd_line) const = 0;
// Adds or removes product-specific flags in |channel_info|. Returns true if
// |channel_info| is modified.
diff --git a/chrome/installer/util/self_cleaning_temp_dir_unittest.cc b/chrome/installer/util/self_cleaning_temp_dir_unittest.cc
index 7366211fac..9ff34254e0 100644
--- a/chrome/installer/util/self_cleaning_temp_dir_unittest.cc
+++ b/chrome/installer/util/self_cleaning_temp_dir_unittest.cc
@@ -161,8 +161,8 @@ TEST_F(SelfCleaningTempDirTest, LeaveUsedOnDestroy) {
EXPECT_TRUE(base::DirectoryExists(temp_dir.path()));
// Drop a file somewhere.
EXPECT_EQ(arraysize(kHiHon) - 1,
- file_util::WriteFile(parent_temp_dir.Append(GetRandomFilename()),
- kHiHon, arraysize(kHiHon) - 1));
+ base::WriteFile(parent_temp_dir.Append(GetRandomFilename()),
+ kHiHon, arraysize(kHiHon) - 1));
}
EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.Append(L"Three")));
EXPECT_TRUE(base::DirectoryExists(parent_temp_dir));
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index 96ab1e6eb6..9e705cce2f 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -152,7 +152,7 @@ UserSpecificRegistrySuffix::UserSpecificRegistrySuffix() {
}
COMPILE_ASSERT(sizeof(base::MD5Digest) == 16, size_of_MD5_not_as_expected_);
base::MD5Digest md5_digest;
- std::string user_sid_ascii(UTF16ToASCII(user_sid));
+ std::string user_sid_ascii(base::UTF16ToASCII(user_sid));
base::MD5Sum(user_sid_ascii.c_str(), user_sid_ascii.length(), &md5_digest);
const base::string16 base32_md5(
ShellUtil::ByteArrayToBase32(md5_digest.a, arraysize(md5_digest.a)));
@@ -1048,6 +1048,7 @@ bool ShortNameFromPath(const base::FilePath& path, base::string16* short_path) {
// did not perform validation on the ProgID registered as the current default.
// As a result, stale ProgIDs could be returned, leading to false positives.
ShellUtil::DefaultState ProbeCurrentDefaultHandlers(
+ const base::FilePath& chrome_exe,
const wchar_t* const* protocols,
size_t num_protocols) {
base::win::ScopedComPtr<IApplicationAssociationRegistration> registration;
@@ -1057,11 +1058,6 @@ ShellUtil::DefaultState ProbeCurrentDefaultHandlers(
return ShellUtil::UNKNOWN_DEFAULT;
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- base::FilePath chrome_exe;
- if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
- NOTREACHED();
- return ShellUtil::UNKNOWN_DEFAULT;
- }
base::string16 prog_id(dist->GetBrowserProgIdPrefix());
prog_id += ShellUtil::GetCurrentInstallationSuffix(dist, chrome_exe.value());
@@ -1079,6 +1075,7 @@ ShellUtil::DefaultState ProbeCurrentDefaultHandlers(
// Probe using IApplicationAssociationRegistration::QueryAppIsDefault (Vista and
// Windows 7); see ProbeProtocolHandlers.
ShellUtil::DefaultState ProbeAppIsDefaultHandlers(
+ const base::FilePath& chrome_exe,
const wchar_t* const* protocols,
size_t num_protocols) {
base::win::ScopedComPtr<IApplicationAssociationRegistration> registration;
@@ -1088,11 +1085,6 @@ ShellUtil::DefaultState ProbeAppIsDefaultHandlers(
return ShellUtil::UNKNOWN_DEFAULT;
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- base::FilePath chrome_exe;
- if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
- NOTREACHED();
- return ShellUtil::UNKNOWN_DEFAULT;
- }
base::string16 app_name(
ShellUtil::GetApplicationName(dist, chrome_exe.value()));
@@ -1111,18 +1103,12 @@ ShellUtil::DefaultState ProbeAppIsDefaultHandlers(
// Probe the current commands registered to handle the shell "open" verb for
// |protocols| (Windows XP); see ProbeProtocolHandlers.
ShellUtil::DefaultState ProbeOpenCommandHandlers(
+ const base::FilePath& chrome_exe,
const wchar_t* const* protocols,
size_t num_protocols) {
- // Get the path to the current exe (Chrome).
- base::FilePath app_path;
- if (!PathService::Get(base::FILE_EXE, &app_path)) {
- LOG(ERROR) << "Error getting app exe path";
- return ShellUtil::UNKNOWN_DEFAULT;
- }
-
// Get its short (8.3) form.
base::string16 short_app_path;
- if (!ShortNameFromPath(app_path, &short_app_path))
+ if (!ShortNameFromPath(chrome_exe, &short_app_path))
return ShellUtil::UNKNOWN_DEFAULT;
const HKEY root_key = HKEY_CLASSES_ROOT;
@@ -1158,22 +1144,23 @@ ShellUtil::DefaultState ProbeOpenCommandHandlers(
// Chrome is the default handler for |protocols|. Returns IS_DEFAULT
// only if Chrome is the default for all specified protocols.
ShellUtil::DefaultState ProbeProtocolHandlers(
+ const base::FilePath& chrome_exe,
const wchar_t* const* protocols,
size_t num_protocols) {
+#if DCHECK_IS_ON
DCHECK(!num_protocols || protocols);
- if (DCHECK_IS_ON()) {
- for (size_t i = 0; i < num_protocols; ++i)
- DCHECK(protocols[i] && *protocols[i]);
- }
+ for (size_t i = 0; i < num_protocols; ++i)
+ DCHECK(protocols[i] && *protocols[i]);
+#endif
const base::win::Version windows_version = base::win::GetVersion();
if (windows_version >= base::win::VERSION_WIN8)
- return ProbeCurrentDefaultHandlers(protocols, num_protocols);
+ return ProbeCurrentDefaultHandlers(chrome_exe, protocols, num_protocols);
else if (windows_version >= base::win::VERSION_VISTA)
- return ProbeAppIsDefaultHandlers(protocols, num_protocols);
+ return ProbeAppIsDefaultHandlers(chrome_exe, protocols, num_protocols);
- return ProbeOpenCommandHandlers(protocols, num_protocols);
+ return ProbeOpenCommandHandlers(chrome_exe, protocols, num_protocols);
}
// (Windows 8+) Finds and stores an app shortcuts folder path in *|path|.
@@ -1771,6 +1758,17 @@ base::string16 ShellUtil::BuildAppModelId(
}
ShellUtil::DefaultState ShellUtil::GetChromeDefaultState() {
+ base::FilePath app_path;
+ if (!PathService::Get(base::FILE_EXE, &app_path)) {
+ NOTREACHED();
+ return ShellUtil::UNKNOWN_DEFAULT;
+ }
+
+ return GetChromeDefaultStateFromPath(app_path);
+}
+
+ShellUtil::DefaultState ShellUtil::GetChromeDefaultStateFromPath(
+ const base::FilePath& chrome_exe) {
BrowserDistribution* distribution = BrowserDistribution::GetDistribution();
if (distribution->GetDefaultBrowserControlPolicy() ==
BrowserDistribution::DEFAULT_BROWSER_UNSUPPORTED) {
@@ -1786,7 +1784,9 @@ ShellUtil::DefaultState ShellUtil::GetChromeDefaultState() {
// flag. There is doubtless some other key we can hook into to cause "Repair"
// to show up in Add/Remove programs for us.
static const wchar_t* const kChromeProtocols[] = { L"http", L"https" };
- return ProbeProtocolHandlers(kChromeProtocols, arraysize(kChromeProtocols));
+ return ProbeProtocolHandlers(chrome_exe,
+ kChromeProtocols,
+ arraysize(kChromeProtocols));
}
ShellUtil::DefaultState ShellUtil::GetChromeDefaultProtocolClientState(
@@ -1800,8 +1800,16 @@ ShellUtil::DefaultState ShellUtil::GetChromeDefaultProtocolClientState(
if (protocol.empty())
return UNKNOWN_DEFAULT;
+ base::FilePath chrome_exe;
+ if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
+ NOTREACHED();
+ return ShellUtil::UNKNOWN_DEFAULT;
+ }
+
const wchar_t* const protocols[] = { protocol.c_str() };
- return ProbeProtocolHandlers(protocols, arraysize(protocols));
+ return ProbeProtocolHandlers(chrome_exe,
+ protocols,
+ arraysize(protocols));
}
// static
diff --git a/chrome/installer/util/shell_util.h b/chrome/installer/util/shell_util.h
index d8b4073cff..bf0f2181a6 100644
--- a/chrome/installer/util/shell_util.h
+++ b/chrome/installer/util/shell_util.h
@@ -412,6 +412,11 @@ class ShellUtil {
// Returns the DefaultState of Chrome for HTTP and HTTPS.
static DefaultState GetChromeDefaultState();
+ // Returns the DefaultState of the Chrome instance with the specified path
+ // for HTTP and HTTPs.
+ static DefaultState GetChromeDefaultStateFromPath(
+ const base::FilePath& chrome_exe);
+
// Returns the DefaultState of Chrome for |protocol|.
static DefaultState GetChromeDefaultProtocolClientState(
const base::string16& protocol);
diff --git a/chrome/installer/util/shell_util_unittest.cc b/chrome/installer/util/shell_util_unittest.cc
index be5362285e..134b31cf06 100644
--- a/chrome/installer/util/shell_util_unittest.cc
+++ b/chrome/installer/util/shell_util_unittest.cc
@@ -45,16 +45,16 @@ class ShellUtilShortcutTest : public testing::Test {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
chrome_exe_ = temp_dir_.path().Append(installer::kChromeExe);
- EXPECT_EQ(0, file_util::WriteFile(chrome_exe_, "", 0));
+ EXPECT_EQ(0, base::WriteFile(chrome_exe_, "", 0));
manganese_exe_ = temp_dir_.path().Append(kManganeseExe);
- EXPECT_EQ(0, file_util::WriteFile(manganese_exe_, "", 0));
+ EXPECT_EQ(0, base::WriteFile(manganese_exe_, "", 0));
iron_exe_ = temp_dir_.path().Append(kIronExe);
- EXPECT_EQ(0, file_util::WriteFile(iron_exe_, "", 0));
+ EXPECT_EQ(0, base::WriteFile(iron_exe_, "", 0));
other_ico_ = temp_dir_.path().Append(kOtherIco);
- EXPECT_EQ(0, file_util::WriteFile(other_ico_, "", 0));
+ EXPECT_EQ(0, base::WriteFile(other_ico_, "", 0));
ASSERT_TRUE(fake_user_desktop_.CreateUniqueTempDir());
ASSERT_TRUE(fake_common_desktop_.CreateUniqueTempDir());
@@ -773,7 +773,7 @@ TEST_F(ShellUtilShortcutTest, DontRemoveChromeShortcutIfPointsToAnotherChrome) {
ASSERT_TRUE(other_exe_dir.CreateUniqueTempDir());
base::FilePath other_chrome_exe =
other_exe_dir.path().Append(installer::kChromeExe);
- EXPECT_EQ(0, file_util::WriteFile(other_chrome_exe, "", 0));
+ EXPECT_EQ(0, base::WriteFile(other_chrome_exe, "", 0));
test_properties_.set_target(other_chrome_exe);
ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
@@ -846,8 +846,8 @@ TEST(ShellUtilTest, GetUserSpecificRegistrySuffix) {
ASSERT_TRUE(ShellUtil::GetUserSpecificRegistrySuffix(&suffix));
ASSERT_TRUE(StartsWith(suffix, L".", true));
ASSERT_EQ(27, suffix.length());
- ASSERT_TRUE(ContainsOnlyChars(suffix.substr(1),
- L"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"));
+ ASSERT_TRUE(base::ContainsOnlyChars(suffix.substr(1),
+ L"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"));
}
TEST(ShellUtilTest, GetOldUserSpecificRegistrySuffix) {
diff --git a/chrome/installer/util/user_experiment.cc b/chrome/installer/util/user_experiment.cc
index 9565b6e86a..4febe24150 100644
--- a/chrome/installer/util/user_experiment.cc
+++ b/chrome/installer/util/user_experiment.cc
@@ -476,7 +476,7 @@ void LaunchBrowserUserExperiment(const CommandLine& base_cmd_line,
cmd_line.AppendSwitchASCII(switches::kInactiveUserToast,
base::IntToString(flavor));
cmd_line.AppendSwitchASCII(switches::kExperimentGroup,
- WideToASCII(base_group));
+ base::UTF16ToASCII(base_group));
LaunchSetup(&cmd_line, system_level);
}
diff --git a/chrome/installer/util/user_experiment.h b/chrome/installer/util/user_experiment.h
index 98fce5f8eb..7856f77452 100644
--- a/chrome/installer/util/user_experiment.h
+++ b/chrome/installer/util/user_experiment.h
@@ -11,9 +11,8 @@
#include "base/strings/string16.h"
#include "chrome/installer/util/util_constants.h"
-class CommandLine;
-
namespace base {
+class CommandLine;
class FilePath;
}
@@ -52,7 +51,7 @@ bool CreateExperimentDetails(int flavor, ExperimentDetails* experiment);
// After an install or upgrade the user might qualify to participate in an
// experiment. This function determines if the user qualifies and if so it
// sets the wheels in motion or in simple cases does the experiment itself.
-void LaunchBrowserUserExperiment(const CommandLine& base_command,
+void LaunchBrowserUserExperiment(const base::CommandLine& base_command,
InstallStatus status,
bool system_level);
diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc
index a1a5692bd1..f19bc0a88d 100644
--- a/chrome/installer/util/util_constants.cc
+++ b/chrome/installer/util/util_constants.cc
@@ -151,6 +151,9 @@ const char kSelfDestruct[] = "self-destruct";
// Install Chrome to system wise location. The default is per user install.
const char kSystemLevel[] = "system-level";
+// Signals to setup.exe that it should trigger the active setup command.
+const char kTriggerActiveSetup[] = "trigger-active-setup";
+
// If present, setup will uninstall chrome.
const char kUninstall[] = "uninstall";
@@ -215,6 +218,7 @@ const wchar_t kChromeFrameHelperDll[] = L"chrome_frame_helper.dll";
const wchar_t kChromeFrameHelperExe[] = L"chrome_frame_helper.exe";
const wchar_t kChromeFrameHelperWndClass[] = L"ChromeFrameHelperWindowClass";
const wchar_t kChromeLauncherExe[] = L"chrome_launcher.exe";
+const wchar_t kChromeMetroDll[] = L"metro_driver.dll";
const wchar_t kChromeNewExe[] = L"new_chrome.exe";
const wchar_t kChromeOldExe[] = L"old_chrome.exe";
const wchar_t kCmdInstallApp[] = L"install-application";
diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h
index c6c11b8d57..d8ab60a0bd 100644
--- a/chrome/installer/util/util_constants.h
+++ b/chrome/installer/util/util_constants.h
@@ -89,12 +89,13 @@ enum InstallStatus {
// in use.
UNUSED_BINARIES_UNINSTALLED, // 52. The binaries were uninstalled.
UNSUPPORTED_OPTION, // 53. An unsupported legacy option was given.
+ CPU_NOT_SUPPORTED, // 54. Current OS not supported
// Friendly reminder: note the COMPILE_ASSERT below.
};
// Existing InstallStatus values must not change. Always add to the end.
-COMPILE_ASSERT(installer::UNSUPPORTED_OPTION == 53,
+COMPILE_ASSERT(installer::CPU_NOT_SUPPORTED == 54,
dont_change_enum);
// The type of an update archive.
@@ -175,6 +176,7 @@ extern const char kRemoveChromeRegistration[];
extern const char kRunAsAdmin[];
extern const char kSelfDestruct[];
extern const char kSystemLevel[];
+extern const char kTriggerActiveSetup[];
extern const char kUninstall[];
extern const char kUpdateSetupExe[];
extern const char kUncompressedArchive[];
@@ -202,8 +204,9 @@ extern const wchar_t kChromeFrameHelperDll[];
extern const wchar_t kChromeFrameHelperExe[];
extern const wchar_t kChromeFrameHelperWndClass[];
extern const wchar_t kChromeLauncherExe[];
-extern const wchar_t kChromeOldExe[];
+extern const wchar_t kChromeMetroDll[];
extern const wchar_t kChromeNewExe[];
+extern const wchar_t kChromeOldExe[];
extern const wchar_t kCmdInstallApp[];
extern const wchar_t kCmdInstallExtension[];
extern const wchar_t kCmdOnOsUpgrade[];