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

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

Issue 2629713002: [M56] Add the missing callback to client for CheckResourceUrl (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | components/safe_browsing_db/v4_local_database_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // one of |full_hashes| and |urls| should be greater than 0. 143 // one of |full_hashes| and |urls| should be greater than 0.
144 const std::vector<GURL> urls; 144 const std::vector<GURL> urls;
145 145
146 // The full hashes that are being checked for being safe. The size of 146 // The full hashes that are being checked for being safe. The size of
147 // exactly one of |full_hashes| and |urls| should be greater than 0. 147 // exactly one of |full_hashes| and |urls| should be greater than 0.
148 std::vector<FullHash> full_hashes; 148 std::vector<FullHash> full_hashes;
149 149
150 // The metadata associated with the full hash of the severest match found 150 // The metadata associated with the full hash of the severest match found
151 // for that URL. 151 // for that URL.
152 ThreatMetadata url_metadata; 152 ThreatMetadata url_metadata;
153
154 // The full hash that matched for a blacklisted resource URL. Used only for
155 // |CheckResourceUrl| case.
156 FullHash matching_full_hash;
153 }; 157 };
154 158
155 typedef std::vector<std::unique_ptr<PendingCheck>> QueuedChecks; 159 typedef std::vector<std::unique_ptr<PendingCheck>> QueuedChecks;
156 160
157 // The stores/lists to always get full hashes for, regardless of which store 161 // The stores/lists to always get full hashes for, regardless of which store
158 // the hash prefix matched. 162 // the hash prefix matched.
159 StoresToCheck GetStoresForFullHashRequests() override; 163 StoresToCheck GetStoresForFullHashRequests() override;
160 164
161 private: 165 private:
162 friend class V4LocalDatabaseManagerTest; 166 friend class V4LocalDatabaseManagerTest;
(...skipping 16 matching lines...) Expand all
179 183
180 // Called when the database has been updated and schedules the next update. 184 // Called when the database has been updated and schedules the next update.
181 void DatabaseUpdated(); 185 void DatabaseUpdated();
182 186
183 // Identifies the prefixes and the store they matched in, for a given |check|. 187 // Identifies the prefixes and the store they matched in, for a given |check|.
184 // Returns true if one or more hash prefix matches are found; false otherwise. 188 // Returns true if one or more hash prefix matches are found; false otherwise.
185 bool GetPrefixMatches( 189 bool GetPrefixMatches(
186 const std::unique_ptr<PendingCheck>& check, 190 const std::unique_ptr<PendingCheck>& check,
187 FullHashToStoreAndHashPrefixesMap* full_hash_to_store_and_hash_prefixes); 191 FullHashToStoreAndHashPrefixesMap* full_hash_to_store_and_hash_prefixes);
188 192
189 // Finds the most severe |SBThreatType| and the corresponding |metadata| from 193 // Finds the most severe |SBThreatType| and the corresponding |metadata|, and
190 // |full_hash_infos|. 194 // |matching_full_hash| from |full_hash_infos|.
191 void GetSeverestThreatTypeAndMetadata( 195 void GetSeverestThreatTypeAndMetadata(
192 SBThreatType* result_threat_type, 196 SBThreatType* result_threat_type,
193 ThreatMetadata* metadata, 197 ThreatMetadata* metadata,
198 FullHash* matching_full_hash,
194 const std::vector<FullHashInfo>& full_hash_infos); 199 const std::vector<FullHashInfo>& full_hash_infos);
195 200
196 // Returns the SBThreatType for a given ListIdentifier. 201 // Returns the SBThreatType for a given ListIdentifier.
197 SBThreatType GetSBThreatTypeForList(const ListIdentifier& list_id); 202 SBThreatType GetSBThreatTypeForList(const ListIdentifier& list_id);
198 203
199 // Queues the check for async response if the database isn't ready yet. 204 // Queues the check for async response if the database isn't ready yet.
200 // If the database is ready, checks the database for prefix matches and 205 // If the database is ready, checks the database for prefix matches and
201 // returns true immediately if there's no match. If a match is found, it 206 // returns true immediately if there's no match. If a match is found, it
202 // schedules a task to perform full hash check and returns false. 207 // schedules a task to perform full hash check and returns false.
203 bool HandleCheck(std::unique_ptr<PendingCheck> check); 208 bool HandleCheck(std::unique_ptr<PendingCheck> check);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 295
291 base::WeakPtrFactory<V4LocalDatabaseManager> weak_factory_; 296 base::WeakPtrFactory<V4LocalDatabaseManager> weak_factory_;
292 297
293 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>; 298 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>;
294 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager); 299 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager);
295 }; // class V4LocalDatabaseManager 300 }; // class V4LocalDatabaseManager
296 301
297 } // namespace safe_browsing 302 } // namespace safe_browsing
298 303
299 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ 304 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | components/safe_browsing_db/v4_local_database_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698