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