OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/net/chrome_fraudulent_certificate_reporter.h" | 5 #include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/profiler/scoped_tracker.h" |
11 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
13 #include "chrome/browser/net/cert_logger.pb.h" | 14 #include "chrome/browser/net/cert_logger.pb.h" |
14 #include "net/base/elements_upload_data_stream.h" | 15 #include "net/base/elements_upload_data_stream.h" |
15 #include "net/base/load_flags.h" | 16 #include "net/base/load_flags.h" |
16 #include "net/base/request_priority.h" | 17 #include "net/base/request_priority.h" |
17 #include "net/base/upload_bytes_element_reader.h" | 18 #include "net/base/upload_bytes_element_reader.h" |
18 #include "net/cert/x509_certificate.h" | 19 #include "net/cert/x509_certificate.h" |
19 #include "net/ssl/ssl_info.h" | 20 #include "net/ssl/ssl_info.h" |
20 #include "net/url_request/url_request_context.h" | 21 #include "net/url_request/url_request_context.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 DCHECK(i != inflight_requests_.end()); | 104 DCHECK(i != inflight_requests_.end()); |
104 scoped_ptr<net::URLRequest> url_request(*i); | 105 scoped_ptr<net::URLRequest> url_request(*i); |
105 inflight_requests_.erase(i); | 106 inflight_requests_.erase(i); |
106 } | 107 } |
107 | 108 |
108 // TODO(palmer): Currently, the upload is fire-and-forget but soon we will | 109 // TODO(palmer): Currently, the upload is fire-and-forget but soon we will |
109 // try to recover by retrying, and trying different endpoints, and | 110 // try to recover by retrying, and trying different endpoints, and |
110 // appealing to the user. | 111 // appealing to the user. |
111 void ChromeFraudulentCertificateReporter::OnResponseStarted( | 112 void ChromeFraudulentCertificateReporter::OnResponseStarted( |
112 net::URLRequest* request) { | 113 net::URLRequest* request) { |
| 114 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
| 115 tracked_objects::ScopedTracker tracking_profile( |
| 116 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 117 "422516 ChromeFraudulentCertificateReporter::OnResponseStarted")); |
| 118 |
113 const net::URLRequestStatus& status(request->status()); | 119 const net::URLRequestStatus& status(request->status()); |
114 if (!status.is_success()) { | 120 if (!status.is_success()) { |
115 LOG(WARNING) << "Certificate upload failed" | 121 LOG(WARNING) << "Certificate upload failed" |
116 << " status:" << status.status() | 122 << " status:" << status.status() |
117 << " error:" << status.error(); | 123 << " error:" << status.error(); |
118 } else if (request->GetResponseCode() != 200) { | 124 } else if (request->GetResponseCode() != 200) { |
119 LOG(WARNING) << "Certificate upload HTTP status: " | 125 LOG(WARNING) << "Certificate upload HTTP status: " |
120 << request->GetResponseCode(); | 126 << request->GetResponseCode(); |
121 } | 127 } |
122 RequestComplete(request); | 128 RequestComplete(request); |
123 } | 129 } |
124 | 130 |
125 void ChromeFraudulentCertificateReporter::OnReadCompleted( | 131 void ChromeFraudulentCertificateReporter::OnReadCompleted( |
126 net::URLRequest* request, int bytes_read) {} | 132 net::URLRequest* request, int bytes_read) {} |
127 | 133 |
128 } // namespace chrome_browser_net | 134 } // namespace chrome_browser_net |
OLD | NEW |