diff options
Diffstat (limited to 'chrome/installer/util')
-rw-r--r-- | chrome/installer/util/copy_tree_work_item.cc | 34 | ||||
-rw-r--r-- | chrome/installer/util/copy_tree_work_item_unittest.cc | 22 | ||||
-rw-r--r-- | chrome/installer/util/create_dir_work_item.cc | 7 | ||||
-rw-r--r-- | chrome/installer/util/create_reg_key_work_item.cc | 10 | ||||
-rw-r--r-- | chrome/installer/util/delete_after_reboot_helper.cc | 95 | ||||
-rw-r--r-- | chrome/installer/util/delete_reg_value_work_item.cc | 8 | ||||
-rw-r--r-- | chrome/installer/util/delete_tree_work_item_unittest.cc | 6 | ||||
-rw-r--r-- | chrome/installer/util/google_chrome_distribution.cc | 8 | ||||
-rw-r--r-- | chrome/installer/util/google_update_settings.cc | 10 | ||||
-rw-r--r-- | chrome/installer/util/helper.cc | 4 | ||||
-rw-r--r-- | chrome/installer/util/install_util.cc | 19 | ||||
-rw-r--r-- | chrome/installer/util/lzma_util.cc | 23 | ||||
-rw-r--r-- | chrome/installer/util/move_tree_work_item.cc | 20 | ||||
-rw-r--r-- | chrome/installer/util/set_reg_value_work_item.cc | 14 | ||||
-rw-r--r-- | chrome/installer/util/shell_util.cc | 2 | ||||
-rw-r--r-- | chrome/installer/util/work_item_list.cc | 2 |
16 files changed, 132 insertions, 152 deletions
diff --git a/chrome/installer/util/copy_tree_work_item.cc b/chrome/installer/util/copy_tree_work_item.cc index bf270e9..026bcc8 100644 --- a/chrome/installer/util/copy_tree_work_item.cc +++ b/chrome/installer/util/copy_tree_work_item.cc @@ -44,9 +44,9 @@ bool CopyTreeWorkItem::Do() { (!file_util::DirectoryExists(source_path_)) && (!file_util::DirectoryExists(dest_path_)) && (file_util::ContentsEqual(source_path_, dest_path_))) { - LOG(INFO) << "Source file " << source_path_.value() - << " and destination file " << dest_path_.value() - << " are exactly same. Returning true."; + VLOG(1) << "Source file " << source_path_.value() + << " and destination file " << dest_path_.value() + << " are exactly same. Returning true."; return true; } else if ((dest_exist) && (overwrite_option_ == WorkItem::NEW_NAME_IF_IN_USE) && @@ -57,13 +57,13 @@ bool CopyTreeWorkItem::Do() { if (alternative_path_.empty() || file_util::PathExists(alternative_path_) || !file_util::CopyFile(source_path_, alternative_path_)) { - LOG(ERROR) << "failed to copy " << source_path_.value() << - " to " << alternative_path_.value(); + LOG(ERROR) << "failed to copy " << source_path_.value() + << " to " << alternative_path_.value(); return false; } else { copied_to_alternate_path_ = true; - LOG(INFO) << "Copied source file " << source_path_.value() - << " to alternative path " << alternative_path_.value(); + VLOG(1) << "Copied source file " << source_path_.value() + << " to alternative path " << alternative_path_.value(); return true; } } else if ((dest_exist) && @@ -79,11 +79,11 @@ bool CopyTreeWorkItem::Do() { if (file_util::Move(dest_path_, backup_path_)) { moved_to_backup_ = true; - LOG(INFO) << "Moved destination " << dest_path_.value() << - " to backup path " << backup_path_.value(); + VLOG(1) << "Moved destination " << dest_path_.value() << + " to backup path " << backup_path_.value(); } else { - LOG(ERROR) << "failed moving " << dest_path_.value() << " to " << - backup_path_.value(); + LOG(ERROR) << "failed moving " << dest_path_.value() + << " to " << backup_path_.value(); return false; } } @@ -91,11 +91,11 @@ bool CopyTreeWorkItem::Do() { // In all cases that reach here, copy source to destination. if (file_util::CopyDirectory(source_path_, dest_path_, true)) { copied_to_dest_path_ = true; - LOG(INFO) << "Copied source " << source_path_.value() - << " to destination " << dest_path_.value(); + VLOG(1) << "Copied source " << source_path_.value() + << " to destination " << dest_path_.value(); } else { - LOG(ERROR) << "failed copy " << source_path_.value() << - " to " << dest_path_.value(); + LOG(ERROR) << "failed copy " << source_path_.value() + << " to " << dest_path_.value(); return false; } @@ -112,8 +112,8 @@ void CopyTreeWorkItem::Rollback() { LOG(ERROR) << "Can not delete " << dest_path_.value(); } if (moved_to_backup_ && !file_util::Move(backup_path_, dest_path_)) { - LOG(ERROR) << "failed move " << backup_path_.value() << " to " << - dest_path_.value(); + LOG(ERROR) << "failed move " << backup_path_.value() + << " to " << dest_path_.value(); } if (copied_to_alternate_path_ && !file_util::Delete(alternative_path_, true)) { diff --git a/chrome/installer/util/copy_tree_work_item_unittest.cc b/chrome/installer/util/copy_tree_work_item_unittest.cc index a7498af..269d2fe 100644 --- a/chrome/installer/util/copy_tree_work_item_unittest.cc +++ b/chrome/installer/util/copy_tree_work_item_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -344,8 +344,8 @@ TEST_F(CopyTreeWorkItemTest, CopyFileInUse) { file_util::CopyFile(exe_full_path, file_name_to); ASSERT_TRUE(file_util::PathExists(file_name_to)); - LOG(INFO) << "copy ourself from " - << exe_full_path.value() << " to " << file_name_to.value(); + VLOG(1) << "copy ourself from " << exe_full_path.value() + << " to " << file_name_to.value(); // Run the executable in destination path STARTUPINFOW si = {sizeof(si)}; @@ -422,8 +422,8 @@ TEST_F(CopyTreeWorkItemTest, NewNameAndCopyTest) { file_util::CopyFile(exe_full_path, file_name_to); ASSERT_TRUE(file_util::PathExists(file_name_to)); - LOG(INFO) << "copy ourself from " - << exe_full_path.value() << " to " << file_name_to.value(); + VLOG(1) << "copy ourself from " << exe_full_path.value() + << " to " << file_name_to.value(); // Run the executable in destination path STARTUPINFOW si = {sizeof(si)}; @@ -610,8 +610,8 @@ TEST_F(CopyTreeWorkItemTest, FLAKY_CopyFileInUseAndCleanup) { file_util::CopyFile(exe_full_path, file_name_to); ASSERT_TRUE(file_util::PathExists(file_name_to)); - LOG(INFO) << "copy ourself from " - << exe_full_path.value() << " to " << file_name_to.value(); + VLOG(1) << "copy ourself from " << exe_full_path.value() + << " to " << file_name_to.value(); // Run the executable in destination path STARTUPINFOW si = {sizeof(si)}; @@ -702,15 +702,15 @@ TEST_F(CopyTreeWorkItemTest, FLAKY_CopyTree) { file_name_to_1 = file_name_to_1.AppendASCII("1"); file_name_to_1 = file_name_to_1.AppendASCII("File_1.txt"); EXPECT_TRUE(file_util::PathExists(file_name_to_1)); - LOG(INFO) << "compare " - << file_name_from_1.value() << " and " << file_name_to_1.value(); + VLOG(1) << "compare " << file_name_from_1.value() + << " and " << file_name_to_1.value(); EXPECT_TRUE(file_util::ContentsEqual(file_name_from_1, file_name_to_1)); FilePath file_name_to_2(dir_name_to); file_name_to_2 = file_name_to_2.AppendASCII("2"); file_name_to_2 = file_name_to_2.AppendASCII("File_2.txt"); EXPECT_TRUE(file_util::PathExists(file_name_to_2)); - LOG(INFO) << "compare " - << file_name_from_2.value() << " and " << file_name_to_2.value(); + VLOG(1) << "compare " << file_name_from_2.value() + << " and " << file_name_to_2.value(); EXPECT_TRUE(file_util::ContentsEqual(file_name_from_2, file_name_to_2)); } diff --git a/chrome/installer/util/create_dir_work_item.cc b/chrome/installer/util/create_dir_work_item.cc index ad19b8e..a9a4bfb 100644 --- a/chrome/installer/util/create_dir_work_item.cc +++ b/chrome/installer/util/create_dir_work_item.cc @@ -30,15 +30,14 @@ void CreateDirWorkItem::GetTopDirToCreate() { } bool CreateDirWorkItem::Do() { - LOG(INFO) << "creating directory " << path_.value(); + VLOG(1) << "creating directory " << path_.value(); GetTopDirToCreate(); if (top_path_.empty()) return true; - LOG(INFO) << "top directory that needs to be created: " \ - << top_path_.value(); + VLOG(1) << "top directory that needs to be created: " << top_path_.value(); bool result = file_util::CreateDirectory(path_); - LOG(INFO) << "directory creation result: " << result; + VLOG(1) << "directory creation result: " << result; rollback_needed_ = true; diff --git a/chrome/installer/util/create_reg_key_work_item.cc b/chrome/installer/util/create_reg_key_work_item.cc index 6c4a2a0..4fa08c6 100644 --- a/chrome/installer/util/create_reg_key_work_item.cc +++ b/chrome/installer/util/create_reg_key_work_item.cc @@ -42,7 +42,7 @@ CreateRegKeyWorkItem::CreateRegKeyWorkItem(HKEY predefined_root, bool CreateRegKeyWorkItem::Do() { if (!InitKeyList()) { // Nothing needs to be done here. - LOG(INFO) << "no key to create"; + VLOG(1) << "no key to create"; return true; } @@ -63,11 +63,11 @@ bool CreateRegKeyWorkItem::Do() { LOG(ERROR) << key_path << " exists, this is not expected."; return false; } - LOG(INFO) << key_path << " exists"; + VLOG(1) << key_path << " exists"; // Remove the key path from list if it is already present. key_list_.pop_back(); } else if (disposition == REG_CREATED_NEW_KEY) { - LOG(INFO) << "created " << key_path; + VLOG(1) << "created " << key_path; key_created_ = true; } else { LOG(ERROR) << "unkown disposition"; @@ -93,9 +93,9 @@ void CreateRegKeyWorkItem::Rollback() { key_path.assign(*itr); if (SHDeleteEmptyKey(predefined_root_, key_path.c_str()) == ERROR_SUCCESS) { - LOG(INFO) << "rollback: delete " << key_path; + VLOG(1) << "rollback: delete " << key_path; } else { - LOG(INFO) << "rollback: can not delete " << key_path; + VLOG(1) << "rollback: can not delete " << key_path; // The key might have been deleted, but we don't reliably know what // error code(s) are returned in this case. So we just keep tring delete // the rest. diff --git a/chrome/installer/util/delete_after_reboot_helper.cc b/chrome/installer/util/delete_after_reboot_helper.cc index 345ba01a..e2449e7 100644 --- a/chrome/installer/util/delete_after_reboot_helper.cc +++ b/chrome/installer/util/delete_after_reboot_helper.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -33,23 +33,19 @@ bool IsSafeDirectoryNameForDeletion(const wchar_t* dir_name) { DCHECK(dir_name); // empty name isn't allowed - if (!(dir_name && *dir_name)) { + if (!(dir_name && *dir_name)) return false; - } // require a character other than \/:. after the last : // disallow anything with ".." bool ok = false; for (const wchar_t* s = dir_name; *s; ++s) { - if (*s != L'\\' && *s != L'/' && *s != L':' && *s != L'.') { + if (*s != L'\\' && *s != L'/' && *s != L':' && *s != L'.') ok = true; - } - if (*s == L'.' && s > dir_name && *(s - 1) == L'.') { + if (*s == L'.' && s > dir_name && *(s - 1) == L'.') return false; - } - if (*s == L':') { + if (*s == L':') ok = false; - } } return ok; } @@ -76,7 +72,7 @@ bool ScheduleFileSystemEntityForDeletion(const wchar_t* path) { return false; } - LOG(INFO) << "Scheduled for deletion: " << path; + VLOG(1) << "Scheduled for deletion: " << path; return true; } @@ -134,9 +130,8 @@ bool ScheduleDirectoryForDeletion(const wchar_t* dir_name) { } // Now schedule the empty directory itself - if (!ScheduleFileSystemEntityForDeletion(dir_name)) { + if (!ScheduleFileSystemEntityForDeletion(dir_name)) LOG(ERROR) << "Failed to schedule directory for deletion: " << dir_name; - } return true; } @@ -248,9 +243,8 @@ HRESULT GetPendingMovesValue( base::win::RegKey session_manager_key(HKEY_LOCAL_MACHINE, kSessionManagerKey, KEY_QUERY_VALUE); HKEY session_manager_handle = session_manager_key.Handle(); - if (!session_manager_handle) { + if (!session_manager_handle) return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); - } // The base::RegKey Read code squashes the return code from // ReqQueryValueEx, we have to do things ourselves: @@ -265,32 +259,32 @@ HRESULT GetPendingMovesValue( if (result == ERROR_FILE_NOT_FOUND) { // No pending moves were found. return HRESULT_FROM_WIN32(result); - } else if (result == ERROR_MORE_DATA) { - if (type != REG_MULTI_SZ) { - DLOG(ERROR) << "Found PendingRename value of unexpected type."; - return E_UNEXPECTED; - } - if (buffer_size % 2) { - // The buffer size should be an even number (since we expect wchar_ts). - // If this is not the case, fail here. - DLOG(ERROR) << "Corrupt PendingRename value."; - return E_UNEXPECTED; - } - - // There are pending file renames. Read them in. - buffer.resize(buffer_size); - result = RegQueryValueEx(session_manager_handle, kPendingFileRenameOps, - 0, &type, reinterpret_cast<LPBYTE>(&buffer[0]), - &buffer_size); - if (result != ERROR_SUCCESS) { - DLOG(ERROR) << "Failed to read from " << kPendingFileRenameOps; - return HRESULT_FROM_WIN32(result); - } - } else { + } + if (result != ERROR_MORE_DATA) { // That was unexpected. DLOG(ERROR) << "Unexpected result from RegQueryValueEx: " << result; return HRESULT_FROM_WIN32(result); } + if (type != REG_MULTI_SZ) { + DLOG(ERROR) << "Found PendingRename value of unexpected type."; + return E_UNEXPECTED; + } + if (buffer_size % 2) { + // The buffer size should be an even number (since we expect wchar_ts). + // If this is not the case, fail here. + DLOG(ERROR) << "Corrupt PendingRename value."; + return E_UNEXPECTED; + } + + // There are pending file renames. Read them in. + buffer.resize(buffer_size); + result = RegQueryValueEx(session_manager_handle, kPendingFileRenameOps, + 0, &type, reinterpret_cast<LPBYTE>(&buffer[0]), + &buffer_size); + if (result != ERROR_SUCCESS) { + DLOG(ERROR) << "Failed to read from " << kPendingFileRenameOps; + return HRESULT_FROM_WIN32(result); + } // We now have a buffer of bytes that is actually a sequence of // null-terminated wchar_t strings terminated by an additional null character. @@ -306,9 +300,8 @@ bool MatchPendingDeletePath(const std::wstring& short_form_needle, // First chomp the prefix since that will mess up GetShortPathName. std::wstring prefix(L"\\??\\"); - if (StartsWith(match_path, prefix, false)) { + if (StartsWith(match_path, prefix, false)) match_path = match_path.substr(4); - } // Get the short path name of the entry. std::wstring short_match_path(GetShortPathName(match_path.c_str())); @@ -327,7 +320,8 @@ bool RemoveFromMovesPendingReboot(const wchar_t* directory) { if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) { // No pending moves, nothing to do. return true; - } else if (FAILED(hr)) { + } + if (FAILED(hr)) { // Couldn't read the key or the key was corrupt. return false; } @@ -336,8 +330,8 @@ bool RemoveFromMovesPendingReboot(const wchar_t* directory) { std::wstring short_directory(GetShortPathName(directory)); std::vector<PendingMove> strings_to_keep; - std::vector<PendingMove>::const_iterator iter(pending_moves.begin()); - for (; iter != pending_moves.end(); iter++) { + for (std::vector<PendingMove>::const_iterator iter(pending_moves.begin()); + iter != pending_moves.end(); iter++) { if (!MatchPendingDeletePath(short_directory, iter->first)) { // This doesn't match the deletions we are looking for. Preserve // this string pair, making sure that it is in fact a pair. @@ -359,18 +353,15 @@ bool RemoveFromMovesPendingReboot(const wchar_t* directory) { return false; } - if (strings_to_keep.size() > 1) { - std::vector<char> buffer; - StringArrayToMultiSZBytes(strings_to_keep, &buffer); - DCHECK(buffer.size() > 0); - if (buffer.size() > 0) { - return session_manager_key.WriteValue(kPendingFileRenameOps, &buffer[0], - buffer.size(), REG_MULTI_SZ); - } else { - return false; - } - } else { + if (strings_to_keep.size() <= 1) { // We have only the trailing NULL string. Don't bother writing that. return session_manager_key.DeleteValue(kPendingFileRenameOps); } + std::vector<char> buffer; + StringArrayToMultiSZBytes(strings_to_keep, &buffer); + DCHECK(buffer.size() > 0); + if (buffer.empty()) + return false; + return session_manager_key.WriteValue(kPendingFileRenameOps, &buffer[0], + buffer.size(), REG_MULTI_SZ); } diff --git a/chrome/installer/util/delete_reg_value_work_item.cc b/chrome/installer/util/delete_reg_value_work_item.cc index 1c114e2..e663eef 100644 --- a/chrome/installer/util/delete_reg_value_work_item.cc +++ b/chrome/installer/util/delete_reg_value_work_item.cc @@ -57,11 +57,11 @@ bool DeleteRegValueWorkItem::Do() { } void DeleteRegValueWorkItem::Rollback() { - if (status_ == DELETE_VALUE || status_ == VALUE_ROLLED_BACK) { + if (status_ == DELETE_VALUE || status_ == VALUE_ROLLED_BACK) return; - } else if (status_ == VALUE_UNCHANGED || status_ == VALUE_NOT_FOUND) { + if (status_ == VALUE_UNCHANGED || status_ == VALUE_NOT_FOUND) { status_ = VALUE_ROLLED_BACK; - LOG(INFO) << "rollback: setting unchanged, nothing to do"; + VLOG(1) << "rollback: setting unchanged, nothing to do"; return; } @@ -75,7 +75,7 @@ void DeleteRegValueWorkItem::Rollback() { (!is_str_type_ && key.WriteValue(value_name_.c_str(), old_dw_))) { status_ = VALUE_ROLLED_BACK; - LOG(INFO) << "rollback: restored " << value_name_; + VLOG(1) << "rollback: restored " << value_name_; } else { LOG(ERROR) << "failed to restore value " << value_name_; } diff --git a/chrome/installer/util/delete_tree_work_item_unittest.cc b/chrome/installer/util/delete_tree_work_item_unittest.cc index 679fea6..832a8c0 100644 --- a/chrome/installer/util/delete_tree_work_item_unittest.cc +++ b/chrome/installer/util/delete_tree_work_item_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -189,8 +189,8 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTreeInUse) { file_util::CopyFile(exe_full_path, key_path); ASSERT_TRUE(file_util::PathExists(key_path)); - LOG(INFO) << "copy ourself from " - << exe_full_path.value() << " to " << key_path.value(); + VLOG(1) << "copy ourself from " << exe_full_path.value() + << " to " << key_path.value(); // Run the key path file to keep it in use. STARTUPINFOW si = {sizeof(si)}; diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index 90c684c..882ddb3 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc @@ -584,7 +584,7 @@ void GoogleChromeDistribution::LaunchUserExperiment( std::wstring brand; if (GoogleUpdateSettings::GetBrand(&brand) && (brand == L"CHXX")) { // Testing only: the user automatically qualifies for the experiment. - LOG(INFO) << "Experiment qualification bypass"; + VLOG(1) << "Experiment qualification bypass"; } else { // Check browser usage inactivity by the age of the last-write time of the // chrome user data directory. @@ -600,19 +600,19 @@ void GoogleChromeDistribution::LaunchUserExperiment( return; } else if (dir_age_hours < kThirtyDays) { // An active user, so it does not qualify. - LOG(INFO) << "Chrome used in last " << dir_age_hours << " hours"; + VLOG(1) << "Chrome used in last " << dir_age_hours << " hours"; SetClient(GetExperimentGroup(kToastActiveGroup, flavor), true); return; } // 1% are in the control group that qualifies but does not get drafted. if (base::RandDouble() > 0.99) { SetClient(GetExperimentGroup(kToastExpControlGroup, flavor), true); - LOG(INFO) << "User is control group"; + VLOG(1) << "User is control group"; return; } } - LOG(INFO) << "User drafted for toast experiment " << flavor; + VLOG(1) << "User drafted for toast experiment " << flavor; SetClient(GetExperimentGroup(kToastExpBaseGroup, flavor), false); // User level: The experiment needs to be performed in a different process // because google_update expects the upgrade process to be quick and nimble. diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc index 747fbb1..5bc3541 100644 --- a/chrome/installer/util/google_update_settings.cc +++ b/chrome/installer/util/google_update_settings.cc @@ -195,9 +195,9 @@ void GoogleUpdateSettings::UpdateDiffInstallStatus(bool system_install, reg_key.append(product_guid); if (!key.Open(reg_root, reg_key.c_str(), KEY_ALL_ACCESS) || !key.ReadValue(google_update::kRegApField, &ap_key_value)) { - LOG(INFO) << "Application key not found."; + VLOG(1) << "Application key not found."; if (!incremental_install || !install_return_code) { - LOG(INFO) << "Returning without changing application key."; + VLOG(1) << "Returning without changing application key."; key.Close(); return; } else if (!key.Valid()) { @@ -229,17 +229,17 @@ std::wstring GoogleUpdateSettings::GetNewGoogleUpdateApKey( bool has_magic_string = false; if ((value.length() >= kMagicSuffix.length()) && (value.rfind(kMagicSuffix) == (value.length() - kMagicSuffix.length()))) { - LOG(INFO) << "Incremental installer failure key already set."; + VLOG(1) << "Incremental installer failure key already set."; has_magic_string = true; } std::wstring new_value(value); if ((!diff_install || !install_return_code) && has_magic_string) { - LOG(INFO) << "Removing failure key from value " << value; + VLOG(1) << "Removing failure key from value " << value; new_value = value.substr(0, value.length() - kMagicSuffix.length()); } else if ((diff_install && install_return_code) && !has_magic_string) { - LOG(INFO) << "Incremental installer failed, setting failure key."; + VLOG(1) << "Incremental installer failed, setting failure key."; new_value.append(kMagicSuffix); } diff --git a/chrome/installer/util/helper.cc b/chrome/installer/util/helper.cc index 9c0dda9..551b9c6 100644 --- a/chrome/installer/util/helper.cc +++ b/chrome/installer/util/helper.cc @@ -105,7 +105,7 @@ void installer::RemoveOldVersionDirs(const std::wstring& chrome_path, // latest_version. while (ret) { if (find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { - LOG(INFO) << "directory found: " << find_file_data.cFileName; + VLOG(1) << "directory found: " << find_file_data.cFileName; version.reset( installer::Version::GetVersionFromString(find_file_data.cFileName)); if (version.get() && latest_version->IsHigherThan(version.get())) { @@ -113,7 +113,7 @@ void installer::RemoveOldVersionDirs(const std::wstring& chrome_path, file_util::AppendToPath(&remove_dir, find_file_data.cFileName); std::wstring chrome_dll_path(remove_dir); file_util::AppendToPath(&chrome_dll_path, installer_util::kChromeDll); - LOG(INFO) << "deleting directory " << remove_dir; + VLOG(1) << "deleting directory " << remove_dir; scoped_ptr<DeleteTreeWorkItem> item; item.reset(WorkItem::CreateDeleteTreeWorkItem(remove_dir, chrome_dll_path)); diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc index 601d0eb..5e7673b 100644 --- a/chrome/installer/util/install_util.cc +++ b/chrome/installer/util/install_util.cc @@ -71,12 +71,12 @@ installer::Version* InstallUtil::GetChromeVersion(bool system_install) { BrowserDistribution* dist = BrowserDistribution::GetDistribution(); if (!key.Open(reg_root, dist->GetVersionKey().c_str(), KEY_READ) || !key.ReadValue(google_update::kRegVersionField, &version_str)) { - LOG(INFO) << "No existing Chrome install found."; + VLOG(1) << "No existing Chrome install found."; key.Close(); return NULL; } key.Close(); - LOG(INFO) << "Existing Chrome version found " << version_str; + VLOG(1) << "Existing Chrome version found " << version_str; return installer::Version::GetVersionFromString(version_str); } @@ -86,13 +86,10 @@ bool InstallUtil::IsOSSupported() { base::win::GetServicePackLevel(&major, &minor); // We do not support Win2K or older, or XP without service pack 2. - LOG(INFO) << "Windows Version: " << version - << ", Service Pack: " << major << "." << minor; - if ((version > base::win::VERSION_XP) || - (version == base::win::VERSION_XP && major >= 2)) { - return true; - } - return false; + VLOG(1) << "Windows Version: " << version + << ", Service Pack: " << major << "." << minor; + return (version > base::win::VERSION_XP) || + (version == base::win::VERSION_XP && major >= 2); } void InstallUtil::WriteInstallerResult(bool system_install, @@ -260,7 +257,7 @@ bool InstallUtil::BuildDLLRegistrationList(const std::wstring& install_path, // otherwise false. bool InstallUtil::DeleteRegistryKey(RegKey& root_key, const std::wstring& key_path) { - LOG(INFO) << "Deleting registry key " << key_path; + VLOG(1) << "Deleting registry key " << key_path; if (!root_key.DeleteKey(key_path.c_str()) && ::GetLastError() != ERROR_MOD_NOT_FOUND) { LOG(ERROR) << "Failed to delete registry key: " << key_path; @@ -276,7 +273,7 @@ bool InstallUtil::DeleteRegistryValue(HKEY reg_root, const std::wstring& key_path, const std::wstring& value_name) { RegKey key(reg_root, key_path.c_str(), KEY_ALL_ACCESS); - LOG(INFO) << "Deleting registry value " << value_name; + VLOG(1) << "Deleting registry value " << value_name; if (key.ValueExists(value_name.c_str()) && !key.DeleteValue(value_name.c_str())) { LOG(ERROR) << "Failed to delete registry value: " << value_name; diff --git a/chrome/installer/util/lzma_util.cc b/chrome/installer/util/lzma_util.cc index 5e4ae29..8f36b5f 100644 --- a/chrome/installer/util/lzma_util.cc +++ b/chrome/installer/util/lzma_util.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -48,29 +48,23 @@ SZ_RESULT SzFileSeekImp(void *object, CFileSize pos) { value.HighPart = (LONG) ((UInt64) pos >> 32); value.LowPart = SetFilePointer(s->File, value.LowPart, &value.HighPart, FILE_BEGIN); - if (value.LowPart == 0xFFFFFFFF) { - if (GetLastError() != NO_ERROR) { - return SZE_FAIL; - } - } - return SZ_OK; + return ((value.LowPart == 0xFFFFFFFF) && (GetLastError() != NO_ERROR)) ? + SZE_FAIL : SZ_OK; } SZ_RESULT SzFileReadImp(void *object, void **buffer, size_t maxRequiredSize, size_t *processedSize) { const int kBufferSize = 1 << 12; static Byte g_Buffer[kBufferSize]; - if (maxRequiredSize > kBufferSize) { + if (maxRequiredSize > kBufferSize) maxRequiredSize = kBufferSize; - } CFileInStream *s = (CFileInStream *) object; size_t processedSizeLoc; processedSizeLoc = LzmaReadFile(s->File, g_Buffer, maxRequiredSize); *buffer = g_Buffer; - if (processedSize != 0) { + if (processedSize != 0) *processedSize = processedSizeLoc; - } return SZ_OK; } @@ -80,14 +74,14 @@ SZ_RESULT SzFileReadImp(void *object, void **buffer, int32 LzmaUtil::UnPackArchive(const std::wstring& archive, const std::wstring& output_dir, std::wstring* output_file) { - LOG(INFO) << "Opening archive " << archive; + VLOG(1) << "Opening archive " << archive; LzmaUtil lzma_util; DWORD ret; if ((ret = lzma_util.OpenArchive(archive)) != NO_ERROR) { LOG(ERROR) << "Unable to open install archive: " << archive << ", error: " << ret; } else { - LOG(INFO) << "Uncompressing archive to path " << output_dir; + VLOG(1) << "Uncompressing archive to path " << output_dir; if ((ret = lzma_util.UnPack(output_dir, output_file)) != NO_ERROR) { LOG(ERROR) << "Unable to uncompress archive: " << archive << ", error: " << ret; @@ -111,9 +105,8 @@ DWORD LzmaUtil::OpenArchive(const std::wstring& archivePath) { DWORD ret = NO_ERROR; archive_handle_ = CreateFile(archivePath.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (archive_handle_ == INVALID_HANDLE_VALUE) { + if (archive_handle_ == INVALID_HANDLE_VALUE) ret = GetLastError(); - } return ret; } diff --git a/chrome/installer/util/move_tree_work_item.cc b/chrome/installer/util/move_tree_work_item.cc index 02c25d5..95b3650 100644 --- a/chrome/installer/util/move_tree_work_item.cc +++ b/chrome/installer/util/move_tree_work_item.cc @@ -43,8 +43,8 @@ bool MoveTreeWorkItem::Do() { if (file_util::Move(dest_path_, backup_path_)) { moved_to_backup_ = true; - LOG(INFO) << "Moved destination " << dest_path_.value() - << " to backup path " << backup_path_.value(); + VLOG(1) << "Moved destination " << dest_path_.value() + << " to backup path " << backup_path_.value(); } else { LOG(ERROR) << "failed moving " << dest_path_.value() << " to " << backup_path_.value(); @@ -55,11 +55,11 @@ bool MoveTreeWorkItem::Do() { // Now move source to destination. if (file_util::Move(source_path_, dest_path_)) { moved_to_dest_path_ = true; - LOG(INFO) << "Moved source " << source_path_.value() - << " to destination " << dest_path_.value(); + VLOG(1) << "Moved source " << source_path_.value() + << " to destination " << dest_path_.value(); } else { - LOG(ERROR) << "failed move " << source_path_.value() << " to " << - dest_path_.value(); + LOG(ERROR) << "failed move " << source_path_.value() + << " to " << dest_path_.value(); return false; } @@ -68,10 +68,10 @@ bool MoveTreeWorkItem::Do() { void MoveTreeWorkItem::Rollback() { if (moved_to_dest_path_ && !file_util::Move(dest_path_, source_path_)) - LOG(ERROR) << "Can not move " << dest_path_.value() << - " to " << source_path_.value(); + LOG(ERROR) << "Can not move " << dest_path_.value() + << " to " << source_path_.value(); if (moved_to_backup_ && !file_util::Move(backup_path_, dest_path_)) - LOG(ERROR) << "failed move " << backup_path_.value() << - " to " << dest_path_.value(); + LOG(ERROR) << "failed move " << backup_path_.value() + << " to " << dest_path_.value(); } diff --git a/chrome/installer/util/set_reg_value_work_item.cc b/chrome/installer/util/set_reg_value_work_item.cc index 0dae573..c808b86 100644 --- a/chrome/installer/util/set_reg_value_work_item.cc +++ b/chrome/installer/util/set_reg_value_work_item.cc @@ -76,7 +76,7 @@ bool SetRegValueWorkItem::Do() { success = key.WriteValue(value_name_.c_str(), value_data_dword_); } if (success) { - LOG(INFO) << "overwritten value for " << value_name_; + VLOG(1) << "overwritten value for " << value_name_; status_ = VALUE_OVERWRITTEN; result = true; } else { @@ -85,7 +85,7 @@ bool SetRegValueWorkItem::Do() { result = false; } } else { - LOG(INFO) << value_name_ << " exists. not changed "; + VLOG(1) << value_name_ << " exists. not changed "; status_ = VALUE_UNCHANGED; result = true; } @@ -97,7 +97,7 @@ bool SetRegValueWorkItem::Do() { success = key.WriteValue(value_name_.c_str(), value_data_dword_); } if (success) { - LOG(INFO) << "created value for " << value_name_; + VLOG(1) << "created value for " << value_name_; status_ = NEW_VALUE_CREATED; result = true; } else { @@ -117,7 +117,7 @@ void SetRegValueWorkItem::Rollback() { if (status_ == VALUE_UNCHANGED) { status_ = VALUE_ROLL_BACK; - LOG(INFO) << "rollback: setting unchanged, nothing to do"; + VLOG(1) << "rollback: setting unchanged, nothing to do"; return; } @@ -125,7 +125,7 @@ void SetRegValueWorkItem::Rollback() { if (!key.Open(predefined_root_, key_path_.c_str(), KEY_READ | KEY_SET_VALUE)) { status_ = VALUE_ROLL_BACK; - LOG(INFO) << "rollback: can not open " << key_path_; + VLOG(1) << "rollback: can not open " << key_path_; return; } @@ -133,7 +133,7 @@ void SetRegValueWorkItem::Rollback() { if (status_ == NEW_VALUE_CREATED) { if (key.DeleteValue(value_name_.c_str())) result_str.assign(L" succeeded"); - LOG(INFO) << "rollback: deleting " << value_name_ << result_str; + VLOG(1) << "rollback: deleting " << value_name_ << result_str; } else if (status_ == VALUE_OVERWRITTEN) { // try restore the previous value bool success = true; @@ -145,7 +145,7 @@ void SetRegValueWorkItem::Rollback() { } if (success) result_str.assign(L" succeeded"); - LOG(INFO) << "rollback: restoring " << value_name_ << result_str; + VLOG(1) << "rollback: restoring " << value_name_ << result_str; } else { // Not reached. } diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 212f04b..343f434 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -622,7 +622,7 @@ bool ShellUtil::MakeChromeDefault(int shell_change, // First use the new "recommended" way on Vista to make Chrome default // browser. if (base::win::GetVersion() >= base::win::VERSION_VISTA) { - LOG(INFO) << "Registering Chrome as default browser on Vista."; + VLOG(1) << "Registering Chrome as default browser on Vista."; IApplicationAssociationRegistration* pAAR; HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration, NULL, CLSCTX_INPROC, __uuidof(IApplicationAssociationRegistration), diff --git a/chrome/installer/util/work_item_list.cc b/chrome/installer/util/work_item_list.cc index 35b4590..012bb7e 100644 --- a/chrome/installer/util/work_item_list.cc +++ b/chrome/installer/util/work_item_list.cc @@ -38,7 +38,7 @@ bool WorkItemList::Do() { } if (result) - LOG(INFO) << "list execution succeeded"; + VLOG(1) << "list execution succeeded"; status_ = LIST_EXECUTED; return result; |