Index: components/feedback/feedback_data.h |
diff --git a/components/feedback/feedback_data.h b/components/feedback/feedback_data.h |
index 68821d9d3d875eae9fe50025aa356627d2e92833..1b769c4967f0e62415da3263115963dc6a4a0898 100644 |
--- a/components/feedback/feedback_data.h |
+++ b/components/feedback/feedback_data.h |
@@ -5,12 +5,11 @@ |
#ifndef COMPONENTS_FEEDBACK_FEEDBACK_DATA_H_ |
#define COMPONENTS_FEEDBACK_FEEDBACK_DATA_H_ |
-#include <map> |
#include <string> |
-#include <vector> |
-#include "base/memory/ref_counted.h" |
+#include "base/callback.h" |
#include "base/memory/scoped_ptr.h" |
+#include "components/feedback/feedback_common.h" |
#include "url/gurl.h" |
namespace base { |
@@ -23,14 +22,8 @@ class BrowserContext; |
namespace feedback { |
-class FeedbackData : public base::RefCountedThreadSafe<FeedbackData> { |
+class FeedbackData : public FeedbackCommon { |
public: |
- typedef std::map<std::string, std::string> SystemLogsMap; |
- |
- // Determine if the given feedback value is small enough to not need to |
- // be compressed. |
- static bool BelowCompressionThreshold(const std::string& content); |
- |
FeedbackData(); |
// Called once we've updated all the data from the feedback page. |
@@ -50,10 +43,6 @@ class FeedbackData : public base::RefCountedThreadSafe<FeedbackData> { |
// Called once we have compressed our system logs. |
void OnCompressLogsComplete(scoped_ptr<std::string> compressed_logs); |
- // Called once we have compressed our histograms. |
- void OnCompressHistogramsComplete( |
- scoped_ptr<std::string> compressed_histograms); |
- |
// Called once we have compressed our attached file. |
void OnCompressFileComplete(scoped_ptr<std::string> compressed_file); |
@@ -67,38 +56,13 @@ class FeedbackData : public base::RefCountedThreadSafe<FeedbackData> { |
// Getters |
content::BrowserContext* context() const { return context_; } |
- const std::string& category_tag() const { return category_tag_; } |
- const std::string& page_url() const { return page_url_; } |
- const std::string& description() const { return description_; } |
- const std::string& user_email() const { return user_email_; } |
- std::string* image() const { return image_.get(); } |
const std::string attached_filename() const { return attached_filename_; } |
const std::string attached_file_uuid() const { return attached_file_uuid_; } |
- std::string* attached_filedata() const { return attached_filedata_.get(); } |
const std::string screenshot_uuid() const { return screenshot_uuid_; } |
int trace_id() const { return trace_id_; } |
- SystemLogsMap* sys_info() const { return sys_info_.get(); } |
- std::string* compressed_logs() const { return compressed_logs_.get(); } |
- std::string* histograms() const { return histograms_.get(); } |
- std::string* compressed_histograms() const { |
- return compressed_histograms_.get(); |
- } |
- std::string user_agent() const { return user_agent_; } |
- std::string locale() const { return locale_; } |
// Setters |
void set_context(content::BrowserContext* context) { context_ = context; } |
- void set_category_tag(const std::string& category_tag) { |
- category_tag_ = category_tag; |
- } |
- void set_page_url(const std::string& page_url) { page_url_ = page_url; } |
- void set_description(const std::string& description) { |
- description_ = description; |
- } |
- void set_user_email(const std::string& user_email) { |
- user_email_ = user_email; |
- } |
- void set_image(scoped_ptr<std::string> image) { image_ = image.Pass(); } |
void set_attached_filename(const std::string& attached_filename) { |
attached_filename_ = attached_filename; |
} |
@@ -109,47 +73,31 @@ class FeedbackData : public base::RefCountedThreadSafe<FeedbackData> { |
screenshot_uuid_ = uuid; |
} |
void set_trace_id(int trace_id) { trace_id_ = trace_id; } |
- void set_user_agent(const std::string& user_agent) { |
- user_agent_ = user_agent; |
+ void set_send_report_callback( |
+ const base::Callback<void(scoped_refptr<FeedbackData>)>& send_report) { |
+ send_report_ = send_report; |
} |
- void set_locale(const std::string& locale) { locale_ = locale; } |
private: |
- friend class base::RefCountedThreadSafe<FeedbackData>; |
- |
virtual ~FeedbackData(); |
+ // Called once a compression operation is complete. |
+ void OnCompressComplete(); |
+ |
void OnGetTraceData(int trace_id, |
scoped_refptr<base::RefCountedString> trace_data); |
+ base::Callback<void(scoped_refptr<FeedbackData>)> send_report_; |
+ |
content::BrowserContext* context_; |
- std::string category_tag_; |
- std::string page_url_; |
- std::string description_; |
- std::string user_email_; |
- scoped_ptr<std::string> image_; |
std::string attached_filename_; |
- scoped_ptr<std::string> attached_filedata_; |
- std::string user_agent_; |
- std::string locale_; |
- |
std::string attached_file_uuid_; |
std::string screenshot_uuid_; |
int trace_id_; |
- scoped_ptr<SystemLogsMap> sys_info_; |
- scoped_ptr<std::string> compressed_logs_; |
- |
- scoped_ptr<std::string> histograms_; |
- scoped_ptr<std::string> compressed_histograms_; |
- |
- // TODO(rkc): Refactor compressing logic into a simpler common implementation. |
- bool feedback_page_data_complete_; |
- bool syslogs_compression_complete_; |
- bool histograms_compression_complete_; |
- bool attached_file_compression_complete_; |
+ int pending_op_count_; |
bool report_sent_; |
DISALLOW_COPY_AND_ASSIGN(FeedbackData); |