Chromium Code Reviews| 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/ui/webui/bug_report_ui.h" | 5 #include "chrome/browser/ui/webui/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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 626 return; | 626 return; |
| 627 } | 627 } |
| 628 | 628 |
| 629 // #3 - Screenshot to send. | 629 // #3 - Screenshot to send. |
| 630 std::string screenshot_path; | 630 std::string screenshot_path; |
| 631 (*i)->GetAsString(&screenshot_path); | 631 (*i)->GetAsString(&screenshot_path); |
| 632 screenshot_path.erase(0, strlen(kScreenshotBaseUrl)); | 632 screenshot_path.erase(0, strlen(kScreenshotBaseUrl)); |
| 633 | 633 |
| 634 // Get the image to send in the report. | 634 // Get the image to send in the report. |
| 635 std::vector<unsigned char> image; | 635 std::vector<unsigned char> image; |
| 636 if (screenshot_path.size() > 0) { | 636 if (!screenshot_path.empty()) { |
|
Peter Kasting
2011/03/03 19:35:53
Nit: No need for {}
| |
| 637 image = screenshot_source_->GetScreenshot(screenshot_path); | 637 image = screenshot_source_->GetScreenshot(screenshot_path); |
| 638 } | 638 } |
| 639 | 639 |
| 640 #if defined(OS_CHROMEOS) | 640 #if defined(OS_CHROMEOS) |
| 641 if (++i == list_value->end()) { | 641 if (++i == list_value->end()) { |
| 642 LOG(ERROR) << "Incorrect data passed to sendReport."; | 642 LOG(ERROR) << "Incorrect data passed to sendReport."; |
| 643 return; | 643 return; |
| 644 } | 644 } |
| 645 | 645 |
| 646 // #4 - User e-mail | 646 // #4 - User e-mail |
| 647 std::string user_email; | 647 std::string user_email; |
| 648 (*i)->GetAsString(&user_email); | 648 (*i)->GetAsString(&user_email); |
| 649 if (++i == list_value->end()) { | 649 if (++i == list_value->end()) { |
| 650 LOG(ERROR) << "Incorrect data passed to sendReport."; | 650 LOG(ERROR) << "Incorrect data passed to sendReport."; |
| 651 return; | 651 return; |
| 652 } | 652 } |
| 653 | 653 |
| 654 // #5 - System info checkbox. | 654 // #5 - System info checkbox. |
| 655 std::string sys_info_checkbox; | 655 std::string sys_info_checkbox; |
| 656 (*i)->GetAsString(&sys_info_checkbox); | 656 (*i)->GetAsString(&sys_info_checkbox); |
| 657 bool send_sys_info = (sys_info_checkbox == "true"); | 657 bool send_sys_info = (sys_info_checkbox == "true"); |
| 658 | 658 |
| 659 // If we aren't sending the sys_info, cancel the gathering of the syslogs. | 659 // If we aren't sending the sys_info, cancel the gathering of the syslogs. |
| 660 if (!send_sys_info) | 660 if (!send_sys_info) |
| 661 CancelFeedbackCollection(); | 661 CancelFeedbackCollection(); |
| 662 #endif | 662 #endif |
| 663 | 663 |
| 664 // Update the data in bug_report_ so it can be sent | 664 // Update the data in bug_report_ so it can be sent |
| 665 bug_report_->UpdateData(web_ui_->GetProfile() | 665 bug_report_->UpdateData(web_ui_->GetProfile() |
|
Peter Kasting
2011/03/03 19:35:53
Nit: While here, want to fix where the commas are?
| |
| 666 , target_tab_url_ | 666 , target_tab_url_ |
| 667 , problem_type | 667 , problem_type |
| 668 , page_url | 668 , page_url |
| 669 , description | 669 , description |
| 670 , image | 670 , image |
| 671 #if defined(OS_CHROMEOS) | 671 #if defined(OS_CHROMEOS) |
| 672 , user_email | 672 , user_email |
| 673 , send_sys_info | 673 , send_sys_info |
| 674 , false // sent_report | 674 , false // sent_report |
| 675 #endif | 675 #endif |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 736 BugReportHandler* handler = new BugReportHandler(tab); | 736 BugReportHandler* handler = new BugReportHandler(tab); |
| 737 AddMessageHandler((handler)->Attach(this)); | 737 AddMessageHandler((handler)->Attach(this)); |
| 738 | 738 |
| 739 // The handler's init will specify which html | 739 // The handler's init will specify which html |
| 740 // resource we'll display to the user | 740 // resource we'll display to the user |
| 741 BugReportUIHTMLSource* html_source = | 741 BugReportUIHTMLSource* html_source = |
| 742 new BugReportUIHTMLSource(handler->Init()); | 742 new BugReportUIHTMLSource(handler->Init()); |
| 743 // Set up the chrome://bugreport/ source. | 743 // Set up the chrome://bugreport/ source. |
| 744 tab->profile()->GetChromeURLDataManager()->AddDataSource(html_source); | 744 tab->profile()->GetChromeURLDataManager()->AddDataSource(html_source); |
| 745 } | 745 } |
| OLD | NEW |