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/dom_ui/bug_report_ui.h" | 5 #include "chrome/browser/dom_ui/bug_report_ui.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 void SetupScreenshotsSource(); | 220 void SetupScreenshotsSource(); |
221 void ClobberScreenshotsSource(); | 221 void ClobberScreenshotsSource(); |
222 | 222 |
223 void CancelFeedbackCollection(); | 223 void CancelFeedbackCollection(); |
224 void CloseFeedbackTab(); | 224 void CloseFeedbackTab(); |
225 | 225 |
226 TabContents* tab_; | 226 TabContents* tab_; |
227 DOMUIScreenshotSource* screenshot_source_; | 227 DOMUIScreenshotSource* screenshot_source_; |
228 | 228 |
229 BugReportData* bug_report_; | 229 BugReportData* bug_report_; |
230 string16 target_tab_title_; | |
231 std::string target_tab_url_; | 230 std::string target_tab_url_; |
232 #if defined(OS_CHROMEOS) | 231 #if defined(OS_CHROMEOS) |
233 // Variables to track SyslogsLibrary::RequestSyslogs callback. | 232 // Variables to track SyslogsLibrary::RequestSyslogs callback. |
234 chromeos::SyslogsLibrary::Handle syslogs_handle_; | 233 chromeos::SyslogsLibrary::Handle syslogs_handle_; |
235 CancelableRequestConsumer syslogs_consumer_; | 234 CancelableRequestConsumer syslogs_consumer_; |
236 #endif | 235 #endif |
237 | 236 |
238 DISALLOW_COPY_AND_ASSIGN(BugReportHandler); | 237 DISALLOW_COPY_AND_ASSIGN(BugReportHandler); |
239 }; | 238 }; |
240 | 239 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
399 // In case we already got the syslogs and sent the report, leave | 398 // In case we already got the syslogs and sent the report, leave |
400 if (sent_report_) return; | 399 if (sent_report_) return; |
401 // Set send_report_ so that no one else processes SendReport | 400 // Set send_report_ so that no one else processes SendReport |
402 sent_report_ = true; | 401 sent_report_ = true; |
403 #endif | 402 #endif |
404 | 403 |
405 int image_data_size = image_.size(); | 404 int image_data_size = image_.size(); |
406 char* image_data = image_data_size ? | 405 char* image_data = image_data_size ? |
407 reinterpret_cast<char*>(&(image_.front())) : NULL; | 406 reinterpret_cast<char*>(&(image_.front())) : NULL; |
408 BugReportUtil::SendReport(profile_ | 407 BugReportUtil::SendReport(profile_ |
409 , UTF16ToUTF8(target_tab_title_) | |
410 , problem_type_ | 408 , problem_type_ |
411 , page_url_ | 409 , page_url_ |
412 , description_ | 410 , description_ |
413 , image_data | 411 , image_data |
414 , image_data_size | 412 , image_data_size |
415 , browser::screen_size.width() | 413 , browser::screen_size.width() |
416 , browser::screen_size.height() | 414 , browser::screen_size.height() |
417 #if defined(OS_CHROMEOS) | 415 #if defined(OS_CHROMEOS) |
418 , user_email_ | 416 , user_email_ |
419 , zip_content_ ? zip_content_->c_str() : NULL | 417 , zip_content_ ? zip_content_->c_str() : NULL |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
521 // Sanity checks. | 519 // Sanity checks. |
522 if (((index == 0) && (params != "0")) || !browser || | 520 if (((index == 0) && (params != "0")) || !browser || |
523 index >= browser->tab_count()) { | 521 index >= browser->tab_count()) { |
524 return base::StringPiece( | 522 return base::StringPiece( |
525 ResourceBundle::GetSharedInstance().GetRawDataResource( | 523 ResourceBundle::GetSharedInstance().GetRawDataResource( |
526 IDR_BUGREPORT_HTML_INVALID)); | 524 IDR_BUGREPORT_HTML_INVALID)); |
527 } | 525 } |
528 | 526 |
529 TabContents* target_tab = browser->GetTabContentsAt(index); | 527 TabContents* target_tab = browser->GetTabContentsAt(index); |
530 if (target_tab) { | 528 if (target_tab) { |
531 target_tab_title_ = target_tab->GetTitle(); | 529 // TODO(rkc): Remove target tab title completely once we decide if we |
530 // decide if there never is a reason to send it at all. | |
oshima
2011/01/23 15:16:24
Is this comment still valid?
rkc
2011/01/25 00:00:03
Removed.
Done.
| |
532 target_tab_url_ = target_tab->GetURL().spec(); | 531 target_tab_url_ = target_tab->GetURL().spec(); |
533 } | 532 } |
534 | 533 |
535 // Setup the screenshot source after we've verified input is legit. | 534 // Setup the screenshot source after we've verified input is legit. |
536 SetupScreenshotsSource(); | 535 SetupScreenshotsSource(); |
537 | 536 |
538 return base::StringPiece( | 537 return base::StringPiece( |
539 ResourceBundle::GetSharedInstance().GetRawDataResource( | 538 ResourceBundle::GetSharedInstance().GetRawDataResource( |
540 IDR_BUGREPORT_HTML)); | 539 IDR_BUGREPORT_HTML)); |
541 } | 540 } |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
679 bool send_sys_info = (sys_info_checkbox == "true"); | 678 bool send_sys_info = (sys_info_checkbox == "true"); |
680 | 679 |
681 // If we aren't sending the sys_info, cancel the gathering of the syslogs. | 680 // If we aren't sending the sys_info, cancel the gathering of the syslogs. |
682 if (!send_sys_info) | 681 if (!send_sys_info) |
683 CancelFeedbackCollection(); | 682 CancelFeedbackCollection(); |
684 #endif | 683 #endif |
685 | 684 |
686 // Update the data in bug_report_ so it can be sent | 685 // Update the data in bug_report_ so it can be sent |
687 bug_report_->UpdateData(dom_ui_->GetProfile() | 686 bug_report_->UpdateData(dom_ui_->GetProfile() |
688 , target_tab_url_ | 687 , target_tab_url_ |
689 , target_tab_title_ | |
690 , problem_type | 688 , problem_type |
691 , page_url | 689 , page_url |
692 , description | 690 , description |
693 , image | 691 , image |
694 #if defined(OS_CHROMEOS) | 692 #if defined(OS_CHROMEOS) |
695 , user_email | 693 , user_email |
696 , send_sys_info | 694 , send_sys_info |
697 , false // sent_report | 695 , false // sent_report |
698 #endif | 696 #endif |
699 ); | 697 ); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
764 BugReportUIHTMLSource* html_source = | 762 BugReportUIHTMLSource* html_source = |
765 new BugReportUIHTMLSource(handler->Init()); | 763 new BugReportUIHTMLSource(handler->Init()); |
766 // Set up the chrome://bugreport/ source. | 764 // Set up the chrome://bugreport/ source. |
767 BrowserThread::PostTask( | 765 BrowserThread::PostTask( |
768 BrowserThread::IO, FROM_HERE, | 766 BrowserThread::IO, FROM_HERE, |
769 NewRunnableMethod( | 767 NewRunnableMethod( |
770 ChromeURLDataManager::GetInstance(), | 768 ChromeURLDataManager::GetInstance(), |
771 &ChromeURLDataManager::AddDataSource, | 769 &ChromeURLDataManager::AddDataSource, |
772 make_scoped_refptr(html_source))); | 770 make_scoped_refptr(html_source))); |
773 } | 771 } |
OLD | NEW |