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 #include "chrome/browser/safe_browsing/protocol_manager.h" | 5 #include "chrome/browser/safe_browsing/protocol_manager.h" |
6 | 6 |
7 #ifndef NDEBUG | 7 #ifndef NDEBUG |
8 #include "base/base64.h" | 8 #include "base/base64.h" |
9 #endif | 9 #endif |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 176 |
177 // All SafeBrowsing request responses are handled here. | 177 // All SafeBrowsing request responses are handled here. |
178 // TODO(paulg): Clarify with the SafeBrowsing team whether a failed parse of a | 178 // TODO(paulg): Clarify with the SafeBrowsing team whether a failed parse of a |
179 // chunk should retry the download and parse of that chunk (and | 179 // chunk should retry the download and parse of that chunk (and |
180 // what back off / how many times to try), and if that effects the | 180 // what back off / how many times to try), and if that effects the |
181 // update back off. For now, a failed parse of the chunk means we | 181 // update back off. For now, a failed parse of the chunk means we |
182 // drop it. This isn't so bad because the next UPDATE_REQUEST we | 182 // drop it. This isn't so bad because the next UPDATE_REQUEST we |
183 // do will report all the chunks we have. If that chunk is still | 183 // do will report all the chunks we have. If that chunk is still |
184 // required, the SafeBrowsing servers will tell us to get it again. | 184 // required, the SafeBrowsing servers will tell us to get it again. |
185 void SafeBrowsingProtocolManager::OnURLFetchComplete( | 185 void SafeBrowsingProtocolManager::OnURLFetchComplete( |
186 const content::URLFetcher* source) { | 186 const net::URLFetcher* source) { |
187 scoped_ptr<const content::URLFetcher> fetcher; | 187 scoped_ptr<const net::URLFetcher> fetcher; |
188 bool parsed_ok = true; | 188 bool parsed_ok = true; |
189 bool must_back_off = false; // Reduce SafeBrowsing service query frequency. | 189 bool must_back_off = false; // Reduce SafeBrowsing service query frequency. |
190 | 190 |
191 // See if this is a safebrowsing report fetcher. We don't take any action for | 191 // See if this is a safebrowsing report fetcher. We don't take any action for |
192 // the response to those. | 192 // the response to those. |
193 std::set<const content::URLFetcher*>::iterator sit = | 193 std::set<const net::URLFetcher*>::iterator sit = |
194 safebrowsing_reports_.find(source); | 194 safebrowsing_reports_.find(source); |
195 if (sit != safebrowsing_reports_.end()) { | 195 if (sit != safebrowsing_reports_.end()) { |
196 const content::URLFetcher* report = *sit; | 196 const net::URLFetcher* report = *sit; |
197 safebrowsing_reports_.erase(sit); | 197 safebrowsing_reports_.erase(sit); |
198 delete report; | 198 delete report; |
199 return; | 199 return; |
200 } | 200 } |
201 | 201 |
202 HashRequests::iterator it = hash_requests_.find(source); | 202 HashRequests::iterator it = hash_requests_.find(source); |
203 if (it != hash_requests_.end()) { | 203 if (it != hash_requests_.end()) { |
204 // GetHash response. | 204 // GetHash response. |
205 fetcher.reset(it->first); | 205 fetcher.reset(it->first); |
206 SafeBrowsingService::SafeBrowsingCheck* check = it->second; | 206 SafeBrowsingService::SafeBrowsingCheck* check = it->second; |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 if (!additional_query_.empty()) { | 731 if (!additional_query_.empty()) { |
732 if (next_url.find("?") != std::string::npos) { | 732 if (next_url.find("?") != std::string::npos) { |
733 next_url.append("&"); | 733 next_url.append("&"); |
734 } else { | 734 } else { |
735 next_url.append("?"); | 735 next_url.append("?"); |
736 } | 736 } |
737 next_url.append(additional_query_); | 737 next_url.append(additional_query_); |
738 } | 738 } |
739 return GURL(next_url); | 739 return GURL(next_url); |
740 } | 740 } |
OLD | NEW |