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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 class SBProtocolManagerFactory; | 52 class SBProtocolManagerFactory; |
53 class SafeBrowsingProtocolManagerDelegate; | 53 class SafeBrowsingProtocolManagerDelegate; |
54 | 54 |
55 class SafeBrowsingProtocolManager : public net::URLFetcherDelegate, | 55 class SafeBrowsingProtocolManager : public net::URLFetcherDelegate, |
56 public base::NonThreadSafe { | 56 public base::NonThreadSafe { |
57 public: | 57 public: |
58 // FullHashCallback is invoked when GetFullHash completes. | 58 // FullHashCallback is invoked when GetFullHash completes. |
59 // Parameters: | 59 // Parameters: |
60 // - The vector of full hash results. If empty, indicates that there | 60 // - The vector of full hash results. If empty, indicates that there |
61 // were no matches, and that the resource is safe. | 61 // were no matches, and that the resource is safe. |
62 // - Whether the result can be cached. This may not be the case when | 62 // - The cache lifetime of the result. A lifetime of 0 indicates the results |
63 // the result did not come from the SB server, for example. | 63 // should not be cached. |
64 typedef base::Callback<void(const std::vector<SBFullHashResult>&, | 64 typedef base::Callback<void(const std::vector<SBFullHashResult>&, |
65 bool)> FullHashCallback; | 65 const base::TimeDelta&)> FullHashCallback; |
66 | 66 |
67 virtual ~SafeBrowsingProtocolManager(); | 67 virtual ~SafeBrowsingProtocolManager(); |
68 | 68 |
69 // Makes the passed |factory| the factory used to instantiate | 69 // Makes the passed |factory| the factory used to instantiate |
70 // a SafeBrowsingService. Useful for tests. | 70 // a SafeBrowsingService. Useful for tests. |
71 static void RegisterFactory(SBProtocolManagerFactory* factory) { | 71 static void RegisterFactory(SBProtocolManagerFactory* factory) { |
72 factory_ = factory; | 72 factory_ = factory; |
73 } | 73 } |
74 | 74 |
75 // Create an instance of the safe browsing protocol manager. | 75 // Create an instance of the safe browsing protocol manager. |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 // call at a later time. | 423 // call at a later time. |
424 virtual void AddChunks(const std::string& list, SBChunkList* chunks, | 424 virtual void AddChunks(const std::string& list, SBChunkList* chunks, |
425 AddChunksCallback callback) = 0; | 425 AddChunksCallback callback) = 0; |
426 | 426 |
427 // Delete chunks from the database. | 427 // Delete chunks from the database. |
428 virtual void DeleteChunks( | 428 virtual void DeleteChunks( |
429 std::vector<SBChunkDelete>* delete_chunks) = 0; | 429 std::vector<SBChunkDelete>* delete_chunks) = 0; |
430 }; | 430 }; |
431 | 431 |
432 #endif // CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_H_ | 432 #endif // CHROME_BROWSER_SAFE_BROWSING_PROTOCOL_MANAGER_H_ |
OLD | NEW |