Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6671)

Unified Diff: chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_analyzer.cc

Issue 800263002: Added incident report for variations seed signature mismatch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: analyze on UI thread to access variations service Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..b8dbecc9e5c8885fe67e19fc3c1a52f37846ba0a
--- /dev/null
+++ b/chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_analyzer.cc
@@ -0,0 +1,57 @@
+// 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 "base/bind.h"
+#include "base/location.h"
+#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"
+#include "content/public/browser/browser_thread.h"
+
+namespace safe_browsing {
+
+namespace {
+
+void VerifyVariationsSeedSignatureOnUIThread(
+ const AddIncidentCallback& callback) {
+ chrome_variations::VariationsService* variations_service =
+ g_browser_process->variations_service();
+ if (!variations_service)
+ return;
+ std::string invalid_signature =
+ variations_service->GetInvalidVariationsSeedSignature();
+ if (!invalid_signature.empty()) {
+ scoped_ptr<ClientIncidentReport_IncidentData> incident_data(
+ new ClientIncidentReport_IncidentData());
+ 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
+
+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) {
+ content::BrowserThread::PostTask(
+ content::BrowserThread::UI,
+ FROM_HERE,
+ base::Bind(&VerifyVariationsSeedSignatureOnUIThread, callback));
+}
+
+} // namespace safe_browsing

Powered by Google App Engine
This is Rietveld 408576698