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

Side by Side Diff: chrome/browser/safe_browsing/incident_reporting/incident.h

Issue 1870003002: Convert //chrome/browser/safe_browsing from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and address comments Created 4 years, 8 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
OLDNEW
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 #ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_INCIDENT_H_ 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_INCIDENT_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_INCIDENT_H_ 6 #define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_INCIDENT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9
10 #include <memory>
9 #include <string> 11 #include <string>
10 12
11 #include "base/macros.h" 13 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 14
14 namespace safe_browsing { 15 namespace safe_browsing {
15 16
16 class ClientIncidentReport_IncidentData; 17 class ClientIncidentReport_IncidentData;
17 18
18 // An incident's type. Values from this enum are used for histograms (hence the 19 // An incident's type. Values from this enum are used for histograms (hence the
19 // making underlying type the same as histogram samples.). Do not re-use 20 // making underlying type the same as histogram samples.). Do not re-use
20 // existing values. 21 // existing values.
21 enum class IncidentType : int32_t { 22 enum class IncidentType : int32_t {
22 // Start with 1 rather than zero; otherwise there won't be enough buckets for 23 // Start with 1 rather than zero; otherwise there won't be enough buckets for
(...skipping 27 matching lines...) Expand all
50 51
51 // Returns a key that identifies a particular instance among the type's 52 // Returns a key that identifies a particular instance among the type's
52 // possibilities. 53 // possibilities.
53 virtual std::string GetKey() const = 0; 54 virtual std::string GetKey() const = 0;
54 55
55 // Returns a computed fingerprint of the payload. Incidents of the same 56 // Returns a computed fingerprint of the payload. Incidents of the same
56 // incident must result in the same digest. 57 // incident must result in the same digest.
57 virtual uint32_t ComputeDigest() const = 0; 58 virtual uint32_t ComputeDigest() const = 0;
58 59
59 // Returns the incident's payload. 60 // Returns the incident's payload.
60 virtual scoped_ptr<ClientIncidentReport_IncidentData> TakePayload(); 61 virtual std::unique_ptr<ClientIncidentReport_IncidentData> TakePayload();
61 62
62 // Returns the minimum level of consent required for reporting of the 63 // Returns the minimum level of consent required for reporting of the
63 // incident. 64 // incident.
64 virtual MinimumProfileConsent GetMinimumProfileConsent() const; 65 virtual MinimumProfileConsent GetMinimumProfileConsent() const;
65 66
66 protected: 67 protected:
67 // Constructs the payload with an empty protobuf, setting its incident time to 68 // Constructs the payload with an empty protobuf, setting its incident time to
68 // the current time. 69 // the current time.
69 Incident(); 70 Incident();
70 71
71 // Accessors for the payload. These must not be called after the payload has 72 // Accessors for the payload. These must not be called after the payload has
72 // been taken. 73 // been taken.
73 ClientIncidentReport_IncidentData* payload(); 74 ClientIncidentReport_IncidentData* payload();
74 const ClientIncidentReport_IncidentData* payload() const; 75 const ClientIncidentReport_IncidentData* payload() const;
75 76
76 private: 77 private:
77 scoped_ptr<ClientIncidentReport_IncidentData> payload_; 78 std::unique_ptr<ClientIncidentReport_IncidentData> payload_;
78 79
79 DISALLOW_COPY_AND_ASSIGN(Incident); 80 DISALLOW_COPY_AND_ASSIGN(Incident);
80 }; 81 };
81 82
82 } // namespace safe_browsing 83 } // namespace safe_browsing
83 84
84 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_INCIDENT_H_ 85 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_INCIDENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698