summaryrefslogtreecommitdiffstats
path: root/chrome/browser/feedback/feedback_data.cc
diff options
context:
space:
mode:
authorrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-06 07:12:48 +0000
committerrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-06 07:12:48 +0000
commiteead82943f187117b73d9d3fd8169b31f184a527 (patch)
tree9aff0e893203a0cd1b16af9c43a6f3ccdf93b5be /chrome/browser/feedback/feedback_data.cc
parenta69d7afa15c08f361189aee67d7783db2f43a10f (diff)
downloadchromium_src-eead82943f187117b73d9d3fd8169b31f184a527.zip
chromium_src-eead82943f187117b73d9d3fd8169b31f184a527.tar.gz
chromium_src-eead82943f187117b73d9d3fd8169b31f184a527.tar.bz2
Allow extensions to attach a file when invoking the feedback page.
This is specifically for the QuickOffice extension at the moment but any extension can use this functionality. By providing a "filePath" query parameter pointing to a local path on ChromeOS, an extension can provide an option to attach a file with the feedback report. By default this option is unchecked. If a bogus path is given, when sending the report, we simply send no attachment. R=jhawkins@chromium.org BUG=169982 Review URL: https://chromiumcodereview.appspot.com/12221002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180921 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/feedback/feedback_data.cc')
-rw-r--r--chrome/browser/feedback/feedback_data.cc76
1 files changed, 42 insertions, 34 deletions
diff --git a/chrome/browser/feedback/feedback_data.cc b/chrome/browser/feedback/feedback_data.cc
index 6ae5eb2..c2d3207 100644
--- a/chrome/browser/feedback/feedback_data.cc
+++ b/chrome/browser/feedback/feedback_data.cc
@@ -111,10 +111,45 @@ FeedbackData::FeedbackData()
{
}
-FeedbackData::~FeedbackData() {}
+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
+#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
+#endif
+ ) {
+ UpdateData(profile,
+ category_tag,
+ page_url,
+ description,
+ user_email,
+ image
+#if defined(OS_CHROMEOS)
+ , sys_info
+ , true
+ , timestamp
+ , attached_filename
+ , attached_filedata
+#endif
+ );
+#if defined(OS_CHROMEOS)
+ sys_info_ = sys_info;
+ zip_content_ = zip_content;
+#endif
+}
+
+
+FeedbackData::~FeedbackData() {
+}
void FeedbackData::UpdateData(Profile* profile,
- const std::string& target_tab_url,
const std::string& category_tag,
const std::string& page_url,
const std::string& description,
@@ -125,12 +160,11 @@ void FeedbackData::UpdateData(Profile* profile,
, const bool sent_report
, const std::string& timestamp
, const std::string& attached_filename
- , const std::string& attached_filedata
+ , std::string* attached_filedata
#endif
) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
profile_ = profile;
- target_tab_url_ = target_tab_url;
category_tag_ = category_tag;
page_url_ = page_url;
description_ = description;
@@ -155,37 +189,11 @@ void FeedbackData::SendReport() {
sent_report_ = true;
#endif
- gfx::Rect& screen_size = FeedbackUtil::GetScreenshotSize();
- FeedbackUtil::SendReport(profile_
- , category_tag_
- , page_url_
- , description_
- , user_email_
- , image_
- , screen_size.width()
- , screen_size.height()
-#if defined(OS_CHROMEOS)
- , zip_content_ ? zip_content_->c_str() : NULL
- , zip_content_ ? zip_content_->length() : 0
- , send_sys_info_ ? sys_info_ : NULL
- , timestamp_
- , attached_filename_
- , attached_filedata_
-#endif
- );
-
-#if defined(OS_CHROMEOS)
- if (sys_info_) {
- delete sys_info_;
- sys_info_ = NULL;
- }
- if (zip_content_) {
- delete zip_content_;
- zip_content_ = NULL;
- }
-#endif
+ FeedbackUtil::SendReport(*this);
- // Delete this object once the report has been sent.
+ // Either the report is sent, and and this object may delete itself, or the
+ // report is pending the attached file read, and another FeedbackData has
+ // been created to hold this data - hence delete this object.
delete this;
}