OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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/binary_integrity_incid ent.h" | 5 #include "chrome/browser/safe_browsing/incident_reporting/binary_integrity_incid ent.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
Nathan Parker
2016/04/11 17:56:44
include memory?
dcheng
2016/04/11 18:31:15
Usually if the "primary" header already includes a
| |
8 #include "chrome/browser/safe_browsing/incident_reporting/incident_handler_util. h" | 8 #include "chrome/browser/safe_browsing/incident_reporting/incident_handler_util. h" |
9 #include "chrome/common/safe_browsing/csd.pb.h" | 9 #include "chrome/common/safe_browsing/csd.pb.h" |
10 | 10 |
11 namespace safe_browsing { | 11 namespace safe_browsing { |
12 | 12 |
13 BinaryIntegrityIncident::BinaryIntegrityIncident( | 13 BinaryIntegrityIncident::BinaryIntegrityIncident( |
14 scoped_ptr<ClientIncidentReport_IncidentData_BinaryIntegrityIncident> | 14 std::unique_ptr<ClientIncidentReport_IncidentData_BinaryIntegrityIncident> |
15 binary_integrity_incident) { | 15 binary_integrity_incident) { |
16 DCHECK(binary_integrity_incident); | 16 DCHECK(binary_integrity_incident); |
17 DCHECK(binary_integrity_incident->has_file_basename()); | 17 DCHECK(binary_integrity_incident->has_file_basename()); |
18 payload()->set_allocated_binary_integrity( | 18 payload()->set_allocated_binary_integrity( |
19 binary_integrity_incident.release()); | 19 binary_integrity_incident.release()); |
20 } | 20 } |
21 | 21 |
22 BinaryIntegrityIncident::~BinaryIntegrityIncident() { | 22 BinaryIntegrityIncident::~BinaryIntegrityIncident() { |
23 } | 23 } |
24 | 24 |
25 IncidentType BinaryIntegrityIncident::GetType() const { | 25 IncidentType BinaryIntegrityIncident::GetType() const { |
26 return IncidentType::BINARY_INTEGRITY; | 26 return IncidentType::BINARY_INTEGRITY; |
27 } | 27 } |
28 | 28 |
29 // Returns the basename of the binary. | 29 // Returns the basename of the binary. |
30 std::string BinaryIntegrityIncident::GetKey() const { | 30 std::string BinaryIntegrityIncident::GetKey() const { |
31 return payload()->binary_integrity().file_basename(); | 31 return payload()->binary_integrity().file_basename(); |
32 } | 32 } |
33 | 33 |
34 // Returns a digest computed over the payload. | 34 // Returns a digest computed over the payload. |
35 uint32_t BinaryIntegrityIncident::ComputeDigest() const { | 35 uint32_t BinaryIntegrityIncident::ComputeDigest() const { |
36 return HashMessage(payload()->binary_integrity()); | 36 return HashMessage(payload()->binary_integrity()); |
37 } | 37 } |
38 | 38 |
39 } // namespace safe_browsing | 39 } // namespace safe_browsing |
OLD | NEW |