Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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/incident_reporting/resource_request_incid ent.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "chrome/browser/safe_browsing/incident_reporting/incident_handler_util. h" | |
| 9 #include "chrome/common/safe_browsing/csd.pb.h" | |
| 10 | |
| 11 namespace safe_browsing { | |
| 12 | |
| 13 ResourceRequestIncident::ResourceRequestIncident( | |
| 14 scoped_ptr<ClientIncidentReport_IncidentData_ResourceRequestIncident> | |
| 15 script_request_incident) { | |
| 16 DCHECK(script_request_incident); | |
| 17 DCHECK(script_request_incident->has_digest()); | |
| 18 payload()->set_allocated_resource_request(script_request_incident.release()); | |
| 19 } | |
| 20 | |
| 21 ResourceRequestIncident::~ResourceRequestIncident() { | |
| 22 } | |
| 23 | |
| 24 IncidentType ResourceRequestIncident::GetType() const { | |
| 25 return IncidentType::RESOURCE_REQUEST; | |
| 26 } | |
| 27 | |
| 28 std::string ResourceRequestIncident::GetKey() const { | |
| 29 // Use a static key in addition to a fixed digest below to ensure that only | |
|
grt (UTC plus 2)
2015/03/27 14:17:43
please update the comment:
// Use a static key p
romanl
2015/03/30 14:46:50
Done.
| |
| 30 // one incident per user (and incident type) is reported. | |
| 31 return payload()->resource_request().type() == | |
| 32 ClientIncidentReport_IncidentData_ResourceRequestIncident:: | |
| 33 TYPE_SCRIPT | |
| 34 ? "script_request_incident" | |
| 35 : "domain_request_incident"; | |
| 36 } | |
| 37 | |
| 38 uint32_t ResourceRequestIncident::ComputeDigest() const { | |
| 39 // Return a constant in addition to a fixed key above to ensure that only one | |
|
grt (UTC plus 2)
2015/03/27 14:17:43
// Return a constant in addition to a fixed key pe
romanl
2015/03/30 14:46:50
Done.
| |
| 40 // incident per user is reported. | |
| 41 return 42; | |
| 42 } | |
| 43 | |
| 44 } // namespace safe_browsing | |
| OLD | NEW |