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

Side by Side Diff: chrome/browser/safe_browsing/local_database_manager.h

Issue 1673733002: Support new Safe Browsing list "goog-badresource-shavar" in SafeBrowsingDatabase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Post-merge test fix 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Safe Browsing Database Manager implementation that manages a local 5 // Safe Browsing Database Manager implementation that manages a local
6 // database. This is used by Desktop Chromium. 6 // database. This is used by Desktop Chromium.
7 7
8 #ifndef CHROME_BROWSER_SAFE_BROWSING_LOCAL_DATABASE_MANAGER_H_ 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_LOCAL_DATABASE_MANAGER_H_
9 #define CHROME_BROWSER_SAFE_BROWSING_LOCAL_DATABASE_MANAGER_H_ 9 #define CHROME_BROWSER_SAFE_BROWSING_LOCAL_DATABASE_MANAGER_H_
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 SafeBrowsingCheck(const std::vector<GURL>& urls, 59 SafeBrowsingCheck(const std::vector<GURL>& urls,
60 const std::vector<SBFullHash>& full_hashes, 60 const std::vector<SBFullHash>& full_hashes,
61 Client* client, 61 Client* client,
62 ListType check_type, 62 ListType check_type,
63 const std::vector<SBThreatType>& expected_threats); 63 const std::vector<SBThreatType>& expected_threats);
64 ~SafeBrowsingCheck(); 64 ~SafeBrowsingCheck();
65 65
66 // Either |urls| or |full_hashes| is used to lookup database. |*_results| 66 // Either |urls| or |full_hashes| is used to lookup database. |*_results|
67 // are parallel vectors containing the results. They are initialized to 67 // are parallel vectors containing the results. They are initialized to
68 // contain SB_THREAT_TYPE_SAFE. 68 // contain SB_THREAT_TYPE_SAFE.
69 // |url_hit_hash| and |url_metadata| are parallel vectors containing full
70 // hash and metadata of a database record provided the result. They are
71 // initialized to be empty strings.
69 std::vector<GURL> urls; 72 std::vector<GURL> urls;
70 std::vector<SBThreatType> url_results; 73 std::vector<SBThreatType> url_results;
71 std::vector<std::string> url_metadata; 74 std::vector<std::string> url_metadata;
75 std::vector<std::string> url_hit_hash;
72 std::vector<SBFullHash> full_hashes; 76 std::vector<SBFullHash> full_hashes;
73 std::vector<SBThreatType> full_hash_results; 77 std::vector<SBThreatType> full_hash_results;
74 78
75 SafeBrowsingDatabaseManager::Client* client; 79 SafeBrowsingDatabaseManager::Client* client;
76 bool is_extended_reporting; 80 bool is_extended_reporting;
77 bool need_get_hash; 81 bool need_get_hash;
78 base::TimeTicks start; // When check was sent to SB service. 82 base::TimeTicks start; // When check was sent to SB service.
79 ListType check_type; // See comment in constructor. 83 ListType check_type; // See comment in constructor.
80 std::vector<SBThreatType> expected_threats; 84 std::vector<SBThreatType> expected_threats;
81 std::vector<SBPrefix> prefix_hits; 85 std::vector<SBPrefix> prefix_hits;
(...skipping 26 matching lines...) Expand all
108 safe_browsing::ThreatSource GetThreatSource() const override; 112 safe_browsing::ThreatSource GetThreatSource() const override;
109 bool ChecksAreAlwaysAsync() const override; 113 bool ChecksAreAlwaysAsync() const override;
110 bool CanCheckResourceType(content::ResourceType resource_type) const override; 114 bool CanCheckResourceType(content::ResourceType resource_type) const override;
111 bool CanCheckUrl(const GURL& url) const override; 115 bool CanCheckUrl(const GURL& url) const override;
112 116
113 bool CheckBrowseUrl(const GURL& url, Client* client) override; 117 bool CheckBrowseUrl(const GURL& url, Client* client) override;
114 bool CheckDownloadUrl(const std::vector<GURL>& url_chain, 118 bool CheckDownloadUrl(const std::vector<GURL>& url_chain,
115 Client* client) override; 119 Client* client) override;
116 bool CheckExtensionIDs(const std::set<std::string>& extension_ids, 120 bool CheckExtensionIDs(const std::set<std::string>& extension_ids,
117 Client* client) override; 121 Client* client) override;
122 bool CheckResourceUrl(const GURL& url, Client* client) override;
118 bool MatchCsdWhitelistUrl(const GURL& url) override; 123 bool MatchCsdWhitelistUrl(const GURL& url) override;
119 bool MatchMalwareIP(const std::string& ip_address) override; 124 bool MatchMalwareIP(const std::string& ip_address) override;
120 bool MatchDownloadWhitelistUrl(const GURL& url) override; 125 bool MatchDownloadWhitelistUrl(const GURL& url) override;
121 bool MatchDownloadWhitelistString(const std::string& str) override; 126 bool MatchDownloadWhitelistString(const std::string& str) override;
122 bool MatchInclusionWhitelistUrl(const GURL& url) override; 127 bool MatchInclusionWhitelistUrl(const GURL& url) override;
123 bool MatchModuleWhitelistString(const std::string& str) override; 128 bool MatchModuleWhitelistString(const std::string& str) override;
124 bool IsMalwareKillSwitchOn() override; 129 bool IsMalwareKillSwitchOn() override;
125 bool IsCsdWhitelistKillSwitchOn() override; 130 bool IsCsdWhitelistKillSwitchOn() override;
126 void CancelCheck(Client* client) override; 131 void CancelCheck(Client* client) override;
127 void StartOnIOThread() override; 132 void StartOnIOThread() override;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 void TimeoutCallback(SafeBrowsingCheck* check); 284 void TimeoutCallback(SafeBrowsingCheck* check);
280 285
281 // Calls the Client's callback on IO thread after CheckDownloadUrl finishes. 286 // Calls the Client's callback on IO thread after CheckDownloadUrl finishes.
282 void OnAsyncCheckDone(SafeBrowsingCheck* check, 287 void OnAsyncCheckDone(SafeBrowsingCheck* check,
283 const std::vector<SBPrefix>& prefix_hits); 288 const std::vector<SBPrefix>& prefix_hits);
284 289
285 // Checks all extension ID hashes on |safe_browsing_task_runner_|. 290 // Checks all extension ID hashes on |safe_browsing_task_runner_|.
286 std::vector<SBPrefix> CheckExtensionIDsOnSBThread( 291 std::vector<SBPrefix> CheckExtensionIDsOnSBThread(
287 const std::vector<SBPrefix>& prefixes); 292 const std::vector<SBPrefix>& prefixes);
288 293
294 // Checks all resource URL hashes on |safe_browsing_task_runner_|.
295 std::vector<SBPrefix> CheckResourceUrlOnSBThread(
296 const std::vector<SBPrefix>& prefixes);
297
289 // Helper function that calls safe browsing client and cleans up |checks_|. 298 // Helper function that calls safe browsing client and cleans up |checks_|.
290 void SafeBrowsingCheckDone(SafeBrowsingCheck* check); 299 void SafeBrowsingCheckDone(SafeBrowsingCheck* check);
291 300
292 // Helper function to set |check| with default values and start a safe 301 // Helper function to set |check| with default values and start a safe
293 // browsing check with timeout of |timeout|. |task| will be called on 302 // browsing check with timeout of |timeout|. |task| will be called on
294 // success, otherwise TimeoutCallback will be called. 303 // success, otherwise TimeoutCallback will be called.
295 void StartSafeBrowsingCheck( 304 void StartSafeBrowsingCheck(
296 SafeBrowsingCheck* check, 305 SafeBrowsingCheck* check,
297 const base::Callback<std::vector<SBPrefix>(void)>& task); 306 const base::Callback<std::vector<SBPrefix>(void)>& task);
298 307
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 375
367 // Timeout to use for safe browsing checks. 376 // Timeout to use for safe browsing checks.
368 base::TimeDelta check_timeout_; 377 base::TimeDelta check_timeout_;
369 378
370 DISALLOW_COPY_AND_ASSIGN(LocalSafeBrowsingDatabaseManager); 379 DISALLOW_COPY_AND_ASSIGN(LocalSafeBrowsingDatabaseManager);
371 }; // class LocalSafeBrowsingDatabaseManager 380 }; // class LocalSafeBrowsingDatabaseManager
372 381
373 } // namespace safe_browsing 382 } // namespace safe_browsing
374 383
375 #endif // CHROME_BROWSER_SAFE_BROWSING_LOCAL_DATABASE_MANAGER_H_ 384 #endif // CHROME_BROWSER_SAFE_BROWSING_LOCAL_DATABASE_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/local_database_manager.cc » ('j') | components/safe_browsing_db/util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698