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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_FEEDBACK_FEEDBACK_DATA_H_
6 #define COMPONENTS_FEEDBACK_FEEDBACK_DATA_H_
10 #include "base/callback.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "components/feedback/feedback_common.h"
17 class RefCountedString
;
25 class FeedbackData
: public FeedbackCommon
{
29 // Called once we've updated all the data from the feedback page.
30 void OnFeedbackPageDataComplete();
32 // Sets the system information for this instance and kicks off its
34 void SetAndCompressSystemInfo(scoped_ptr
<SystemLogsMap
> sys_info
);
36 // Sets the histograms for this instance and kicks off its
38 void SetAndCompressHistograms(scoped_ptr
<std::string
> histograms
);
40 // Sets the attached file data and kicks off its compression.
41 void AttachAndCompressFileData(scoped_ptr
<std::string
> attached_filedata
);
43 // Called once we have compressed our system logs.
44 void OnCompressLogsComplete(scoped_ptr
<std::string
> compressed_logs
);
46 // Called once we have compressed our attached file.
47 void OnCompressFileComplete(scoped_ptr
<std::string
> compressed_file
);
49 // Returns true if we've completed all the tasks needed before we can send
50 // feedback - at this time this is includes getting the feedback page data
51 // and compressing the system logs.
52 bool IsDataComplete();
54 // Sends the feedback report if we have all our data complete.
58 content::BrowserContext
* context() const { return context_
; }
59 const std::string
attached_filename() const { return attached_filename_
; }
60 const std::string
attached_file_uuid() const { return attached_file_uuid_
; }
61 const std::string
screenshot_uuid() const { return screenshot_uuid_
; }
62 int trace_id() const { return trace_id_
; }
65 void set_context(content::BrowserContext
* context
) { context_
= context
; }
66 void set_attached_filename(const std::string
& attached_filename
) {
67 attached_filename_
= attached_filename
;
69 void set_attached_file_uuid(const std::string
& uuid
) {
70 attached_file_uuid_
= uuid
;
72 void set_screenshot_uuid(const std::string
& uuid
) {
73 screenshot_uuid_
= uuid
;
75 void set_trace_id(int trace_id
) { trace_id_
= trace_id
; }
76 void set_send_report_callback(
77 const base::Callback
<void(scoped_refptr
<FeedbackData
>)>& send_report
) {
78 send_report_
= send_report
;
82 virtual ~FeedbackData();
84 // Called once a compression operation is complete.
85 void OnCompressComplete();
87 void OnGetTraceData(int trace_id
,
88 scoped_refptr
<base::RefCountedString
> trace_data
);
90 base::Callback
<void(scoped_refptr
<FeedbackData
>)> send_report_
;
92 content::BrowserContext
* context_
;
94 std::string attached_filename_
;
95 std::string attached_file_uuid_
;
96 std::string screenshot_uuid_
;
100 int pending_op_count_
;
103 DISALLOW_COPY_AND_ASSIGN(FeedbackData
);
106 } // namespace feedback
108 #endif // COMPONENTS_FEEDBACK_FEEDBACK_DATA_H_