| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 // | |
| 5 // Implementation of the SafeBrowsingDatabaseManager that sends URLs | |
| 6 // via IPC to a database that chromium doesn't manage locally. | |
| 7 | |
| 8 #ifndef COMPONENTS_SAFE_BROWSING_DB_REMOTE_DATABASE_MANAGER_H_ | |
| 9 #define COMPONENTS_SAFE_BROWSING_DB_REMOTE_DATABASE_MANAGER_H_ | |
| 10 | |
| 11 #include <set> | |
| 12 #include <string> | |
| 13 #include <vector> | |
| 14 | |
| 15 #include "base/macros.h" | |
| 16 #include "base/memory/ref_counted.h" | |
| 17 #include "base/memory/weak_ptr.h" | |
| 18 #include "components/safe_browsing_db/database_manager.h" | |
| 19 #include "url/gurl.h" | |
| 20 | |
| 21 namespace safe_browsing { | |
| 22 | |
| 23 // An implementation that proxies requests to a service outside of Chromium. | |
| 24 // Does not manage a local database. | |
| 25 class RemoteSafeBrowsingDatabaseManager : public SafeBrowsingDatabaseManager { | |
| 26 public: | |
| 27 // Construct RemoteSafeBrowsingDatabaseManager. | |
| 28 // Must be initialized by calling StartOnIOThread() before using. | |
| 29 RemoteSafeBrowsingDatabaseManager(); | |
| 30 | |
| 31 // | |
| 32 // SafeBrowsingDatabaseManager implementation | |
| 33 // | |
| 34 | |
| 35 bool IsSupported() const override; | |
| 36 safe_browsing::ThreatSource GetThreatSource() const override; | |
| 37 bool ChecksAreAlwaysAsync() const override; | |
| 38 bool CanCheckResourceType(content::ResourceType resource_type) const override; | |
| 39 bool CanCheckUrl(const GURL& url) const override; | |
| 40 bool download_protection_enabled() const override; | |
| 41 bool CheckBrowseUrl(const GURL& url, Client* client) override; | |
| 42 void CancelCheck(Client* client) override; | |
| 43 void StartOnIOThread() override; | |
| 44 void StopOnIOThread(bool shutdown) override; | |
| 45 | |
| 46 // These will fail with DCHECK() since their functionality isn't implemented. | |
| 47 // We may later add support for a subset of them. | |
| 48 bool CheckDownloadUrl(const std::vector<GURL>& url_chain, | |
| 49 Client* client) override; | |
| 50 bool CheckExtensionIDs(const std::set<std::string>& extension_ids, | |
| 51 Client* client) override; | |
| 52 bool MatchCsdWhitelistUrl(const GURL& url) override; | |
| 53 bool MatchMalwareIP(const std::string& ip_address) override; | |
| 54 bool MatchDownloadWhitelistUrl(const GURL& url) override; | |
| 55 bool MatchDownloadWhitelistString(const std::string& str) override; | |
| 56 bool MatchInclusionWhitelistUrl(const GURL& url) override; | |
| 57 bool IsMalwareKillSwitchOn() override; | |
| 58 bool IsCsdWhitelistKillSwitchOn() override; | |
| 59 | |
| 60 // | |
| 61 // RemoteSafeBrowsingDatabaseManager implementation | |
| 62 // | |
| 63 | |
| 64 private: | |
| 65 ~RemoteSafeBrowsingDatabaseManager() override; | |
| 66 class ClientRequest; // Per-request tracker. | |
| 67 | |
| 68 // Requests currently outstanding. This owns the ptrs. | |
| 69 std::vector<ClientRequest*> current_requests_; | |
| 70 bool enabled_; | |
| 71 | |
| 72 std::set<content::ResourceType> resource_types_to_check_; | |
| 73 | |
| 74 friend class base::RefCountedThreadSafe<RemoteSafeBrowsingDatabaseManager>; | |
| 75 DISALLOW_COPY_AND_ASSIGN(RemoteSafeBrowsingDatabaseManager); | |
| 76 }; // class RemoteSafeBrowsingDatabaseManager | |
| 77 | |
| 78 } // namespace safe_browsing | |
| 79 | |
| 80 #endif // COMPONENTS_SAFE_BROWSING_DB_REMOTE_DATABASE_MANAGER_H_ | |
| OLD | NEW |