| 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_THREAT_DETAILS_CACHE_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_THREAT_DETAILS_CACHE_H_ |
| 6 #define CHROME_BROWSER_SAFE_BROWSING_THREAT_DETAILS_CACHE_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_THREAT_DETAILS_CACHE_H_ |
| 7 | 7 |
| 8 // A class that gets threat details from the HTTP Cache. | 8 // A class that gets threat details from the HTTP Cache. |
| 9 // An instance of this class is generated by ThreatDetails. | 9 // An instance of this class is generated by ThreatDetails. |
| 10 | 10 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // whole time, we are modifying its state (see above). | 74 // whole time, we are modifying its state (see above). |
| 75 base::Closure callback_; | 75 base::Closure callback_; |
| 76 | 76 |
| 77 // Set to true as soon as StartCacheCollection is called. | 77 // Set to true as soon as StartCacheCollection is called. |
| 78 bool has_started_; | 78 bool has_started_; |
| 79 | 79 |
| 80 // Used to get a pointer to the current request context. | 80 // Used to get a pointer to the current request context. |
| 81 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 81 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
| 82 | 82 |
| 83 // The current URLFetcher. | 83 // The current URLFetcher. |
| 84 scoped_ptr<net::URLFetcher> current_fetch_; | 84 std::unique_ptr<net::URLFetcher> current_fetch_; |
| 85 | 85 |
| 86 // Returns the resource from resources_ that corresponds to |url| | 86 // Returns the resource from resources_ that corresponds to |url| |
| 87 ClientSafeBrowsingReportRequest::Resource* GetResource( | 87 ClientSafeBrowsingReportRequest::Resource* GetResource( |
| 88 const GURL& url); | 88 const GURL& url); |
| 89 | 89 |
| 90 // Creates a new URLFetcher and starts it. | 90 // Creates a new URLFetcher and starts it. |
| 91 void OpenEntry(); | 91 void OpenEntry(); |
| 92 | 92 |
| 93 // Read the HTTP response from |source| and add it to |pb_resource|. | 93 // Read the HTTP response from |source| and add it to |pb_resource|. |
| 94 void ReadResponse( | 94 void ReadResponse( |
| 95 ClientSafeBrowsingReportRequest::Resource* pb_resource, | 95 ClientSafeBrowsingReportRequest::Resource* pb_resource, |
| 96 const net::URLFetcher* source); | 96 const net::URLFetcher* source); |
| 97 | 97 |
| 98 // Read the body |data| and add it to |pb_resource|. | 98 // Read the body |data| and add it to |pb_resource|. |
| 99 void ReadData( | 99 void ReadData( |
| 100 ClientSafeBrowsingReportRequest::Resource* pb_resource, | 100 ClientSafeBrowsingReportRequest::Resource* pb_resource, |
| 101 const std::string& data); | 101 const std::string& data); |
| 102 | 102 |
| 103 // Called when we are done. | 103 // Called when we are done. |
| 104 void AllDone(bool success); | 104 void AllDone(bool success); |
| 105 | 105 |
| 106 // Advances to the next entry in resources_it_. | 106 // Advances to the next entry in resources_it_. |
| 107 void AdvanceEntry(); | 107 void AdvanceEntry(); |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 } // namespace safe_browsing | 110 } // namespace safe_browsing |
| 111 | 111 |
| 112 #endif // CHROME_BROWSER_SAFE_BROWSING_THREAT_DETAILS_CACHE_H_ | 112 #endif // CHROME_BROWSER_SAFE_BROWSING_THREAT_DETAILS_CACHE_H_ |
| OLD | NEW |