Disable a NTP-test on OSX 10.7 and OSX 10.8.
[chromium-blink-merge.git] / components / feedback / feedback_data.h
blob54749abb9f1476956a371f9588cd189840a484d7
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_
8 #include <string>
10 #include "base/callback.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "components/feedback/feedback_common.h"
13 #include "url/gurl.h"
15 namespace base {
16 class FilePath;
17 class RefCountedString;
19 namespace content {
20 class BrowserContext;
23 namespace feedback {
25 class FeedbackData : public FeedbackCommon {
26 public:
27 FeedbackData();
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
33 // compression.
34 void SetAndCompressSystemInfo(scoped_ptr<SystemLogsMap> sys_info);
36 // Sets the histograms for this instance and kicks off its
37 // compression.
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.
55 void SendReport();
57 // Getters
58 content::BrowserContext* context() const { return context_; }
59 const std::string& attached_file_uuid() const { return attached_file_uuid_; }
60 const std::string& screenshot_uuid() const { return screenshot_uuid_; }
62 // Setters
63 void set_context(content::BrowserContext* context) { context_ = context; }
64 void set_attached_filename(const std::string& attached_filename) {
65 attached_filename_ = attached_filename;
67 void set_attached_file_uuid(const std::string& uuid) {
68 attached_file_uuid_ = uuid;
70 void set_screenshot_uuid(const std::string& uuid) {
71 screenshot_uuid_ = uuid;
73 void set_trace_id(int trace_id) { trace_id_ = trace_id; }
74 void set_send_report_callback(
75 const base::Callback<void(scoped_refptr<FeedbackData>)>& send_report) {
76 send_report_ = send_report;
79 private:
80 ~FeedbackData() override;
82 // Called once a compression operation is complete.
83 void OnCompressComplete();
85 void OnGetTraceData(int trace_id,
86 scoped_refptr<base::RefCountedString> trace_data);
88 base::Callback<void(scoped_refptr<FeedbackData>)> send_report_;
90 content::BrowserContext* context_;
92 std::string attached_filename_;
93 std::string attached_file_uuid_;
94 std::string screenshot_uuid_;
96 int trace_id_;
98 int pending_op_count_;
99 bool report_sent_;
101 DISALLOW_COPY_AND_ASSIGN(FeedbackData);
104 } // namespace feedback
106 #endif // COMPONENTS_FEEDBACK_FEEDBACK_DATA_H_