| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/feedback/feedback_report.h" | 5 #include "components/feedback/feedback_report.h" |
| 6 | 6 |
| 7 #include "base/files/file.h" | 7 #include "base/files/file.h" |
| 8 #include "base/files/file_enumerator.h" | 8 #include "base/files/file_enumerator.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/files/important_file_writer.h" | 10 #include "base/files/important_file_writer.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 void WriteReportOnBlockingPool(const base::FilePath reports_path, | 23 void WriteReportOnBlockingPool(const base::FilePath reports_path, |
| 24 const base::FilePath& file, | 24 const base::FilePath& file, |
| 25 const std::string& data) { | 25 const std::string& data) { |
| 26 DCHECK(reports_path.IsParent(file)); | 26 DCHECK(reports_path.IsParent(file)); |
| 27 if (!base::DirectoryExists(reports_path)) { | 27 if (!base::DirectoryExists(reports_path)) { |
| 28 base::File::Error error; | 28 base::File::Error error; |
| 29 if (!base::CreateDirectoryAndGetError(reports_path, &error)) | 29 if (!base::CreateDirectoryAndGetError(reports_path, &error)) |
| 30 return; | 30 return; |
| 31 } | 31 } |
| 32 base::ImportantFileWriter::WriteFileAtomically(file, data); | 32 base::ImportantFileWriterImpl::WriteFileAtomically(file, data); |
| 33 } | 33 } |
| 34 | 34 |
| 35 } // namespace | 35 } // namespace |
| 36 | 36 |
| 37 namespace feedback { | 37 namespace feedback { |
| 38 | 38 |
| 39 FeedbackReport::FeedbackReport( | 39 FeedbackReport::FeedbackReport( |
| 40 const base::FilePath& path, | 40 const base::FilePath& path, |
| 41 const base::Time& upload_at, | 41 const base::Time& upload_at, |
| 42 const std::string& data, | 42 const std::string& data, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 !name.empty(); | 75 !name.empty(); |
| 76 name = enumerator.Next()) { | 76 name = enumerator.Next()) { |
| 77 std::string data; | 77 std::string data; |
| 78 if (ReadFileToString(name, &data)) | 78 if (ReadFileToString(name, &data)) |
| 79 callback.Run(data); | 79 callback.Run(data); |
| 80 base::DeleteFile(name, false); | 80 base::DeleteFile(name, false); |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 } // namespace feedback | 84 } // namespace feedback |
| OLD | NEW |