| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/bug_report_view.h" | 5 #include "chrome/browser/views/bug_report_view.h" |
| 6 | 6 |
| 7 #include <iostream> | 7 #include <iostream> |
| 8 #include <fstream> | 8 #include <fstream> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 int new_index) { | 277 int new_index) { |
| 278 if (new_index == prev_index) | 278 if (new_index == prev_index) |
| 279 return; | 279 return; |
| 280 | 280 |
| 281 problem_type_ = new_index; | 281 problem_type_ = new_index; |
| 282 bool is_phishing_report = new_index == BugReportComboBoxModel::PHISHING_PAGE; | 282 bool is_phishing_report = new_index == BugReportComboBoxModel::PHISHING_PAGE; |
| 283 | 283 |
| 284 description_text_->SetEnabled(!is_phishing_report); | 284 description_text_->SetEnabled(!is_phishing_report); |
| 285 description_text_->SetReadOnly(is_phishing_report); | 285 description_text_->SetReadOnly(is_phishing_report); |
| 286 if (is_phishing_report) { | 286 if (is_phishing_report) { |
| 287 old_report_text_ = description_text_->GetText(); | 287 old_report_text_ = description_text_->text(); |
| 288 description_text_->SetText(std::wstring()); | 288 description_text_->SetText(std::wstring()); |
| 289 } else if (!old_report_text_.empty()) { | 289 } else if (!old_report_text_.empty()) { |
| 290 description_text_->SetText(old_report_text_); | 290 description_text_->SetText(old_report_text_); |
| 291 old_report_text_.clear(); | 291 old_report_text_.clear(); |
| 292 } | 292 } |
| 293 include_page_source_checkbox_->SetEnabled(!is_phishing_report); | 293 include_page_source_checkbox_->SetEnabled(!is_phishing_report); |
| 294 include_page_source_checkbox_->SetChecked(!is_phishing_report); | 294 include_page_source_checkbox_->SetChecked(!is_phishing_report); |
| 295 include_page_image_checkbox_->SetEnabled(!is_phishing_report); | 295 include_page_image_checkbox_->SetEnabled(!is_phishing_report); |
| 296 include_page_image_checkbox_->SetChecked(!is_phishing_report); | 296 include_page_image_checkbox_->SetChecked(!is_phishing_report); |
| 297 | 297 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 post_body.append("Content-Disposition: form-data; " | 431 post_body.append("Content-Disposition: form-data; " |
| 432 "name=\"problem\"\r\n\r\n"); | 432 "name=\"problem\"\r\n\r\n"); |
| 433 post_body.append(StringPrintf("%d\r\n", problem_type_)); | 433 post_body.append(StringPrintf("%d\r\n", problem_type_)); |
| 434 | 434 |
| 435 // Add in the URL, if we have one | 435 // Add in the URL, if we have one |
| 436 post_body.append("--" + mime_boundary + "\r\n"); | 436 post_body.append("--" + mime_boundary + "\r\n"); |
| 437 post_body.append("Content-Disposition: form-data; " | 437 post_body.append("Content-Disposition: form-data; " |
| 438 "name=\"url\"\r\n\r\n"); | 438 "name=\"url\"\r\n\r\n"); |
| 439 | 439 |
| 440 // convert URL to UTF8 | 440 // convert URL to UTF8 |
| 441 std::string report_url = WideToUTF8(page_url_text_->GetText()); | 441 std::string report_url = WideToUTF8(page_url_text_->text()); |
| 442 if (report_url.empty()) { | 442 if (report_url.empty()) { |
| 443 post_body.append("n/a\r\n"); | 443 post_body.append("n/a\r\n"); |
| 444 } else { | 444 } else { |
| 445 post_body.append(report_url + "\r\n"); | 445 post_body.append(report_url + "\r\n"); |
| 446 } | 446 } |
| 447 | 447 |
| 448 // Add Chrome version | 448 // Add Chrome version |
| 449 post_body.append("--" + mime_boundary + "\r\n"); | 449 post_body.append("--" + mime_boundary + "\r\n"); |
| 450 post_body.append("Content-Disposition: form-data; " | 450 post_body.append("Content-Disposition: form-data; " |
| 451 "name=\"chrome_version\"\r\n\r\n"); | 451 "name=\"chrome_version\"\r\n\r\n"); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 472 post_body.append("--" + mime_boundary + "\r\n"); | 472 post_body.append("--" + mime_boundary + "\r\n"); |
| 473 post_body.append("Content-Disposition: form-data; " | 473 post_body.append("Content-Disposition: form-data; " |
| 474 "name=\"chrome_locale\"\r\n\r\n"); | 474 "name=\"chrome_locale\"\r\n\r\n"); |
| 475 post_body.append(chrome_locale + "\r\n"); | 475 post_body.append(chrome_locale + "\r\n"); |
| 476 | 476 |
| 477 // Add a description if we have one | 477 // Add a description if we have one |
| 478 post_body.append("--" + mime_boundary + "\r\n"); | 478 post_body.append("--" + mime_boundary + "\r\n"); |
| 479 post_body.append("Content-Disposition: form-data; " | 479 post_body.append("Content-Disposition: form-data; " |
| 480 "name=\"description\"\r\n\r\n"); | 480 "name=\"description\"\r\n\r\n"); |
| 481 | 481 |
| 482 std::string description = WideToUTF8(description_text_->GetText()); | 482 std::string description = WideToUTF8(description_text_->text()); |
| 483 if (description.empty()) { | 483 if (description.empty()) { |
| 484 post_body.append("n/a\r\n"); | 484 post_body.append("n/a\r\n"); |
| 485 } else { | 485 } else { |
| 486 post_body.append(description + "\r\n"); | 486 post_body.append(description + "\r\n"); |
| 487 } | 487 } |
| 488 | 488 |
| 489 // include the page image if we have one | 489 // include the page image if we have one |
| 490 if (include_page_image_checkbox_->checked() && png_data_.get()) { | 490 if (include_page_image_checkbox_->checked() && png_data_.get()) { |
| 491 post_body.append("--" + mime_boundary + "\r\n"); | 491 post_body.append("--" + mime_boundary + "\r\n"); |
| 492 post_body.append("Content-Disposition: form-data; name=\"screenshot\"; " | 492 post_body.append("Content-Disposition: form-data; name=\"screenshot\"; " |
| (...skipping 22 matching lines...) Expand all Loading... |
| 515 fetcher->set_request_context(profile_->GetRequestContext()); | 515 fetcher->set_request_context(profile_->GetRequestContext()); |
| 516 std::string mime_type("multipart/form-data; boundary="); | 516 std::string mime_type("multipart/form-data; boundary="); |
| 517 mime_type += mime_boundary; | 517 mime_type += mime_boundary; |
| 518 fetcher->set_upload_data(mime_type, post_body); | 518 fetcher->set_upload_data(mime_type, post_body); |
| 519 fetcher->Start(); | 519 fetcher->Start(); |
| 520 } | 520 } |
| 521 | 521 |
| 522 void BugReportView::ReportPhishing() { | 522 void BugReportView::ReportPhishing() { |
| 523 tab_->controller().LoadURL( | 523 tab_->controller().LoadURL( |
| 524 safe_browsing_util::GeneratePhishingReportUrl( | 524 safe_browsing_util::GeneratePhishingReportUrl( |
| 525 kReportPhishingUrl, WideToUTF8(page_url_text_->GetText())), | 525 kReportPhishingUrl, WideToUTF8(page_url_text_->text())), |
| 526 GURL(), | 526 GURL(), |
| 527 PageTransition::LINK); | 527 PageTransition::LINK); |
| 528 } | 528 } |
| OLD | NEW |