OLD | NEW |
1 // Copyright (c) 2010 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/bug_report_util.h" | 5 #include "chrome/browser/bug_report_util.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // Simple URLFetcher::Delegate to clean up URLFetcher on completion. | 83 // Simple URLFetcher::Delegate to clean up URLFetcher on completion. |
84 class BugReportUtil::PostCleanup : public URLFetcher::Delegate { | 84 class BugReportUtil::PostCleanup : public URLFetcher::Delegate { |
85 public: | 85 public: |
86 PostCleanup(Profile* profile, std::string* post_body, | 86 PostCleanup(Profile* profile, std::string* post_body, |
87 int64 previous_delay) : profile_(profile), | 87 int64 previous_delay) : profile_(profile), |
88 post_body_(post_body), | 88 post_body_(post_body), |
89 previous_delay_(previous_delay) { } | 89 previous_delay_(previous_delay) { } |
90 // Overridden from URLFetcher::Delegate. | 90 // Overridden from URLFetcher::Delegate. |
91 virtual void OnURLFetchComplete(const URLFetcher* source, | 91 virtual void OnURLFetchComplete(const URLFetcher* source, |
92 const GURL& url, | 92 const GURL& url, |
93 const URLRequestStatus& status, | 93 const net::URLRequestStatus& status, |
94 int response_code, | 94 int response_code, |
95 const ResponseCookies& cookies, | 95 const ResponseCookies& cookies, |
96 const std::string& data); | 96 const std::string& data); |
97 | 97 |
98 protected: | 98 protected: |
99 virtual ~PostCleanup() {} | 99 virtual ~PostCleanup() {} |
100 | 100 |
101 private: | 101 private: |
102 Profile* profile_; | 102 Profile* profile_; |
103 std::string* post_body_; | 103 std::string* post_body_; |
104 int64 previous_delay_; | 104 int64 previous_delay_; |
105 | 105 |
106 DISALLOW_COPY_AND_ASSIGN(PostCleanup); | 106 DISALLOW_COPY_AND_ASSIGN(PostCleanup); |
107 }; | 107 }; |
108 | 108 |
109 // Don't use the data parameter, instead use the pointer we pass into every | 109 // Don't use the data parameter, instead use the pointer we pass into every |
110 // post cleanup object - that pointer will be deleted and deleted only on a | 110 // post cleanup object - that pointer will be deleted and deleted only on a |
111 // successful post to the feedback server. | 111 // successful post to the feedback server. |
112 void BugReportUtil::PostCleanup::OnURLFetchComplete( | 112 void BugReportUtil::PostCleanup::OnURLFetchComplete( |
113 const URLFetcher* source, | 113 const URLFetcher* source, |
114 const GURL& url, | 114 const GURL& url, |
115 const URLRequestStatus& status, | 115 const net::URLRequestStatus& status, |
116 int response_code, | 116 int response_code, |
117 const ResponseCookies& cookies, | 117 const ResponseCookies& cookies, |
118 const std::string& data) { | 118 const std::string& data) { |
119 | 119 |
120 std::stringstream error_stream; | 120 std::stringstream error_stream; |
121 if (response_code == kHttpPostSuccessNoContent) { | 121 if (response_code == kHttpPostSuccessNoContent) { |
122 // We've sent our report, delete the report data | 122 // We've sent our report, delete the report data |
123 delete post_body_; | 123 delete post_body_; |
124 | 124 |
125 error_stream << "Success"; | 125 error_stream << "Success"; |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 | 389 |
390 // static | 390 // static |
391 void BugReportUtil::ReportPhishing(TabContents* currentTab, | 391 void BugReportUtil::ReportPhishing(TabContents* currentTab, |
392 const std::string& phishing_url) { | 392 const std::string& phishing_url) { |
393 currentTab->controller().LoadURL( | 393 currentTab->controller().LoadURL( |
394 safe_browsing_util::GeneratePhishingReportUrl( | 394 safe_browsing_util::GeneratePhishingReportUrl( |
395 kReportPhishingUrl, phishing_url), | 395 kReportPhishingUrl, phishing_url), |
396 GURL(), | 396 GURL(), |
397 PageTransition::LINK); | 397 PageTransition::LINK); |
398 } | 398 } |
OLD | NEW |