OLD | NEW |
---|---|
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 bool MatchCsdWhitelistUrl(const GURL& url) override; | 51 bool MatchCsdWhitelistUrl(const GURL& url) override; |
52 bool MatchMalwareIP(const std::string& ip_address) override; | 52 bool MatchMalwareIP(const std::string& ip_address) override; |
53 bool MatchDownloadWhitelistUrl(const GURL& url) override; | 53 bool MatchDownloadWhitelistUrl(const GURL& url) override; |
54 bool MatchDownloadWhitelistString(const std::string& str) override; | 54 bool MatchDownloadWhitelistString(const std::string& str) override; |
55 bool MatchModuleWhitelistString(const std::string& str) override; | 55 bool MatchModuleWhitelistString(const std::string& str) override; |
56 bool CheckResourceUrl(const GURL& url, Client* client) override; | 56 bool CheckResourceUrl(const GURL& url, Client* client) override; |
57 bool IsMalwareKillSwitchOn() override; | 57 bool IsMalwareKillSwitchOn() override; |
58 bool IsCsdWhitelistKillSwitchOn() override; | 58 bool IsCsdWhitelistKillSwitchOn() override; |
59 | 59 |
60 private: | 60 private: |
61 // Clients queued up for checking once the database is ready. | |
62 struct QueuedCheck { | |
Nathan Parker
2016/08/15 19:06:41
It'd be better to add queuing all at once in a sep
Scott Hess - ex-Googler
2016/08/15 20:57:39
I agree. The queued checks in the prior version f
vakh (use Gerrit instead)
2016/08/17 18:23:06
Done.
| |
63 QueuedCheck(const ListType check_type, | |
64 Client* client, | |
65 const GURL& url, | |
66 const std::vector<UpdateListIdentifier>& expected_threats, | |
67 const base::TimeTicks& start); | |
68 QueuedCheck(const QueuedCheck& other); | |
69 ~QueuedCheck(); | |
70 ListType check_type; | |
71 Client* client; | |
72 GURL url; | |
73 std::vector<UpdateListIdentifier> expected_threats; | |
74 base::TimeTicks start; // When check was queued. | |
75 }; | |
76 | |
77 private: | |
78 friend class V4LocalDatabaseManagerTest; | |
79 void SetTaskRunnerForTest( | |
80 const scoped_refptr<base::SequencedTaskRunner>& task_runner) { | |
81 task_runner_ = task_runner; | |
82 } | |
83 | |
61 ~V4LocalDatabaseManager() override; | 84 ~V4LocalDatabaseManager() override; |
62 | 85 |
63 // The callback called each time the protocol manager downloads updates | 86 // The callback called each time the protocol manager downloads updates |
64 // successfully. | 87 // successfully. |
65 void UpdateRequestCompleted( | 88 void UpdateRequestCompleted( |
66 std::unique_ptr<ParsedServerResponse> parsed_server_response); | 89 std::unique_ptr<ParsedServerResponse> parsed_server_response); |
67 | 90 |
68 void SetupUpdateProtocolManager( | 91 void SetupUpdateProtocolManager( |
69 net::URLRequestContextGetter* request_context_getter, | 92 net::URLRequestContextGetter* request_context_getter, |
70 const V4ProtocolConfig& config); | 93 const V4ProtocolConfig& config); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 // The sequenced task runner for running safe browsing database operations. | 125 // The sequenced task runner for running safe browsing database operations. |
103 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 126 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
104 | 127 |
105 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>; | 128 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>; |
106 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager); | 129 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager); |
107 }; // class V4LocalDatabaseManager | 130 }; // class V4LocalDatabaseManager |
108 | 131 |
109 } // namespace safe_browsing | 132 } // namespace safe_browsing |
110 | 133 |
111 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ | 134 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ |
OLD | NEW |