OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "chrome/browser/safe_browsing/certificate_reporting_service.h" | 4 #include "chrome/browser/safe_browsing/certificate_reporting_service.h" |
5 | 5 |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
8 #include "base/metrics/sparse_histogram.h" | 8 #include "base/metrics/sparse_histogram.h" |
9 #include "base/time/clock.h" | 9 #include "base/time/clock.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 158 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
159 RecordUMAOnFailure(error); | 159 RecordUMAOnFailure(error); |
160 if (retries_enabled_) { | 160 if (retries_enabled_) { |
161 auto it = inflight_reports_.find(report_id); | 161 auto it = inflight_reports_.find(report_id); |
162 DCHECK(it != inflight_reports_.end()); | 162 DCHECK(it != inflight_reports_.end()); |
163 retry_list_->Add(it->second); | 163 retry_list_->Add(it->second); |
164 } | 164 } |
165 CHECK_GT(inflight_reports_.erase(report_id), 0u); | 165 CHECK_GT(inflight_reports_.erase(report_id), 0u); |
166 } | 166 } |
167 | 167 |
168 void CertificateReportingService::Reporter::SuccessCallback(int report_id) { | 168 void CertificateReportingService::Reporter::SuccessCallback(int report_id, |
| 169 int response_code) { |
169 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 170 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
170 CHECK_GT(inflight_reports_.erase(report_id), 0u); | 171 CHECK_GT(inflight_reports_.erase(report_id), 0u); |
171 } | 172 } |
172 | 173 |
173 CertificateReportingService::CertificateReportingService( | 174 CertificateReportingService::CertificateReportingService( |
174 safe_browsing::SafeBrowsingService* safe_browsing_service, | 175 safe_browsing::SafeBrowsingService* safe_browsing_service, |
175 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter, | 176 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter, |
176 Profile* profile, | 177 Profile* profile, |
177 uint8_t server_public_key[/* 32 */], | 178 uint8_t server_public_key[/* 32 */], |
178 uint32_t server_public_key_version, | 179 uint32_t server_public_key_version, |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 } | 322 } |
322 | 323 |
323 void CertificateReportingService::OnPreferenceChanged() { | 324 void CertificateReportingService::OnPreferenceChanged() { |
324 safe_browsing::SafeBrowsingService* safe_browsing_service_ = | 325 safe_browsing::SafeBrowsingService* safe_browsing_service_ = |
325 g_browser_process->safe_browsing_service(); | 326 g_browser_process->safe_browsing_service(); |
326 const bool enabled = safe_browsing_service_ && | 327 const bool enabled = safe_browsing_service_ && |
327 safe_browsing_service_->enabled_by_prefs() && | 328 safe_browsing_service_->enabled_by_prefs() && |
328 safe_browsing::IsExtendedReportingEnabled(pref_service_); | 329 safe_browsing::IsExtendedReportingEnabled(pref_service_); |
329 SetEnabled(enabled); | 330 SetEnabled(enabled); |
330 } | 331 } |
OLD | NEW |