| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/installer/util/copy_tree_work_item.h" | 5 #include "chrome/installer/util/copy_tree_work_item.h" |
| 6 | 6 |
| 7 #include <shlwapi.h> | 7 #include <shlwapi.h> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "chrome/installer/util/logging_installer.h" | 11 #include "chrome/installer/util/logging_installer.h" |
| 12 | 12 |
| 13 CopyTreeWorkItem::~CopyTreeWorkItem() { | 13 CopyTreeWorkItem::~CopyTreeWorkItem() { |
| 14 if (file_util::PathExists(backup_path_)) { | 14 if (file_util::PathExists(backup_path_)) { |
| 15 file_util::Delete(backup_path_, true); | 15 file_util::Delete(backup_path_, true); |
| 16 } | 16 } |
| 17 } | 17 } |
| 18 | 18 |
| 19 CopyTreeWorkItem::CopyTreeWorkItem(const std::wstring& source_path, | 19 CopyTreeWorkItem::CopyTreeWorkItem(const FilePath& source_path, |
| 20 const std::wstring& dest_path, | 20 const FilePath& dest_path, |
| 21 const std::wstring& temp_dir, | 21 const FilePath& temp_dir, |
| 22 CopyOverWriteOption overwrite_option, | 22 CopyOverWriteOption overwrite_option, |
| 23 const std::wstring& alternative_path) | 23 const FilePath& alternative_path) |
| 24 : source_path_(source_path), | 24 : source_path_(source_path), |
| 25 dest_path_(dest_path), | 25 dest_path_(dest_path), |
| 26 temp_dir_(temp_dir), | 26 temp_dir_(temp_dir), |
| 27 overwrite_option_(overwrite_option), | 27 overwrite_option_(overwrite_option), |
| 28 alternative_path_(alternative_path), | 28 alternative_path_(alternative_path), |
| 29 copied_to_dest_path_(false), | 29 copied_to_dest_path_(false), |
| 30 moved_to_backup_(false), | 30 moved_to_backup_(false), |
| 31 copied_to_alternate_path_(false) { | 31 copied_to_alternate_path_(false) { |
| 32 } | 32 } |
| 33 | 33 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // Ideally we should not fail immediately. Instead we could try some | 141 // Ideally we should not fail immediately. Instead we could try some |
| 142 // random paths under temp_dir_ until we reach certain limit. | 142 // random paths under temp_dir_ until we reach certain limit. |
| 143 // For now our caller always provides a good temporary directory so | 143 // For now our caller always provides a good temporary directory so |
| 144 // we don't bother. | 144 // we don't bother. |
| 145 LOG(ERROR) << "backup path " << backup_path_.value() << " already exists"; | 145 LOG(ERROR) << "backup path " << backup_path_.value() << " already exists"; |
| 146 return false; | 146 return false; |
| 147 } | 147 } |
| 148 | 148 |
| 149 return true; | 149 return true; |
| 150 } | 150 } |
| OLD | NEW |