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

Side by Side Diff: chrome/browser/safe_browsing/remote_database_manager.h

Issue 1110723002: Split to SafeBrowsingDatabaseManager into Local* and Remote*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to review. Tweak comments and list initializer. Created 5 years, 7 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
(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 CHROME_BROWSER_SAFE_BROWSING_REMOTE_DATABASE_MANAGER_H_
9 #define CHROME_BROWSER_SAFE_BROWSING_REMOTE_DATABASE_MANAGER_H_
10
11 #include <set>
12 #include <string>
13 #include <vector>
14
15 #include "base/memory/ref_counted.h"
16 #include "base/memory/weak_ptr.h"
17 #include "chrome/browser/safe_browsing/android_safe_browsing_api_handler.h"
18 #include "chrome/browser/safe_browsing/database_manager.h"
19 #include "url/gurl.h"
20
21 // An implementation that proxies requests to a service outside of Chromium.
22 // Does not manage a local database.
23 class RemoteSafeBrowsingDatabaseManager : public SafeBrowsingDatabaseManager {
24 public:
25 // Construct RemoteSafeBrowsingDatabaseManager.
26 // Must be initialized by calling StartOnIOThread() before using.
27 RemoteSafeBrowsingDatabaseManager();
28
29 //
30 // SafeBrowsingDatabaseManager implementation
31 //
32
33 bool CanCheckUrl(const GURL& url) const override;
34 bool download_protection_enabled() const override;
35 bool CheckBrowseUrl(const GURL& url, Client* client) override;
36 void CancelCheck(Client* client) override;
37 void StartOnIOThread() override;
38 void StopOnIOThread(bool shutdown) override;
39
40 // These will fail with DCHECK() since their functionality isn't implemented.
41 // We may later add support for a subset of them.
42 bool CheckDownloadUrl(const std::vector<GURL>& url_chain,
43 Client* client) override;
44 bool CheckExtensionIDs(const std::set<std::string>& extension_ids,
45 Client* client) override;
46 bool MatchCsdWhitelistUrl(const GURL& url) override;
47 bool MatchMalwareIP(const std::string& ip_address) override;
48 bool MatchDownloadWhitelistUrl(const GURL& url) override;
49 bool MatchDownloadWhitelistString(const std::string& str) override;
50 bool MatchInclusionWhitelistUrl(const GURL& url) override;
51 bool IsMalwareKillSwitchOn() override;
52 bool IsCsdWhitelistKillSwitchOn() override;
53
54 //
55 // RemoteSafeBrowsingDatabaseManager implementation
56 //
57
58 private:
59 ~RemoteSafeBrowsingDatabaseManager() override;
60 class ClientRequest; // Per-request tracker.
61
62 // Requests currently outstanding. This owns the ptrs.
63 std::vector<ClientRequest*> current_requests_;
64 AndroidSafeBrowsingAPIHandler api_handler_;
65 bool enabled_;
66
67 friend class base::RefCountedThreadSafe<RemoteSafeBrowsingDatabaseManager>;
68 DISALLOW_COPY_AND_ASSIGN(RemoteSafeBrowsingDatabaseManager);
69 }; // class RemoteSafeBrowsingDatabaseManager
70
71 #endif // CHROME_BROWSER_SAFE_BROWSING_REMOTE_DATABASE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698