OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_H_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_H_ |
7 | 7 |
8 // A class that implements Chrome's interface with the SafeBrowsing protocol. | 8 // A class that implements Chrome's interface with the SafeBrowsing protocol. |
9 // See https://developers.google.com/safe-browsing/developers_guide_v2 for | 9 // See https://developers.google.com/safe-browsing/developers_guide_v2 for |
10 // protocol details. | 10 // protocol details. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 public: | 44 public: |
45 // FullHashCallback is invoked when GetFullHash completes. | 45 // FullHashCallback is invoked when GetFullHash completes. |
46 // Parameters: | 46 // Parameters: |
47 // - The vector of full hash results. If empty, indicates that there | 47 // - The vector of full hash results. If empty, indicates that there |
48 // were no matches, and that the resource is safe. | 48 // were no matches, and that the resource is safe. |
49 // - The cache lifetime of the result. A lifetime of 0 indicates the results | 49 // - The cache lifetime of the result. A lifetime of 0 indicates the results |
50 // should not be cached. | 50 // should not be cached. |
51 typedef base::Callback<void(const std::vector<SBFullHashResult>&, | 51 typedef base::Callback<void(const std::vector<SBFullHashResult>&, |
52 const base::TimeDelta&)> FullHashCallback; | 52 const base::TimeDelta&)> FullHashCallback; |
53 | 53 |
54 virtual ~SafeBrowsingProtocolManager(); | 54 ~SafeBrowsingProtocolManager() override; |
55 | 55 |
56 // Makes the passed |factory| the factory used to instantiate | 56 // Makes the passed |factory| the factory used to instantiate |
57 // a SafeBrowsingService. Useful for tests. | 57 // a SafeBrowsingService. Useful for tests. |
58 static void RegisterFactory(SBProtocolManagerFactory* factory) { | 58 static void RegisterFactory(SBProtocolManagerFactory* factory) { |
59 factory_ = factory; | 59 factory_ = factory; |
60 } | 60 } |
61 | 61 |
62 // Create an instance of the safe browsing protocol manager. | 62 // Create an instance of the safe browsing protocol manager. |
63 static SafeBrowsingProtocolManager* Create( | 63 static SafeBrowsingProtocolManager* Create( |
64 SafeBrowsingProtocolManagerDelegate* delegate, | 64 SafeBrowsingProtocolManagerDelegate* delegate, |
65 net::URLRequestContextGetter* request_context_getter, | 65 net::URLRequestContextGetter* request_context_getter, |
66 const SafeBrowsingProtocolConfig& config); | 66 const SafeBrowsingProtocolConfig& config); |
67 | 67 |
68 // Sets up the update schedule and internal state for making periodic requests | 68 // Sets up the update schedule and internal state for making periodic requests |
69 // of the Safebrowsing servers. | 69 // of the Safebrowsing servers. |
70 virtual void Initialize(); | 70 virtual void Initialize(); |
71 | 71 |
72 // net::URLFetcherDelegate interface. | 72 // net::URLFetcherDelegate interface. |
73 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; | 73 void OnURLFetchComplete(const net::URLFetcher* source) override; |
74 | 74 |
75 // Retrieve the full hash for a set of prefixes, and invoke the callback | 75 // Retrieve the full hash for a set of prefixes, and invoke the callback |
76 // argument when the results are retrieved. The callback may be invoked | 76 // argument when the results are retrieved. The callback may be invoked |
77 // synchronously. | 77 // synchronously. |
78 virtual void GetFullHash(const std::vector<SBPrefix>& prefixes, | 78 virtual void GetFullHash(const std::vector<SBPrefix>& prefixes, |
79 FullHashCallback callback, | 79 FullHashCallback callback, |
80 bool is_download); | 80 bool is_download); |
81 | 81 |
82 // Forces the start of next update after |interval| time. | 82 // Forces the start of next update after |interval| time. |
83 void ForceScheduleNextUpdate(base::TimeDelta interval); | 83 void ForceScheduleNextUpdate(base::TimeDelta interval); |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 virtual void AddChunks(const std::string& list, | 432 virtual void AddChunks(const std::string& list, |
433 scoped_ptr<ScopedVector<SBChunkData> > chunks, | 433 scoped_ptr<ScopedVector<SBChunkData> > chunks, |
434 AddChunksCallback callback) = 0; | 434 AddChunksCallback callback) = 0; |
435 | 435 |
436 // Delete chunks from the database. | 436 // Delete chunks from the database. |
437 virtual void DeleteChunks( | 437 virtual void DeleteChunks( |
438 scoped_ptr<std::vector<SBChunkDelete> > chunk_deletes) = 0; | 438 scoped_ptr<std::vector<SBChunkDelete> > chunk_deletes) = 0; |
439 }; | 439 }; |
440 | 440 |
441 #endif // CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_H_ | 441 #endif // CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_H_ |
OLD | NEW |