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

Side by Side Diff: components/safe_browsing_db/v4_protocol_manager_util.h

Issue 2103693002: SafeBrowsing PVer4: Send mutable response to the database and the stores (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@02_ReadFromDisk
Patch Set: Minor: Add the explicit keyword for UpdateListIdentifier constructor Created 4 years, 5 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 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 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_UTIL_H_ 5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_UTIL_H_
6 #define COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_UTIL_H_ 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_UTIL_H_
7 7
8 // A class that implements the stateless methods used by the GetHashUpdate and 8 // A class that implements the stateless methods used by the GetHashUpdate and
9 // GetFullHash stubby calls made by Chrome using the SafeBrowsing V4 protocol. 9 // GetFullHash stubby calls made by Chrome using the SafeBrowsing V4 protocol.
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // platform_type = WINDOWS, 51 // platform_type = WINDOWS,
52 // threat_entry_type = EXECUTABLE, 52 // threat_entry_type = EXECUTABLE,
53 // threat_type = MALWARE 53 // threat_type = MALWARE
54 struct UpdateListIdentifier { 54 struct UpdateListIdentifier {
55 public: 55 public:
56 PlatformType platform_type; 56 PlatformType platform_type;
57 ThreatEntryType threat_entry_type; 57 ThreatEntryType threat_entry_type;
58 ThreatType threat_type; 58 ThreatType threat_type;
59 59
60 UpdateListIdentifier(PlatformType, ThreatEntryType, ThreatType); 60 UpdateListIdentifier(PlatformType, ThreatEntryType, ThreatType);
61 UpdateListIdentifier(const ListUpdateResponse&); 61 explicit UpdateListIdentifier(const ListUpdateResponse&);
62 62
63 bool operator==(const UpdateListIdentifier& other) const; 63 bool operator==(const UpdateListIdentifier& other) const;
64 bool operator!=(const UpdateListIdentifier& other) const; 64 bool operator!=(const UpdateListIdentifier& other) const;
65 size_t hash() const; 65 size_t hash() const;
66 66
67 private: 67 private:
68 UpdateListIdentifier(); 68 UpdateListIdentifier();
69 }; 69 };
70 70
71 std::ostream& operator<<(std::ostream& os, const UpdateListIdentifier& id); 71 std::ostream& operator<<(std::ostream& os, const UpdateListIdentifier& id);
72 72
73 // The set of interesting lists and ASCII filenames for their hash prefix 73 // The set of interesting lists and ASCII filenames for their hash prefix
74 // stores. The stores are created inside the user-data directory. 74 // stores. The stores are created inside the user-data directory.
75 // For instance, the UpdateListIdentifier could be for URL expressions for UwS 75 // For instance, the UpdateListIdentifier could be for URL expressions for UwS
76 // on Windows platform, and the corresponding file on disk could be named: 76 // on Windows platform, and the corresponding file on disk could be named:
77 // "uws_win_url.store" 77 // "uws_win_url.store"
78 // TODO(vakh): Find the canonical place where these are defined and update the 78 // TODO(vakh): Find the canonical place where these are defined and update the
79 // comment to point to that place. 79 // comment to point to that place.
80 typedef base::hash_map<UpdateListIdentifier, std::string> StoreFileNameMap; 80 typedef base::hash_map<UpdateListIdentifier, std::string> StoreFileNameMap;
81 81
82 // Represents the state of each store. 82 // Represents the state of each store.
83 typedef base::hash_map<UpdateListIdentifier, std::string> StoreStateMap; 83 typedef base::hash_map<UpdateListIdentifier, std::string> StoreStateMap;
84 84
85 // Sever response, parsed in vector form.
86 typedef std::vector<std::unique_ptr<ListUpdateResponse>> ParsedServerResponse;
87
85 // Enumerate failures for histogramming purposes. DO NOT CHANGE THE 88 // Enumerate failures for histogramming purposes. DO NOT CHANGE THE
86 // ORDERING OF THESE VALUES. 89 // ORDERING OF THESE VALUES.
87 enum V4OperationResult { 90 enum V4OperationResult {
88 // 200 response code means that the server recognized the request. 91 // 200 response code means that the server recognized the request.
89 STATUS_200 = 0, 92 STATUS_200 = 0,
90 93
91 // Subset of successful responses where the response body wasn't parsable. 94 // Subset of successful responses where the response body wasn't parsable.
92 PARSE_ERROR = 1, 95 PARSE_ERROR = 1,
93 96
94 // Operation request failed (network error). 97 // Operation request failed (network error).
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 namespace std { 171 namespace std {
169 template <> 172 template <>
170 struct hash<safe_browsing::UpdateListIdentifier> { 173 struct hash<safe_browsing::UpdateListIdentifier> {
171 std::size_t operator()(const safe_browsing::UpdateListIdentifier& s) const { 174 std::size_t operator()(const safe_browsing::UpdateListIdentifier& s) const {
172 return s.hash(); 175 return s.hash();
173 } 176 }
174 }; 177 };
175 } 178 }
176 179
177 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_UTIL_H_ 180 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_PROTOCOL_MANAGER_UTIL_H_
OLDNEW
« no previous file with comments | « components/safe_browsing_db/v4_local_database_manager.cc ('k') | components/safe_browsing_db/v4_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698