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

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

Issue 2371043003: Small: Start checking URLs using PVer4. Verdict not returned to client yet. (Closed)
Patch Set: feature_list file for v4. Add V4Parallel feature. 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 enum class ClientCallbackType { 31 enum class ClientCallbackType {
Nathan Parker 2016/09/28 22:25:55 (unrelated nit: Does ClientCallbackType need to be
vakh (use Gerrit instead) 2016/09/28 23:00:01 No. Made protected.
32 // This represents the case when we're trying to determine if a URL is 32 // This represents the case when we're trying to determine if a URL is
33 // unsafe from the following perspectives: Malware, Phishing, UwS. 33 // unsafe from the following perspectives: Malware, Phishing, UwS.
34 CHECK_BROWSE_URL = 0, 34 CHECK_BROWSE_URL = 0,
35 35
36 // This should always be the last value. 36 // This should always be the last value.
37 CHECK_MAX 37 CHECK_MAX
38 }; 38 };
39 39
40 // Construct V4LocalDatabaseManager. 40 // Create and return an instance of V4LocalDatabaseManager, if Finch trial
41 // Must be initialized by calling StartOnIOThread() before using. 41 // allows it; nullptr otherwise.
42 V4LocalDatabaseManager(const base::FilePath& base_path); 42 static V4LocalDatabaseManager* Create(const base::FilePath& base_path);
Nathan Parker 2016/09/28 22:25:55 return a unique_ptr
vakh (use Gerrit instead) 2016/09/28 23:00:02 It looks like the destructor of the class needs to
Nathan Parker 2016/09/28 23:50:14 Ah yes, it's a base::RefCountedThreadSafe<> decend
43 43
44 // 44 //
45 // SafeBrowsingDatabaseManager implementation 45 // SafeBrowsingDatabaseManager implementation
46 // 46 //
47 47
48 void CancelCheck(Client* client) override; 48 void CancelCheck(Client* client) override;
49 bool CanCheckResourceType(content::ResourceType resource_type) const override; 49 bool CanCheckResourceType(content::ResourceType resource_type) const override;
50 bool CanCheckUrl(const GURL& url) const override; 50 bool CanCheckUrl(const GURL& url) const override;
51 bool ChecksAreAlwaysAsync() const override; 51 bool ChecksAreAlwaysAsync() const override;
52 bool CheckBrowseUrl(const GURL& url, Client* client) override; 52 bool CheckBrowseUrl(const GURL& url, Client* client) override;
(...skipping 14 matching lines...) Expand all
67 bool IsSupported() const override; 67 bool IsSupported() const override;
68 void StartOnIOThread(net::URLRequestContextGetter* request_context_getter, 68 void StartOnIOThread(net::URLRequestContextGetter* request_context_getter,
69 const V4ProtocolConfig& config) override; 69 const V4ProtocolConfig& config) override;
70 void StopOnIOThread(bool shutdown) override; 70 void StopOnIOThread(bool shutdown) override;
71 71
72 // 72 //
73 // End: SafeBrowsingDatabaseManager implementation 73 // End: SafeBrowsingDatabaseManager implementation
74 // 74 //
75 75
76 protected: 76 protected:
77 // Construct V4LocalDatabaseManager.
78 // Must be initialized by calling StartOnIOThread() before using.
79 V4LocalDatabaseManager(const base::FilePath& base_path);
80
77 // The information we need to process a URL safety reputation request and 81 // The information we need to process a URL safety reputation request and
78 // respond to the SafeBrowsing client that asked for it. 82 // respond to the SafeBrowsing client that asked for it.
79 // TODO(vakh): In its current form, it only includes information for 83 // TODO(vakh): In its current form, it only includes information for
80 // |CheckBrowseUrl| method. Extend it to serve other methods on |client|. 84 // |CheckBrowseUrl| method. Extend it to serve other methods on |client|.
81 struct PendingCheck { 85 struct PendingCheck {
82 PendingCheck(Client* client, 86 PendingCheck(Client* client,
83 ClientCallbackType client_callback_type, 87 ClientCallbackType client_callback_type,
84 const StoresToCheck& stores_to_check, 88 const StoresToCheck& stores_to_check,
85 const GURL& url); 89 const GURL& url);
86 90
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 // The protocol manager that downloads the hash prefix updates. 226 // The protocol manager that downloads the hash prefix updates.
223 std::unique_ptr<V4UpdateProtocolManager> v4_update_protocol_manager_; 227 std::unique_ptr<V4UpdateProtocolManager> v4_update_protocol_manager_;
224 228
225 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>; 229 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>;
226 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager); 230 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager);
227 }; // class V4LocalDatabaseManager 231 }; // class V4LocalDatabaseManager
228 232
229 } // namespace safe_browsing 233 } // namespace safe_browsing
230 234
231 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ 235 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698