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

Side by Side Diff: chrome/browser/safe_browsing/tracked_preference_incident_handlers.cc

Issue 411793004: More fine-grained pruning in safe browsing incident reporting service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: extract incident-specific code into its own file Created 6 years, 5 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/safe_browsing/tracked_preference_incident_handlers.h"
6
7 #include "base/logging.h"
8 #include "chrome/browser/safe_browsing/incident_handler_util.h"
9 #include "chrome/common/safe_browsing/csd.pb.h"
10
11 namespace safe_browsing {
12
13 std::string GetTrackedPreferenceIncidentKey(
14 const ClientIncidentReport_IncidentData& incident_data) {
15 DCHECK(incident_data.has_tracked_preference());
16 DCHECK(incident_data.tracked_preference().has_path());
17 return incident_data.tracked_preference().path();
18 }
19
20 uint32_t GetTrackedPreferenceIncidentDigest(
21 const ClientIncidentReport_IncidentData& incident_data) {
22 DCHECK(incident_data.has_tracked_preference());
23
24 // Make a canonical representation of the incident's payload over which a hash
25 // digest is computed.
26 const ClientIncidentReport_IncidentData_TrackedPreferenceIncident& input =
27 incident_data.tracked_preference();
28 ClientIncidentReport_IncidentData_TrackedPreferenceIncident incident;
29
30 if (input.has_path() && !input.path().empty())
31 incident.set_path(input.path());
32 if (input.has_atomic_value() && !input.atomic_value().empty()) {
33 incident.set_atomic_value(input.atomic_value());
34 } else {
35 for (int i = 0; i < input.split_key_size(); ++i) {
36 if (!input.split_key(i).empty())
37 incident.add_split_key(input.split_key(i));
38 }
39 }
40 if (input.has_value_state())
41 incident.set_value_state(input.value_state());
42
43 return HashMessage(incident);
44 }
45
46 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698