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

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

Issue 1643573002: Add a ModuleLoadAnalyzer which checks modules against a whitelist (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve comments on #8 and add consent level to Incidents Created 4 years, 10 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 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 13
14 namespace safe_browsing { 14 namespace safe_browsing {
15 15
16 class ClientIncidentReport_IncidentData; 16 class ClientIncidentReport_IncidentData;
17 17
18 // An incident's type. Values from this enum are used for histograms (hence the 18 // 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 19 // making underlying type the same as histogram samples.). Do not re-use
20 // existing values. 20 // existing values.
21 enum class IncidentType : int32_t { 21 enum class IncidentType : int32_t {
22 // Start with 1 rather than zero; otherwise there won't be enough buckets for 22 // Start with 1 rather than zero; otherwise there won't be enough buckets for
23 // the histogram. 23 // the histogram.
24 TRACKED_PREFERENCE = 1, 24 TRACKED_PREFERENCE = 1,
25 BINARY_INTEGRITY = 2, 25 BINARY_INTEGRITY = 2,
26 BLACKLIST_LOAD = 3, 26 BLACKLIST_LOAD = 3,
27 OMNIBOX_INTERACTION = 4, 27 OMNIBOX_INTERACTION = 4,
28 VARIATIONS_SEED_SIGNATURE = 5, 28 VARIATIONS_SEED_SIGNATURE = 5,
29 RESOURCE_REQUEST = 6, 29 RESOURCE_REQUEST = 6,
30 SUSPICIOUS_MODULE = 7,
30 // Values for new incident types go here. 31 // Values for new incident types go here.
31 NUM_TYPES = 7 32 NUM_TYPES = 8
33 };
34
35 // The level of consent required by the incident to be associated with a
36 // profile. Please keep this list in ascending order of privacy consent.
grt (UTC plus 2) 2016/02/15 16:46:50 nit: the ordering requirement isn't a gentle reque
proberge 2016/02/16 16:56:22 Done.
37 enum class MinimumProfileConsent : int32_t {
grt (UTC plus 2) 2016/02/15 16:46:49 omit " : int32_t" unless it's really required. in
proberge 2016/02/16 16:56:22 Done.
38 SAFE_BROWSING_ENABLED = 0,
39 SAFE_BROWSING_EXTENDED_REPORTING_ENABLED = 1,
32 }; 40 };
33 41
34 // An abstract incident. Subclasses provide type-specific functionality to 42 // An abstract incident. Subclasses provide type-specific functionality to
35 // enable logging and pruning by the incident reporting service. 43 // enable logging and pruning by the incident reporting service.
36 class Incident { 44 class Incident {
37 public: 45 public:
38 virtual ~Incident(); 46 virtual ~Incident();
39 47
40 // Returns the type of the incident. 48 // Returns the type of the incident.
41 virtual IncidentType GetType() const = 0; 49 virtual IncidentType GetType() const = 0;
42 50
43 // Returns a key that identifies a particular instance among the type's 51 // Returns a key that identifies a particular instance among the type's
44 // possibilities. 52 // possibilities.
45 virtual std::string GetKey() const = 0; 53 virtual std::string GetKey() const = 0;
46 54
47 // Returns a computed fingerprint of the payload. Incidents of the same 55 // Returns a computed fingerprint of the payload. Incidents of the same
48 // incident must result in the same digest. 56 // incident must result in the same digest.
49 virtual uint32_t ComputeDigest() const = 0; 57 virtual uint32_t ComputeDigest() const = 0;
50 58
51 // Returns the incident's payload. 59 // Returns the incident's payload.
52 virtual scoped_ptr<ClientIncidentReport_IncidentData> TakePayload(); 60 virtual scoped_ptr<ClientIncidentReport_IncidentData> TakePayload();
53 61
62 virtual MinimumProfileConsent GetMinimumProfileConsent() const;
grt (UTC plus 2) 2016/02/15 16:46:49 // Returns the minimum level of consent required f
proberge 2016/02/16 16:56:22 Done.
63
54 protected: 64 protected:
55 // Constructs the payload with an empty protobuf, setting its incident time to 65 // Constructs the payload with an empty protobuf, setting its incident time to
56 // the current time. 66 // the current time.
57 Incident(); 67 Incident();
58 68
59 // Accessors for the payload. These must not be called after the payload has 69 // Accessors for the payload. These must not be called after the payload has
60 // been taken. 70 // been taken.
61 ClientIncidentReport_IncidentData* payload(); 71 ClientIncidentReport_IncidentData* payload();
62 const ClientIncidentReport_IncidentData* payload() const; 72 const ClientIncidentReport_IncidentData* payload() const;
63 73
64 private: 74 private:
65 scoped_ptr<ClientIncidentReport_IncidentData> payload_; 75 scoped_ptr<ClientIncidentReport_IncidentData> payload_;
66 76
67 DISALLOW_COPY_AND_ASSIGN(Incident); 77 DISALLOW_COPY_AND_ASSIGN(Incident);
68 }; 78 };
69 79
70 } // namespace safe_browsing 80 } // namespace safe_browsing
71 81
72 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_INCIDENT_H_ 82 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_INCIDENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698