Refactor WebsiteSettings to operate on a SecurityInfo
[chromium-blink-merge.git] / chrome / browser / safe_browsing / remote_database_manager.h
blob329a77de8eebc096f0c1ca1f67f2ef0de5456a68
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.
8 #ifndef CHROME_BROWSER_SAFE_BROWSING_REMOTE_DATABASE_MANAGER_H_
9 #define CHROME_BROWSER_SAFE_BROWSING_REMOTE_DATABASE_MANAGER_H_
11 #include <set>
12 #include <string>
13 #include <vector>
15 #include "base/memory/ref_counted.h"
16 #include "base/memory/weak_ptr.h"
17 #include "chrome/browser/safe_browsing/database_manager.h"
18 #include "url/gurl.h"
20 // An implementation that proxies requests to a service outside of Chromium.
21 // Does not manage a local database.
22 class RemoteSafeBrowsingDatabaseManager : public SafeBrowsingDatabaseManager {
23 public:
24 // Construct RemoteSafeBrowsingDatabaseManager.
25 // Must be initialized by calling StartOnIOThread() before using.
26 RemoteSafeBrowsingDatabaseManager();
29 // SafeBrowsingDatabaseManager implementation
32 bool CanCheckUrl(const GURL& url) const override;
33 bool download_protection_enabled() const override;
34 bool CheckBrowseUrl(const GURL& url, Client* client) override;
35 void CancelCheck(Client* client) override;
36 void StartOnIOThread() override;
37 void StopOnIOThread(bool shutdown) override;
39 // These will fail with DCHECK() since their functionality isn't implemented.
40 // We may later add support for a subset of them.
41 bool CheckDownloadUrl(const std::vector<GURL>& url_chain,
42 Client* client) override;
43 bool CheckExtensionIDs(const std::set<std::string>& extension_ids,
44 Client* client) override;
45 bool MatchCsdWhitelistUrl(const GURL& url) override;
46 bool MatchMalwareIP(const std::string& ip_address) override;
47 bool MatchDownloadWhitelistUrl(const GURL& url) override;
48 bool MatchDownloadWhitelistString(const std::string& str) override;
49 bool MatchInclusionWhitelistUrl(const GURL& url) override;
50 bool IsMalwareKillSwitchOn() override;
51 bool IsCsdWhitelistKillSwitchOn() override;
54 // RemoteSafeBrowsingDatabaseManager implementation
57 private:
58 ~RemoteSafeBrowsingDatabaseManager() override;
59 class ClientRequest; // Per-request tracker.
61 // Requests currently outstanding. This owns the ptrs.
62 std::vector<ClientRequest*> current_requests_;
63 bool enabled_;
65 friend class base::RefCountedThreadSafe<RemoteSafeBrowsingDatabaseManager>;
66 DISALLOW_COPY_AND_ASSIGN(RemoteSafeBrowsingDatabaseManager);
67 }; // class RemoteSafeBrowsingDatabaseManager
69 #endif // CHROME_BROWSER_SAFE_BROWSING_REMOTE_DATABASE_MANAGER_H_