| OLD | NEW |
| 1 // Copyright (c) 2006-2008 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 "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "chrome/browser/net/url_fetcher.h" | 11 #include "chrome/browser/net/url_fetcher.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 return l10n_util::GetString(IDS_BUGREPORT_BROWSER_CRASH); | 84 return l10n_util::GetString(IDS_BUGREPORT_BROWSER_CRASH); |
| 85 case OTHER_PROBLEM: | 85 case OTHER_PROBLEM: |
| 86 return l10n_util::GetString(IDS_BUGREPORT_OTHER_PROBLEM); | 86 return l10n_util::GetString(IDS_BUGREPORT_OTHER_PROBLEM); |
| 87 default: | 87 default: |
| 88 NOTREACHED(); | 88 NOTREACHED(); |
| 89 return std::wstring(); | 89 return std::wstring(); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 DISALLOW_EVIL_CONSTRUCTORS(BugReportComboBoxModel); | 94 DISALLOW_COPY_AND_ASSIGN(BugReportComboBoxModel); |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 // Simple URLFetcher::Delegate to clean up URLFetcher on completion | 97 // Simple URLFetcher::Delegate to clean up URLFetcher on completion |
| 98 // (since the BugReportView will be gone by then) | 98 // (since the BugReportView will be gone by then) |
| 99 class BugReportView::PostCleanup : public URLFetcher::Delegate { | 99 class BugReportView::PostCleanup : public URLFetcher::Delegate { |
| 100 public: | 100 public: |
| 101 PostCleanup(); | 101 PostCleanup(); |
| 102 // Overridden from URLFetcher::Delegate | 102 // Overridden from URLFetcher::Delegate |
| 103 virtual void OnURLFetchComplete(const URLFetcher* source, | 103 virtual void OnURLFetchComplete(const URLFetcher* source, |
| 104 const GURL& url, | 104 const GURL& url, |
| 105 const URLRequestStatus& status, | 105 const URLRequestStatus& status, |
| 106 int response_code, | 106 int response_code, |
| 107 const ResponseCookies& cookies, | 107 const ResponseCookies& cookies, |
| 108 const std::string& data); | 108 const std::string& data); |
| 109 private: | 109 private: |
| 110 DISALLOW_EVIL_CONSTRUCTORS(PostCleanup); | 110 DISALLOW_COPY_AND_ASSIGN(PostCleanup); |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 BugReportView::PostCleanup::PostCleanup() { | 113 BugReportView::PostCleanup::PostCleanup() { |
| 114 } | 114 } |
| 115 | 115 |
| 116 void BugReportView::PostCleanup::OnURLFetchComplete( | 116 void BugReportView::PostCleanup::OnURLFetchComplete( |
| 117 const URLFetcher* source, | 117 const URLFetcher* source, |
| 118 const GURL& url, | 118 const GURL& url, |
| 119 const URLRequestStatus& status, | 119 const URLRequestStatus& status, |
| 120 int response_code, | 120 int response_code, |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 include_page_image_checkbox_->SetEnabled(!is_phishing_report); | 253 include_page_image_checkbox_->SetEnabled(!is_phishing_report); |
| 254 include_page_image_checkbox_->SetChecked(!is_phishing_report); | 254 include_page_image_checkbox_->SetChecked(!is_phishing_report); |
| 255 | 255 |
| 256 GetDialogClientView()->UpdateDialogButtons(); | 256 GetDialogClientView()->UpdateDialogButtons(); |
| 257 } | 257 } |
| 258 | 258 |
| 259 void BugReportView::ContentsChanged(views::TextField* sender, | 259 void BugReportView::ContentsChanged(views::TextField* sender, |
| 260 const std::wstring& new_contents) { | 260 const std::wstring& new_contents) { |
| 261 } | 261 } |
| 262 | 262 |
| 263 void BugReportView::HandleKeystroke(views::TextField* sender, | 263 bool BugReportView::HandleKeystroke(views::TextField* sender, |
| 264 UINT message, TCHAR key, | 264 UINT message, TCHAR key, |
| 265 UINT repeat_count, UINT flags) { | 265 UINT repeat_count, UINT flags) { |
| 266 return false; |
| 266 } | 267 } |
| 267 | 268 |
| 268 std::wstring BugReportView::GetDialogButtonLabel(DialogButton button) const { | 269 std::wstring BugReportView::GetDialogButtonLabel(DialogButton button) const { |
| 269 if (button == DIALOGBUTTON_OK) { | 270 if (button == DIALOGBUTTON_OK) { |
| 270 if (problem_type_ == BugReportComboBoxModel::PHISHING_PAGE) | 271 if (problem_type_ == BugReportComboBoxModel::PHISHING_PAGE) |
| 271 return l10n_util::GetString(IDS_BUGREPORT_SEND_PHISHING_REPORT); | 272 return l10n_util::GetString(IDS_BUGREPORT_SEND_PHISHING_REPORT); |
| 272 else | 273 else |
| 273 return l10n_util::GetString(IDS_BUGREPORT_SEND_REPORT); | 274 return l10n_util::GetString(IDS_BUGREPORT_SEND_REPORT); |
| 274 } else { | 275 } else { |
| 275 return std::wstring(); | 276 return std::wstring(); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 fetcher->Start(); | 481 fetcher->Start(); |
| 481 } | 482 } |
| 482 | 483 |
| 483 void BugReportView::ReportPhishing() { | 484 void BugReportView::ReportPhishing() { |
| 484 tab_->controller()->LoadURL( | 485 tab_->controller()->LoadURL( |
| 485 safe_browsing_util::GeneratePhishingReportUrl( | 486 safe_browsing_util::GeneratePhishingReportUrl( |
| 486 kReportPhishingUrl, WideToUTF8(page_url_text_->GetText())), | 487 kReportPhishingUrl, WideToUTF8(page_url_text_->GetText())), |
| 487 GURL(), | 488 GURL(), |
| 488 PageTransition::LINK); | 489 PageTransition::LINK); |
| 489 } | 490 } |
| OLD | NEW |