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

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

Issue 2381963003: Revert of Small: Start checking URLs using PVer4. Verdict not returned to client yet. (Closed)
Patch Set: Created 4 years, 2 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 10 matching lines...) Expand all
21 using content::ResourceType; 21 using content::ResourceType;
22 22
23 namespace safe_browsing { 23 namespace safe_browsing {
24 24
25 typedef unsigned ThreatSeverity; 25 typedef unsigned ThreatSeverity;
26 26
27 // Manages the local, on-disk database of updates downloaded from the 27 // Manages the local, on-disk database of updates downloaded from the
28 // SafeBrowsing service and interfaces with the protocol manager. 28 // SafeBrowsing service and interfaces with the protocol manager.
29 class V4LocalDatabaseManager : public SafeBrowsingDatabaseManager { 29 class V4LocalDatabaseManager : public SafeBrowsingDatabaseManager {
30 public: 30 public:
31 // Create and return an instance of V4LocalDatabaseManager, if Finch trial 31 enum class ClientCallbackType {
32 // allows it; nullptr otherwise. 32 // This represents the case when we're trying to determine if a URL is
33 static scoped_refptr<V4LocalDatabaseManager> Create( 33 // unsafe from the following perspectives: Malware, Phishing, UwS.
34 const base::FilePath& base_path); 34 CHECK_BROWSE_URL = 0,
35
36 // This should always be the last value.
37 CHECK_MAX
38 };
39
40 // Construct V4LocalDatabaseManager.
41 // Must be initialized by calling StartOnIOThread() before using.
42 V4LocalDatabaseManager(const base::FilePath& base_path);
35 43
36 // 44 //
37 // SafeBrowsingDatabaseManager implementation 45 // SafeBrowsingDatabaseManager implementation
38 // 46 //
39 47
40 void CancelCheck(Client* client) override; 48 void CancelCheck(Client* client) override;
41 bool CanCheckResourceType(content::ResourceType resource_type) const override; 49 bool CanCheckResourceType(content::ResourceType resource_type) const override;
42 bool CanCheckUrl(const GURL& url) const override; 50 bool CanCheckUrl(const GURL& url) const override;
43 bool ChecksAreAlwaysAsync() const override; 51 bool ChecksAreAlwaysAsync() const override;
44 bool CheckBrowseUrl(const GURL& url, Client* client) override; 52 bool CheckBrowseUrl(const GURL& url, Client* client) override;
(...skipping 14 matching lines...) Expand all
59 bool IsSupported() const override; 67 bool IsSupported() const override;
60 void StartOnIOThread(net::URLRequestContextGetter* request_context_getter, 68 void StartOnIOThread(net::URLRequestContextGetter* request_context_getter,
61 const V4ProtocolConfig& config) override; 69 const V4ProtocolConfig& config) override;
62 void StopOnIOThread(bool shutdown) override; 70 void StopOnIOThread(bool shutdown) override;
63 71
64 // 72 //
65 // End: SafeBrowsingDatabaseManager implementation 73 // End: SafeBrowsingDatabaseManager implementation
66 // 74 //
67 75
68 protected: 76 protected:
69 // Construct V4LocalDatabaseManager.
70 // Must be initialized by calling StartOnIOThread() before using.
71 V4LocalDatabaseManager(const base::FilePath& base_path);
72
73 enum class ClientCallbackType {
74 // This represents the case when we're trying to determine if a URL is
75 // unsafe from the following perspectives: Malware, Phishing, UwS.
76 CHECK_BROWSE_URL = 0,
77
78 // This should always be the last value.
79 CHECK_MAX
80 };
81
82 // The information we need to process a URL safety reputation request and 77 // The information we need to process a URL safety reputation request and
83 // respond to the SafeBrowsing client that asked for it. 78 // respond to the SafeBrowsing client that asked for it.
84 // TODO(vakh): In its current form, it only includes information for 79 // TODO(vakh): In its current form, it only includes information for
85 // |CheckBrowseUrl| method. Extend it to serve other methods on |client|. 80 // |CheckBrowseUrl| method. Extend it to serve other methods on |client|.
86 struct PendingCheck { 81 struct PendingCheck {
87 PendingCheck(Client* client, 82 PendingCheck(Client* client,
88 ClientCallbackType client_callback_type, 83 ClientCallbackType client_callback_type,
89 const StoresToCheck& stores_to_check, 84 const StoresToCheck& stores_to_check,
90 const GURL& url); 85 const GURL& url);
91 86
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 // The protocol manager that downloads the hash prefix updates. 222 // The protocol manager that downloads the hash prefix updates.
228 std::unique_ptr<V4UpdateProtocolManager> v4_update_protocol_manager_; 223 std::unique_ptr<V4UpdateProtocolManager> v4_update_protocol_manager_;
229 224
230 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>; 225 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>;
231 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager); 226 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager);
232 }; // class V4LocalDatabaseManager 227 }; // class V4LocalDatabaseManager
233 228
234 } // namespace safe_browsing 229 } // namespace safe_browsing
235 230
236 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ 231 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_
OLDNEW
« no previous file with comments | « components/safe_browsing_db/v4_feature_list.cc ('k') | components/safe_browsing_db/v4_local_database_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698