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::ImportantFileWriter::WriteFileAtomically(file, data, "FeedbackReport"); |
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 void FeedbackReport::DeleteReportOnDisk() { | 80 void FeedbackReport::DeleteReportOnDisk() { |
81 reports_task_runner_->PostTask( | 81 reports_task_runner_->PostTask( |
82 FROM_HERE, | 82 FROM_HERE, |
83 base::Bind(base::IgnoreResult(&base::DeleteFile), file_, false)); | 83 base::Bind(base::IgnoreResult(&base::DeleteFile), file_, false)); |
84 } | 84 } |
85 | 85 |
86 FeedbackReport::~FeedbackReport() {} | 86 FeedbackReport::~FeedbackReport() {} |
87 | 87 |
88 } // namespace feedback | 88 } // namespace feedback |
OLD | NEW |