Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Side by Side Diff: chrome/browser/bug_report_util.cc

Issue 7635017: Fix saved screenshots for feedback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mac fix 4 Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/bug_report_util.h ('k') | chrome/browser/ui/cocoa/browser_window_cocoa.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/bug_report_util.h" 5 #include "chrome/browser/bug_report_util.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 return true; 246 return true;
247 } 247 }
248 #endif 248 #endif
249 249
250 // static 250 // static
251 void BugReportUtil::SendReport( 251 void BugReportUtil::SendReport(
252 Profile* profile 252 Profile* profile
253 , int problem_type 253 , int problem_type
254 , const std::string& page_url_text 254 , const std::string& page_url_text
255 , const std::string& description 255 , const std::string& description
256 , const char* png_data 256 , ScreenshotDataPtr image_data_ptr
257 , int png_data_length
258 , int png_width 257 , int png_width
259 , int png_height 258 , int png_height
260 #if defined(OS_CHROMEOS) 259 #if defined(OS_CHROMEOS)
261 , const std::string& user_email_text 260 , const std::string& user_email_text
262 , const char* zipped_logs_data 261 , const char* zipped_logs_data
263 , int zipped_logs_length 262 , int zipped_logs_length
264 , const chromeos::system::LogDictionaryType* const sys_info 263 , const chromeos::system::LogDictionaryType* const sys_info
265 #endif 264 #endif
266 ) { 265 ) {
267 // Create google feedback protocol buffer objects 266 // Create google feedback protocol buffer objects
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 AddFeedbackData(&feedback_data, std::string(kChromeVersionTag), 301 AddFeedbackData(&feedback_data, std::string(kChromeVersionTag),
303 chrome_version); 302 chrome_version);
304 } 303 }
305 304
306 // Add OS version (eg, for WinXP SP2: "5.1.2600 Service Pack 2"). 305 // Add OS version (eg, for WinXP SP2: "5.1.2600 Service Pack 2").
307 std::string os_version = ""; 306 std::string os_version = "";
308 SetOSVersion(&os_version); 307 SetOSVersion(&os_version);
309 AddFeedbackData(&feedback_data, std::string(kOsVersionTag), os_version); 308 AddFeedbackData(&feedback_data, std::string(kOsVersionTag), os_version);
310 309
311 // Include the page image if we have one. 310 // Include the page image if we have one.
312 if (png_data) { 311 if (image_data_ptr.get() && image_data_ptr->size()) {
313 userfeedback::PostedScreenshot screenshot; 312 userfeedback::PostedScreenshot screenshot;
314 screenshot.set_mime_type(kPngMimeType); 313 screenshot.set_mime_type(kPngMimeType);
315 // Set the dimensions of the screenshot 314 // Set the dimensions of the screenshot
316 userfeedback::Dimensions dimensions; 315 userfeedback::Dimensions dimensions;
317 dimensions.set_width(static_cast<float>(png_width)); 316 dimensions.set_width(static_cast<float>(png_width));
318 dimensions.set_height(static_cast<float>(png_height)); 317 dimensions.set_height(static_cast<float>(png_height));
319 *(screenshot.mutable_dimensions()) = dimensions; 318 *(screenshot.mutable_dimensions()) = dimensions;
320 screenshot.set_binary_content(std::string(png_data, png_data_length)); 319
320 int image_data_size = image_data_ptr->size();
321 char* image_data = reinterpret_cast<char*>(&(image_data_ptr->front()));
322 screenshot.set_binary_content(std::string(image_data, image_data_size));
321 323
322 // Set the screenshot object in feedback 324 // Set the screenshot object in feedback
323 *(feedback_data.mutable_screenshot()) = screenshot; 325 *(feedback_data.mutable_screenshot()) = screenshot;
324 } 326 }
325 327
326 #if defined(OS_CHROMEOS) 328 #if defined(OS_CHROMEOS)
327 if (sys_info) { 329 if (sys_info) {
328 // Add the product specific data 330 // Add the product specific data
329 for (chromeos::system::LogDictionaryType::const_iterator i = 331 for (chromeos::system::LogDictionaryType::const_iterator i =
330 sys_info->begin(); i != sys_info->end(); ++i) { 332 sys_info->begin(); i != sys_info->end(); ++i) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 if (screenshot_size == NULL) 410 if (screenshot_size == NULL)
409 screenshot_size = new gfx::Rect(); 411 screenshot_size = new gfx::Rect();
410 return *screenshot_size; 412 return *screenshot_size;
411 } 413 }
412 414
413 // static 415 // static
414 void BugReportUtil::SetScreenshotSize(const gfx::Rect& rect) { 416 void BugReportUtil::SetScreenshotSize(const gfx::Rect& rect) {
415 gfx::Rect& screen_size = GetScreenshotSize(); 417 gfx::Rect& screen_size = GetScreenshotSize();
416 screen_size = rect; 418 screen_size = rect;
417 } 419 }
OLDNEW
« no previous file with comments | « chrome/browser/bug_report_util.h ('k') | chrome/browser/ui/cocoa/browser_window_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698