From e251662cc98ddde6f01483e8f6195ac94a98e494 Mon Sep 17 00:00:00 2001 From: "zelidrag@chromium.org" Date: Thu, 20 May 2010 05:55:06 +0000 Subject: Submitting http://codereview.chromium.org/2081006/show on behalf of rkc@chromium.org: Changes for sending user e-mail along with the feedback Changes to implement complete userfeedback stack. TBR=zelidrag@chromium.org TEST=none BUG=chromium-os:2761 Review URL: http://codereview.chromium.org/2090011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47777 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/bug_report_util.cc | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'chrome/browser/bug_report_util.cc') diff --git a/chrome/browser/bug_report_util.cc b/chrome/browser/bug_report_util.cc index 37aa8f8..919167b 100644 --- a/chrome/browser/bug_report_util.cc +++ b/chrome/browser/bug_report_util.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,6 +15,7 @@ #include "chrome/common/net/url_fetcher.h" #include "googleurl/src/gurl.h" #include "grit/locale_settings.h" +#include "net/url_request/url_request_status.h" #include "unicode/locid.h" #include @@ -28,7 +29,7 @@ const char kReportPhishingUrl[] = // URL to post bug reports to. const char* const kBugReportPostUrl = - "http://feedback2-dev.corp.google.com/tools/feedback/chrome/__submit"; + "https://feedback2-test.corp.google.com/tools/feedback/chrome/__submit"; const char* const kProtBufMimeType = "application/x-protobuf"; const char* const kPngMimeType = "image/png"; @@ -68,6 +69,10 @@ void BugReportUtil::PostCleanup::OnURLFetchComplete( int response_code, const ResponseCookies& cookies, const std::string& data) { + // if not 204, something went wrong + if (response_code != 204) + LOG(WARNING) << "Submission to feedback server failed. Response code: " << + response_code << std::endl; // Delete the URLFetcher. delete source; // And then delete ourselves. @@ -118,11 +123,17 @@ void BugReportUtil::SendReport(Profile* profile, const std::string& page_title_text, int problem_type, const std::string& page_url_text, + const std::string& user_email_text, const std::string& description, const char* png_data, int png_data_length, int png_width, +#if defined(OS_CHROMEOS) + int png_height, + const chromeos::LogDictionaryType* const sys_info) { +#else int png_height) { +#endif GURL post_url(kBugReportPostUrl); // Create google feedback protocol buffer objects @@ -133,7 +144,10 @@ void BugReportUtil::SendReport(Profile* profile, userfeedback::CommonData* common_data = feedback_data.mutable_common_data(); userfeedback::WebData* web_data = feedback_data.mutable_web_data(); - // set GAIA id to 0 to indicate no username available + // Set GAIA id to 0. We're not using gaia id's for recording + // use feedback - we're using the e-mail field, allows users to + // submit feedback from incognito mode and specify any mail id + // they wish common_data->set_gaia_id(0); // Add the page title. @@ -143,6 +157,9 @@ void BugReportUtil::SendReport(Profile* profile, AddFeedbackData(&feedback_data, std::string(kProblemTypeTag), StringPrintf("%d\r\n", problem_type)); + // Add the user e-mail to the feedback object + common_data->set_user_email(user_email_text); + // Add the description to the feedback object common_data->set_description(description); @@ -172,12 +189,16 @@ void BugReportUtil::SendReport(Profile* profile, SetOSVersion(&os_version); AddFeedbackData(&feedback_data, std::string(kOsVersionTag), os_version); +#if defined(OS_CHROMEOS) + for (chromeos::LogDictionaryType::const_iterator i = sys_info->begin(); + i != sys_info->end(); ++i) + AddFeedbackData(&feedback_data, i->first, i->second); +#endif // Include the page image if we have one. if (png_data) { userfeedback::PostedScreenshot screenshot; screenshot.set_mime_type(kPngMimeType); - // Set the dimensions of the screenshot userfeedback::Dimensions dimensions; dimensions.set_width(static_cast(png_width)); @@ -189,10 +210,6 @@ void BugReportUtil::SendReport(Profile* profile, *(feedback_data.mutable_screenshot()) = screenshot; } - // TODO(awalker): include the page source if we can get it. - // if (include_page_source_checkbox_->checked()) { - // } - // We have the body of our POST, so send it off to the server. URLFetcher* fetcher = new URLFetcher(post_url, URLFetcher::POST, new BugReportUtil::PostCleanup); -- cgit v1.1