OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/suspicious_module_inci
dent.h" | 5 #include "chrome/browser/safe_browsing/incident_reporting/suspicious_module_inci
dent.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
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 SuspiciousModuleIncident::SuspiciousModuleIncident( | 13 SuspiciousModuleIncident::SuspiciousModuleIncident( |
14 scoped_ptr<ClientIncidentReport_IncidentData_SuspiciousModuleIncident> | 14 std::unique_ptr<ClientIncidentReport_IncidentData_SuspiciousModuleIncident> |
15 suspicious_module_incident) { | 15 suspicious_module_incident) { |
16 DCHECK(suspicious_module_incident); | 16 DCHECK(suspicious_module_incident); |
17 DCHECK(suspicious_module_incident->has_path()); | 17 DCHECK(suspicious_module_incident->has_path()); |
18 payload()->set_allocated_suspicious_module( | 18 payload()->set_allocated_suspicious_module( |
19 suspicious_module_incident.release()); | 19 suspicious_module_incident.release()); |
20 } | 20 } |
21 | 21 |
22 SuspiciousModuleIncident::~SuspiciousModuleIncident() {} | 22 SuspiciousModuleIncident::~SuspiciousModuleIncident() {} |
23 | 23 |
24 IncidentType SuspiciousModuleIncident::GetType() const { | 24 IncidentType SuspiciousModuleIncident::GetType() const { |
25 return IncidentType::SUSPICIOUS_MODULE; | 25 return IncidentType::SUSPICIOUS_MODULE; |
26 } | 26 } |
27 | 27 |
28 // Returns the sanitized path of the module. | 28 // Returns the sanitized path of the module. |
29 std::string SuspiciousModuleIncident::GetKey() const { | 29 std::string SuspiciousModuleIncident::GetKey() const { |
30 return payload()->suspicious_module().path(); | 30 return payload()->suspicious_module().path(); |
31 } | 31 } |
32 | 32 |
33 // Returns a digest computed over the payload. | 33 // Returns a digest computed over the payload. |
34 uint32_t SuspiciousModuleIncident::ComputeDigest() const { | 34 uint32_t SuspiciousModuleIncident::ComputeDigest() const { |
35 return HashMessage(payload()->suspicious_module()); | 35 return HashMessage(payload()->suspicious_module()); |
36 } | 36 } |
37 | 37 |
38 MinimumProfileConsent SuspiciousModuleIncident::GetMinimumProfileConsent() | 38 MinimumProfileConsent SuspiciousModuleIncident::GetMinimumProfileConsent() |
39 const { | 39 const { |
40 return MinimumProfileConsent::SAFE_BROWSING_EXTENDED_REPORTING_ENABLED; | 40 return MinimumProfileConsent::SAFE_BROWSING_EXTENDED_REPORTING_ENABLED; |
41 } | 41 } |
42 | 42 |
43 } // namespace safe_browsing | 43 } // namespace safe_browsing |
OLD | NEW |