| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/safe_browsing/incident_reporting/variations_seed_signat
ure_analyzer.h" | 5 #include "chrome/browser/safe_browsing/incident_reporting/variations_seed_signat
ure_analyzer.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 if (!variations_service) | 26 if (!variations_service) |
| 27 return; | 27 return; |
| 28 std::string invalid_signature = | 28 std::string invalid_signature = |
| 29 variations_service->GetInvalidVariationsSeedSignature(); | 29 variations_service->GetInvalidVariationsSeedSignature(); |
| 30 if (!invalid_signature.empty()) { | 30 if (!invalid_signature.empty()) { |
| 31 scoped_ptr< | 31 scoped_ptr< |
| 32 ClientIncidentReport_IncidentData_VariationsSeedSignatureIncident> | 32 ClientIncidentReport_IncidentData_VariationsSeedSignatureIncident> |
| 33 variations_seed_signature( | 33 variations_seed_signature( |
| 34 new ClientIncidentReport_IncidentData_VariationsSeedSignatureInciden
t()); | 34 new ClientIncidentReport_IncidentData_VariationsSeedSignatureInciden
t()); |
| 35 variations_seed_signature->set_variations_seed_signature(invalid_signature); | 35 variations_seed_signature->set_variations_seed_signature(invalid_signature); |
| 36 callback.Run(make_scoped_ptr( | 36 callback.Run(nullptr, make_scoped_ptr(new VariationsSeedSignatureIncident( |
| 37 new VariationsSeedSignatureIncident(variations_seed_signature.Pass()))); | 37 variations_seed_signature.Pass()))); |
| 38 } | 38 } |
| 39 } | 39 } |
| 40 | 40 |
| 41 } // namespace | 41 } // namespace |
| 42 | 42 |
| 43 void RegisterVariationsSeedSignatureAnalysis() { | 43 void RegisterVariationsSeedSignatureAnalysis() { |
| 44 scoped_refptr<SafeBrowsingService> safe_browsing_service( | 44 scoped_refptr<SafeBrowsingService> safe_browsing_service( |
| 45 g_browser_process->safe_browsing_service()); | 45 g_browser_process->safe_browsing_service()); |
| 46 | 46 |
| 47 safe_browsing_service->RegisterDelayedAnalysisCallback( | 47 safe_browsing_service->RegisterDelayedAnalysisCallback( |
| 48 base::Bind(&VerifyVariationsSeedSignature)); | 48 base::Bind(&VerifyVariationsSeedSignature)); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void VerifyVariationsSeedSignature(const AddIncidentCallback& callback) { | 51 void VerifyVariationsSeedSignature(const AddIncidentCallback& callback) { |
| 52 content::BrowserThread::PostTask( | 52 content::BrowserThread::PostTask( |
| 53 content::BrowserThread::UI, | 53 content::BrowserThread::UI, |
| 54 FROM_HERE, | 54 FROM_HERE, |
| 55 base::Bind(&VerifyVariationsSeedSignatureOnUIThread, callback)); | 55 base::Bind(&VerifyVariationsSeedSignatureOnUIThread, callback)); |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace safe_browsing | 58 } // namespace safe_browsing |
| OLD | NEW |