Chromium Code Reviews| Index: components/safe_browsing_db/database_manager.h |
| diff --git a/components/safe_browsing_db/database_manager.h b/components/safe_browsing_db/database_manager.h |
| index c2359f67b4b8c865d1a40f0af8930c3022ebfd4b..e21297a1b5d8b0dbe067a3870f16cecf33025a45 100644 |
| --- a/components/safe_browsing_db/database_manager.h |
| +++ b/components/safe_browsing_db/database_manager.h |
| @@ -174,10 +174,14 @@ class SafeBrowsingDatabaseManager |
| // are handled separately. To cancel an API check use CancelApiCheck. |
| virtual void CancelCheck(Client* client) = 0; |
| - // TODO(kcarattini): Add a CancelApiCheck method. |
| + // Called on the IO thread to cancel a pending API check if the result is no |
| + // longer needed. Returns true if the client was found and the check |
| + // successfully cancelled. |
| + virtual bool CancelApiCheck(Client* client); |
| // Called on the IO thread to check if the given url has blacklisted APIs. |
| - // "client" is called asynchronously with the result when it is ready. |
| + // "client" is called asynchronously with the result when it is ready. Clients |
| + // should wait for results before calling this method a second time. |
|
Nathan Parker
2016/04/15 23:27:35
We probably want a dcheck to enforce that.
kcarattini
2016/04/18 03:00:09
Done.
|
| // This method has the same implementation for both the local and remote |
| // database managers since it pings Safe Browsing servers directly without |
| // accessing the database at all. Returns true if we can synchronously |
| @@ -218,6 +222,13 @@ class SafeBrowsingDatabaseManager |
| HandleGetHashesWithApisResultsNoMatch); |
| FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseManagerTest, |
| HandleGetHashesWithApisResultsMatches); |
| + FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseManagerTest, |
| + CancelApiCheck); |
| + |
| + typedef std::set<std::shared_ptr<SafeBrowsingApiCheck> > CurrentApiChecks; |
| + |
| + // In-progress checks. |
| + CurrentApiChecks api_checks_; |
| // Created and destroyed via StartOnIOThread/StopOnIOThread. |
| V4GetHashProtocolManager* v4_get_hash_protocol_manager_; |