| Index: chrome/browser/feedback/feedback_data.h
|
| diff --git a/chrome/browser/feedback/feedback_data.h b/chrome/browser/feedback/feedback_data.h
|
| index ef54fffabe307206e9465502f17cb89712e8b89e..f80d68b619bfa2e61ee3baac8c6c068064d1a96c 100644
|
| --- a/chrome/browser/feedback/feedback_data.h
|
| +++ b/chrome/browser/feedback/feedback_data.h
|
| @@ -8,57 +8,48 @@
|
| #include <string>
|
| #include <vector>
|
|
|
| -#include "base/utf_string_conversions.h"
|
| +#include "base/memory/ref_counted.h"
|
| #include "chrome/browser/ui/webui/screenshot_source.h"
|
|
|
| #if defined(OS_CHROMEOS)
|
| -#include "chrome/browser/chromeos/system/syslogs_provider.h"
|
| +#include "chrome/browser/chromeos/system_logs/system_logs_fetcher.h"
|
| #endif
|
|
|
| class Profile;
|
|
|
| -class FeedbackData {
|
| +class FeedbackData : public base::RefCountedThreadSafe<FeedbackData> {
|
| public:
|
| FeedbackData();
|
| - FeedbackData(Profile* profile,
|
| - const std::string& category_tag,
|
| - const std::string& page_url,
|
| - const std::string& description,
|
| - const std::string& user_email,
|
| - ScreenshotDataPtr image
|
| +
|
| + // Called once we've update all the data from the feedback page.
|
| + void FeedbackPageDataComplete();
|
| +
|
| #if defined(OS_CHROMEOS)
|
| - , chromeos::system::LogDictionaryType* sys_info
|
| - , std::string* zip_content
|
| - , const std::string& timestamp
|
| - , const std::string& attached_filename
|
| - , std::string* attached_filedata
|
| + // Called once we have read our system logs.
|
| + void SyslogsComplete(scoped_ptr<chromeos::SystemLogsResponse> sys_info);
|
| +
|
| + // Called once we have read our attached file.
|
| + void ReadFileComplete();
|
| +
|
| + // Starts the collection of our system logs. SyslogsComplete is called once
|
| + // the collection is done.
|
| + void StartSyslogsCollection();
|
| #endif
|
| - );
|
|
|
| - ~FeedbackData();
|
| + // Returns true if we've complete collection of data from all our
|
| + // data sources. At this time this involves the system logs, the attached
|
| + // file (if needed to be read of the disk) and the rest of the data from
|
| + // the feedback page.
|
| + bool DataCollectionComplete();
|
|
|
| + // Sends the feedback report if we have all our data complete.
|
| void SendReport();
|
|
|
| - void UpdateData(Profile* profile,
|
| - const std::string& category_tag,
|
| - const std::string& page_url,
|
| - const std::string& description,
|
| - const std::string& user_email,
|
| - ScreenshotDataPtr image
|
| -#if defined(OS_CHROMEOS)
|
| - , const bool send_sys_info
|
| - , const bool sent_report
|
| - , const std::string& timestamp
|
| - , const std::string& attached_filename
|
| - , std::string* attached_filedata
|
| -#endif
|
| - );
|
| -
|
| -#if defined(OS_CHROMEOS)
|
| - void SyslogsComplete(chromeos::system::LogDictionaryType* logs,
|
| - std::string* zip_content);
|
| -#endif
|
| + // Starts reading the file to attach to this report into the string
|
| + // file_data. ReadFileComplete is called once this is done.
|
| + void StartReadFile(const std::string filename, const std::string* file_data);
|
|
|
| + // Getters
|
| Profile* profile() const { return profile_; }
|
| const std::string& category_tag() const { return category_tag_; }
|
| const std::string& page_url() const { return page_url_; }
|
| @@ -66,16 +57,49 @@ class FeedbackData {
|
| const std::string& user_email() const { return user_email_; }
|
| ScreenshotDataPtr image() const { return image_; }
|
| #if defined(OS_CHROMEOS)
|
| - chromeos::system::LogDictionaryType* sys_info() const {
|
| - return send_sys_info_ ? sys_info_ : NULL; }
|
| - std::string* zip_content() const { return zip_content_; }
|
| + chromeos::SystemLogsResponse* sys_info() const {
|
| + return send_sys_info_ ? sys_info_.get() : NULL;
|
| + }
|
| const std::string timestamp() const { return timestamp_; }
|
| const std::string attached_filename() const { return attached_filename_; }
|
| std::string* attached_filedata() const { return attached_filedata_; }
|
| #endif
|
|
|
| + // Setters
|
| + void set_profile(Profile* profile) { profile_ = profile; }
|
| + 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(ScreenshotDataPtr image) { image_ = image; }
|
| +#if defined(OS_CHROMEOS)
|
| + void set_send_sys_info(bool send_sys_info) { send_sys_info_ = send_sys_info; }
|
| + void set_timestamp(const std::string& timestamp) {
|
| + timestamp_ = timestamp;
|
| + }
|
| + void set_attached_filename(const std::string& attached_filename) {
|
| + attached_filename_ = attached_filename;
|
| + }
|
| + void set_attached_filedata(std::string* attached_filedata) {
|
| + attached_filedata_ = attached_filedata;
|
| + }
|
| +#endif
|
|
|
| private:
|
| + friend class base::RefCountedThreadSafe<FeedbackData>;
|
| +
|
| + virtual ~FeedbackData();
|
| +
|
| +#if defined(OS_CHROMEOS)
|
| + void ReadAttachedFile(const base::FilePath& from);
|
| +#endif
|
| +
|
| Profile* profile_;
|
|
|
| std::string category_tag_;
|
| @@ -88,23 +112,25 @@ class FeedbackData {
|
| // Chromeos specific values for SendReport. Will be deleted in
|
| // feedback_util::SendReport once consumed or in SyslogsComplete if
|
| // we don't send the logs with the report.
|
| - chromeos::system::LogDictionaryType* sys_info_;
|
| + scoped_ptr<chromeos::SystemLogsResponse> sys_info_;
|
|
|
| - // Content of the compressed system logs. Will be deleted in
|
| - // feedback_util::SendReport once consumed or in SyslogsComplete if
|
| - // we don't send the logs with the report.
|
| - std::string* zip_content_;
|
| std::string timestamp_;
|
| std::string attached_filename_;
|
| // Will be deleted in feedback_util::SendReport once consumed.
|
| std::string* attached_filedata_;
|
|
|
| - // NOTE: Extra boolean sent_report_ is required because callback may
|
| - // occur before or after we call SendReport().
|
| - bool sent_report_;
|
| - // Flag to indicate to SyslogsComplete that it should send the report
|
| + // Flag to indicate whether or not we should send the system information
|
| + // gathered with the report or not.
|
| bool send_sys_info_;
|
| +
|
| + // Flags to indicate if various pieces of data needed for the report have
|
| + // been collected yet or are still pending collection.
|
| + bool syslogs_collection_complete_;
|
| + bool read_attached_file_complete_;
|
| #endif
|
| + bool feedback_page_data_complete_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(FeedbackData);
|
| };
|
|
|
| #endif // CHROME_BROWSER_FEEDBACK_FEEDBACK_DATA_H_
|
|
|