OLD | NEW |
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_data.h" | 5 #include "chrome/browser/bug_report_data.h" |
6 | 6 |
7 #include "chrome/browser/bug_report_util.h" | 7 #include "chrome/browser/bug_report_util.h" |
8 #include "content/browser/browser_thread.h" | 8 #include "content/browser/browser_thread.h" |
9 | 9 |
10 #if defined(OS_CHROMEOS) | 10 #if defined(OS_CHROMEOS) |
(...skipping 12 matching lines...) Expand all Loading... |
23 { | 23 { |
24 } | 24 } |
25 | 25 |
26 BugReportData::~BugReportData() {} | 26 BugReportData::~BugReportData() {} |
27 | 27 |
28 void BugReportData::UpdateData(Profile* profile, | 28 void BugReportData::UpdateData(Profile* profile, |
29 const std::string& target_tab_url, | 29 const std::string& target_tab_url, |
30 const int problem_type, | 30 const int problem_type, |
31 const std::string& page_url, | 31 const std::string& page_url, |
32 const std::string& description, | 32 const std::string& description, |
33 const std::vector<unsigned char>& image | 33 ScreenshotDataPtr image |
34 #if defined(OS_CHROMEOS) | 34 #if defined(OS_CHROMEOS) |
35 , const std::string& user_email | 35 , const std::string& user_email |
36 , const bool send_sys_info | 36 , const bool send_sys_info |
37 , const bool sent_report | 37 , const bool sent_report |
38 #endif | 38 #endif |
39 ) { | 39 ) { |
40 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 40 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
41 profile_ = profile; | 41 profile_ = profile; |
42 target_tab_url_ = target_tab_url; | 42 target_tab_url_ = target_tab_url; |
43 problem_type_ = problem_type; | 43 problem_type_ = problem_type; |
(...skipping 10 matching lines...) Expand all Loading... |
54 void BugReportData::SendReport() { | 54 void BugReportData::SendReport() { |
55 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 55 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
56 #if defined(OS_CHROMEOS) | 56 #if defined(OS_CHROMEOS) |
57 if (sent_report_) | 57 if (sent_report_) |
58 return; // We already received the syslogs and sent the report. | 58 return; // We already received the syslogs and sent the report. |
59 | 59 |
60 // Set send_report_ to ensure that we only send one report. | 60 // Set send_report_ to ensure that we only send one report. |
61 sent_report_ = true; | 61 sent_report_ = true; |
62 #endif | 62 #endif |
63 | 63 |
64 int image_data_size = image_.size(); | |
65 char* image_data = image_data_size ? | |
66 reinterpret_cast<char*>(&(image_.front())) : NULL; | |
67 gfx::Rect& screen_size = BugReportUtil::GetScreenshotSize(); | 64 gfx::Rect& screen_size = BugReportUtil::GetScreenshotSize(); |
68 BugReportUtil::SendReport(profile_ | 65 BugReportUtil::SendReport(profile_ |
69 , problem_type_ | 66 , problem_type_ |
70 , page_url_ | 67 , page_url_ |
71 , description_ | 68 , description_ |
72 , image_data | 69 , image_ |
73 , image_data_size | |
74 , screen_size.width() | 70 , screen_size.width() |
75 , screen_size.height() | 71 , screen_size.height() |
76 #if defined(OS_CHROMEOS) | 72 #if defined(OS_CHROMEOS) |
77 , user_email_ | 73 , user_email_ |
78 , zip_content_ ? zip_content_->c_str() : NULL | 74 , zip_content_ ? zip_content_->c_str() : NULL |
79 , zip_content_ ? zip_content_->length() : 0 | 75 , zip_content_ ? zip_content_->length() : 0 |
80 , send_sys_info_ ? sys_info_ : NULL | 76 , send_sys_info_ ? sys_info_ : NULL |
81 #endif | 77 #endif |
82 ); | 78 ); |
83 | 79 |
(...skipping 28 matching lines...) Expand all Loading... |
112 } else { | 108 } else { |
113 zip_content_ = zip_content; | 109 zip_content_ = zip_content; |
114 sys_info_ = logs; // Will get deleted when SendReport() is called. | 110 sys_info_ = logs; // Will get deleted when SendReport() is called. |
115 if (send_sys_info_) { | 111 if (send_sys_info_) { |
116 // We already prepared the report, send it now. | 112 // We already prepared the report, send it now. |
117 this->SendReport(); | 113 this->SendReport(); |
118 } | 114 } |
119 } | 115 } |
120 } | 116 } |
121 #endif | 117 #endif |
OLD | NEW |