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 #ifndef COMPONENTS_FEEDBACK_FEEDBACK_REPORT_H_ | 5 #ifndef COMPONENTS_FEEDBACK_FEEDBACK_REPORT_H_ |
6 #define COMPONENTS_FEEDBACK_FEEDBACK_REPORT_H_ | 6 #define COMPONENTS_FEEDBACK_FEEDBACK_REPORT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 // This class holds a feedback report. Once a report is created, a disk backup | 24 // This class holds a feedback report. Once a report is created, a disk backup |
25 // for it is created automatically. This backup needs to explicitly be | 25 // for it is created automatically. This backup needs to explicitly be |
26 // deleted by calling DeleteReportOnDisk. | 26 // deleted by calling DeleteReportOnDisk. |
27 class FeedbackReport : public base::RefCounted<FeedbackReport> { | 27 class FeedbackReport : public base::RefCounted<FeedbackReport> { |
28 public: | 28 public: |
29 FeedbackReport(const base::FilePath& path, | 29 FeedbackReport(const base::FilePath& path, |
30 const base::Time& upload_at, | 30 const base::Time& upload_at, |
31 const std::string& data, | 31 const std::string& data, |
32 scoped_refptr<base::SequencedTaskRunner> task_runner); | 32 scoped_refptr<base::SequencedTaskRunner> task_runner); |
33 | 33 |
| 34 // The ID of the product specific data for the crash report IDs as stored by |
| 35 // the feedback server. |
| 36 static const char kCrashReportIdsKey[]; |
| 37 |
| 38 // Loads the reports still on disk and queues then using the given callback. |
| 39 // This call blocks on the file reads. |
| 40 static void LoadReportsAndQueue(const base::FilePath& user_dir, |
| 41 QueueCallback callback); |
| 42 |
34 // Stops the disk write of the report and deletes the report file if already | 43 // Stops the disk write of the report and deletes the report file if already |
35 // written. | 44 // written. |
36 void DeleteReportOnDisk(); | 45 void DeleteReportOnDisk(); |
37 | 46 |
38 const base::Time& upload_at() const { return upload_at_; } | 47 const base::Time& upload_at() const { return upload_at_; } |
39 const std::string& data() const { return data_; } | 48 const std::string& data() const { return data_; } |
40 | 49 |
41 // Loads the reports still on disk and queues then using the given callback. | |
42 // This call blocks on the file reads. | |
43 static void LoadReportsAndQueue(const base::FilePath& user_dir, | |
44 QueueCallback callback); | |
45 | |
46 private: | 50 private: |
47 friend class base::RefCounted<FeedbackReport>; | 51 friend class base::RefCounted<FeedbackReport>; |
48 virtual ~FeedbackReport(); | 52 virtual ~FeedbackReport(); |
49 | 53 |
50 // Name of the file corresponding to this report. | 54 // Name of the file corresponding to this report. |
51 base::FilePath file_; | 55 base::FilePath file_; |
52 | 56 |
53 base::FilePath reports_path_; | 57 base::FilePath reports_path_; |
54 base::Time upload_at_; // Upload this report at or after this time. | 58 base::Time upload_at_; // Upload this report at or after this time. |
55 std::string data_; | 59 std::string data_; |
56 | 60 |
57 scoped_refptr<base::SequencedTaskRunner> reports_task_runner_; | 61 scoped_refptr<base::SequencedTaskRunner> reports_task_runner_; |
58 | 62 |
59 DISALLOW_COPY_AND_ASSIGN(FeedbackReport); | 63 DISALLOW_COPY_AND_ASSIGN(FeedbackReport); |
60 }; | 64 }; |
61 | 65 |
62 } // namespace feedback | 66 } // namespace feedback |
63 | 67 |
64 #endif // COMPONENTS_FEEDBACK_FEEDBACK_REPORT_H_ | 68 #endif // COMPONENTS_FEEDBACK_FEEDBACK_REPORT_H_ |
OLD | NEW |