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

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

Issue 2742913002: PVer4: Filter out the safe crxs before calling OnCheckExtensionsResult (Closed)
Patch Set: Created 3 years, 9 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_LOCAL_DATABASE_MANAGER_H_ 5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_
6 #define COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_
7 7
8 // A class that provides the interface between the SafeBrowsing protocol manager 8 // A class that provides the interface between the SafeBrowsing protocol manager
9 // and database that holds the downloaded updates. 9 // and database that holds the downloaded updates.
10 10
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 ~PendingCheck(); 128 ~PendingCheck();
129 129
130 // The SafeBrowsing client that's waiting for the safe/unsafe verdict. 130 // The SafeBrowsing client that's waiting for the safe/unsafe verdict.
131 Client* client; 131 Client* client;
132 132
133 // Determines which funtion from the |client| needs to be called once we 133 // Determines which funtion from the |client| needs to be called once we
134 // know whether the URL in |url| is safe or unsafe. 134 // know whether the URL in |url| is safe or unsafe.
135 const ClientCallbackType client_callback_type; 135 const ClientCallbackType client_callback_type;
136 136
137 // The threat verdict for the URL being checked. 137 // The most severe threat verdict for the URLs/hashes being checked.
138 SBThreatType result_threat_type; 138 SBThreatType most_severe_threat_type;
139 139
140 // When the check was sent to the SafeBrowsing service. Used to record the 140 // When the check was sent to the SafeBrowsing service. Used to record the
141 // time it takes to get the uncached full hashes from the service (or a 141 // time it takes to get the uncached full hashes from the service (or a
142 // cached full hash response). 142 // cached full hash response).
143 base::TimeTicks full_hash_check_start; 143 base::TimeTicks full_hash_check_start;
144 144
145 // The SafeBrowsing lists to check hash prefixes in. 145 // The SafeBrowsing lists to check hash prefixes in.
146 const StoresToCheck stores_to_check; 146 const StoresToCheck stores_to_check;
147 147
148 // The URLs that are being checked for being unsafe. The size of exactly 148 // The URLs that are being checked for being unsafe. The size of exactly
149 // one of |full_hashes| and |urls| should be greater than 0. 149 // one of |full_hashes| and |urls| should be greater than 0.
150 const std::vector<GURL> urls; 150 const std::vector<GURL> urls;
151 151
152 // The full hashes that are being checked for being safe. The size of 152 // The full hashes that are being checked for being safe.
153 // exactly one of |full_hashes| and |urls| should be greater than 0.
154 std::vector<FullHash> full_hashes; 153 std::vector<FullHash> full_hashes;
155 154
155 // The most severe SBThreatType for each full hash in |full_hashes|. The
156 // length of |full_hash_threat_type| must always match |full_hashes|.
157 std::vector<SBThreatType> full_hash_threat_types;
158
156 // The metadata associated with the full hash of the severest match found 159 // The metadata associated with the full hash of the severest match found
157 // for that URL. 160 // for that URL.
158 ThreatMetadata url_metadata; 161 ThreatMetadata url_metadata;
159 162
160 // The full hash that matched for a blacklisted resource URL. Used only for 163 // The full hash that matched for a blacklisted resource URL. Used only for
161 // |CheckResourceUrl| case. 164 // |CheckResourceUrl| case.
162 FullHash matching_full_hash; 165 FullHash matching_full_hash;
163 }; 166 };
164 167
165 typedef std::vector<std::unique_ptr<PendingCheck>> QueuedChecks; 168 typedef std::vector<std::unique_ptr<PendingCheck>> QueuedChecks;
(...skipping 23 matching lines...) Expand all
189 192
190 // Called when the database has been updated and schedules the next update. 193 // Called when the database has been updated and schedules the next update.
191 void DatabaseUpdated(); 194 void DatabaseUpdated();
192 195
193 // Identifies the prefixes and the store they matched in, for a given |check|. 196 // Identifies the prefixes and the store they matched in, for a given |check|.
194 // Returns true if one or more hash prefix matches are found; false otherwise. 197 // Returns true if one or more hash prefix matches are found; false otherwise.
195 bool GetPrefixMatches( 198 bool GetPrefixMatches(
196 const std::unique_ptr<PendingCheck>& check, 199 const std::unique_ptr<PendingCheck>& check,
197 FullHashToStoreAndHashPrefixesMap* full_hash_to_store_and_hash_prefixes); 200 FullHashToStoreAndHashPrefixesMap* full_hash_to_store_and_hash_prefixes);
198 201
199 // Finds the most severe |SBThreatType| and the corresponding |metadata|, and 202 // Goes over the |full_hash_infos| and stores the most severe SBThreatType in
200 // |matching_full_hash| from |full_hash_infos|. 203 // |most_severe_threat_type|, the corresponding metadata in |metadata|, and
204 // the matching full hash in |matching_full_hash|. Also, updates in
205 // |full_hash_threat_types|, the threat type for each full hash in
206 // |full_hashes|.
201 void GetSeverestThreatTypeAndMetadata( 207 void GetSeverestThreatTypeAndMetadata(
202 SBThreatType* result_threat_type, 208 const std::vector<FullHashInfo>& full_hash_infos,
209 const std::vector<FullHash>& full_hashes,
210 std::vector<SBThreatType>* full_hash_threat_types,
211 SBThreatType* most_severe_threat_type,
203 ThreatMetadata* metadata, 212 ThreatMetadata* metadata,
204 FullHash* matching_full_hash, 213 FullHash* matching_full_hash);
205 const std::vector<FullHashInfo>& full_hash_infos);
206 214
207 // Returns the SBThreatType for a given ListIdentifier. 215 // Returns the SBThreatType for a given ListIdentifier.
208 SBThreatType GetSBThreatTypeForList(const ListIdentifier& list_id); 216 SBThreatType GetSBThreatTypeForList(const ListIdentifier& list_id);
209 217
210 // Queues the check for async response if the database isn't ready yet. 218 // Queues the check for async response if the database isn't ready yet.
211 // If the database is ready, checks the database for prefix matches and 219 // If the database is ready, checks the database for prefix matches and
212 // returns true immediately if there's no match. If a match is found, it 220 // returns true immediately if there's no match. If a match is found, it
213 // schedules a task to perform full hash check and returns false. 221 // schedules a task to perform full hash check and returns false.
214 bool HandleCheck(std::unique_ptr<PendingCheck> check); 222 bool HandleCheck(std::unique_ptr<PendingCheck> check);
215 223
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 310
303 base::WeakPtrFactory<V4LocalDatabaseManager> weak_factory_; 311 base::WeakPtrFactory<V4LocalDatabaseManager> weak_factory_;
304 312
305 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>; 313 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>;
306 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager); 314 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager);
307 }; // class V4LocalDatabaseManager 315 }; // class V4LocalDatabaseManager
308 316
309 } // namespace safe_browsing 317 } // namespace safe_browsing
310 318
311 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ 319 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698