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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 fetcher->SetRequestContext(request_context_getter_); | 165 fetcher->SetRequestContext(request_context_getter_); |
166 fetcher->SetUploadData("text/plain", get_hash); | 166 fetcher->SetUploadData("text/plain", get_hash); |
167 fetcher->Start(); | 167 fetcher->Start(); |
168 } | 168 } |
169 | 169 |
170 void SafeBrowsingProtocolManager::GetNextUpdate() { | 170 void SafeBrowsingProtocolManager::GetNextUpdate() { |
171 if (!request_.get()) | 171 if (!request_.get()) |
172 IssueUpdateRequest(); | 172 IssueUpdateRequest(); |
173 } | 173 } |
174 | 174 |
175 // content::URLFetcherDelegate implementation ---------------------------------- | 175 // net::URLFetcherDelegate implementation ---------------------------------- |
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( |
(...skipping 545 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 |