| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/feedback/feedback_data.h" | 5 #include "chrome/browser/feedback/feedback_data.h" |
| 6 | 6 |
| 7 #include "chrome/browser/feedback/feedback_util.h" | 7 #include "chrome/browser/feedback/feedback_util.h" |
| 8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 9 | 9 |
| 10 #if defined(OS_CHROMEOS) | 10 #if defined(OS_CHROMEOS) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 void FeedbackData::UpdateData(Profile* profile, | 29 void FeedbackData::UpdateData(Profile* profile, |
| 30 const std::string& target_tab_url, | 30 const std::string& target_tab_url, |
| 31 const std::string& category_tag, | 31 const std::string& category_tag, |
| 32 const std::string& page_url, | 32 const std::string& page_url, |
| 33 const std::string& description, | 33 const std::string& description, |
| 34 ScreenshotDataPtr image | 34 ScreenshotDataPtr image |
| 35 #if defined(OS_CHROMEOS) | 35 #if defined(OS_CHROMEOS) |
| 36 , const std::string& user_email | 36 , const std::string& user_email |
| 37 , const bool send_sys_info | 37 , const bool send_sys_info |
| 38 , const bool sent_report | 38 , const bool sent_report |
| 39 , const std::string& timestamp |
| 39 #endif | 40 #endif |
| 40 ) { | 41 ) { |
| 41 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 42 profile_ = profile; | 43 profile_ = profile; |
| 43 target_tab_url_ = target_tab_url; | 44 target_tab_url_ = target_tab_url; |
| 44 category_tag_ = category_tag; | 45 category_tag_ = category_tag; |
| 45 page_url_ = page_url; | 46 page_url_ = page_url; |
| 46 description_ = description; | 47 description_ = description; |
| 47 image_ = image; | 48 image_ = image; |
| 48 #if defined(OS_CHROMEOS) | 49 #if defined(OS_CHROMEOS) |
| 49 user_email_ = user_email; | 50 user_email_ = user_email; |
| 50 send_sys_info_ = send_sys_info; | 51 send_sys_info_ = send_sys_info; |
| 51 sent_report_ = sent_report; | 52 sent_report_ = sent_report; |
| 53 timestamp_ = timestamp; |
| 52 #endif | 54 #endif |
| 53 } | 55 } |
| 54 | 56 |
| 55 void FeedbackData::SendReport() { | 57 void FeedbackData::SendReport() { |
| 56 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 58 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 57 #if defined(OS_CHROMEOS) | 59 #if defined(OS_CHROMEOS) |
| 58 if (sent_report_) | 60 if (sent_report_) |
| 59 return; // We already received the syslogs and sent the report. | 61 return; // We already received the syslogs and sent the report. |
| 60 | 62 |
| 61 // Set send_report_ to ensure that we only send one report. | 63 // Set send_report_ to ensure that we only send one report. |
| 62 sent_report_ = true; | 64 sent_report_ = true; |
| 63 #endif | 65 #endif |
| 64 | 66 |
| 65 gfx::Rect& screen_size = FeedbackUtil::GetScreenshotSize(); | 67 gfx::Rect& screen_size = FeedbackUtil::GetScreenshotSize(); |
| 66 FeedbackUtil::SendReport(profile_ | 68 FeedbackUtil::SendReport(profile_ |
| 67 , category_tag_ | 69 , category_tag_ |
| 68 , page_url_ | 70 , page_url_ |
| 69 , description_ | 71 , description_ |
| 70 , image_ | 72 , image_ |
| 71 , screen_size.width() | 73 , screen_size.width() |
| 72 , screen_size.height() | 74 , screen_size.height() |
| 73 #if defined(OS_CHROMEOS) | 75 #if defined(OS_CHROMEOS) |
| 74 , user_email_ | 76 , user_email_ |
| 75 , zip_content_ ? zip_content_->c_str() : NULL | 77 , zip_content_ ? zip_content_->c_str() : NULL |
| 76 , zip_content_ ? zip_content_->length() : 0 | 78 , zip_content_ ? zip_content_->length() : 0 |
| 77 , send_sys_info_ ? sys_info_ : NULL | 79 , send_sys_info_ ? sys_info_ : NULL |
| 80 , timestamp_ |
| 78 #endif | 81 #endif |
| 79 ); | 82 ); |
| 80 | 83 |
| 81 #if defined(OS_CHROMEOS) | 84 #if defined(OS_CHROMEOS) |
| 82 if (sys_info_) { | 85 if (sys_info_) { |
| 83 delete sys_info_; | 86 delete sys_info_; |
| 84 sys_info_ = NULL; | 87 sys_info_ = NULL; |
| 85 } | 88 } |
| 86 if (zip_content_) { | 89 if (zip_content_) { |
| 87 delete zip_content_; | 90 delete zip_content_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 109 } else { | 112 } else { |
| 110 zip_content_ = zip_content; | 113 zip_content_ = zip_content; |
| 111 sys_info_ = logs; // Will get deleted when SendReport() is called. | 114 sys_info_ = logs; // Will get deleted when SendReport() is called. |
| 112 if (send_sys_info_) { | 115 if (send_sys_info_) { |
| 113 // We already prepared the report, send it now. | 116 // We already prepared the report, send it now. |
| 114 this->SendReport(); | 117 this->SendReport(); |
| 115 } | 118 } |
| 116 } | 119 } |
| 117 } | 120 } |
| 118 #endif | 121 #endif |
| OLD | NEW |