Chromium Code Reviews| Index: chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_analyzer.cc |
| diff --git a/chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_analyzer.cc b/chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_analyzer.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..291fa8d9d891f898b0e47999ebb07f5b4415ee76 |
| --- /dev/null |
| +++ b/chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_analyzer.cc |
| @@ -0,0 +1,39 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_analyzer.h" |
| + |
| +#include <string> |
| + |
| +#include "chrome/browser/browser_process.h" |
| +#include "chrome/browser/metrics/variations/variations_service.h" |
| +#include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| +#include "chrome/common/safe_browsing/csd.pb.h" |
| + |
| +namespace safe_browsing { |
| + |
| +void RegisterVariationsSeedSignatureAnalysis() { |
| + scoped_refptr<SafeBrowsingService> safe_browsing_service( |
| + g_browser_process->safe_browsing_service()); |
| + |
| + safe_browsing_service->RegisterDelayedAnalysisCallback( |
| + base::Bind(&VerifyVariationsSeedSignature)); |
| +} |
| + |
| +void VerifyVariationsSeedSignature(const AddIncidentCallback& callback) { |
| + std::string invalid_signature = g_browser_process->variations_service() |
|
Alexei Svitkine (slow)
2014/10/15 14:53:07
Nit: Wrap after =
Georges Khalil
2014/10/15 16:53:19
I tried, it won't fit. This is the output of git c
|
| + ->GetInvalidVariationsSeedSignature(); |
|
Alexei Svitkine (slow)
2014/10/15 14:55:56
Actually, one other thing - g_browser_process->var
Georges Khalil
2014/10/15 16:53:19
Done.
|
| + if (!invalid_signature.empty()) { |
| + scoped_ptr<safe_browsing::ClientIncidentReport_IncidentData> incident_data( |
| + new safe_browsing::ClientIncidentReport_IncidentData()); |
| + safe_browsing:: |
|
Alexei Svitkine (slow)
2014/10/15 14:53:07
Nit: No need for namespace here.
|
| + ClientIncidentReport_IncidentData_VariationsSeedSignatureIncident* |
| + variations_seed_signature = |
| + incident_data->mutable_variations_seed_signature(); |
| + variations_seed_signature->set_variations_seed_signature(invalid_signature); |
| + callback.Run(incident_data.Pass()); |
| + } |
| +} |
| + |
| +} // namespace safe_browsing |