| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/safe_browsing_db/v4_update_protocol_manager.h" | 5 #include "components/safe_browsing_db/v4_update_protocol_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/base64url.h" | 9 #include "base/base64url.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 const auto& state = entry.second; | 203 const auto& state = entry.second; |
| 204 ListUpdateRequest* list_update_request = request.add_list_update_requests(); | 204 ListUpdateRequest* list_update_request = request.add_list_update_requests(); |
| 205 list_update_request->set_platform_type(list_to_update.platform_type); | 205 list_update_request->set_platform_type(list_to_update.platform_type); |
| 206 list_update_request->set_threat_entry_type( | 206 list_update_request->set_threat_entry_type( |
| 207 list_to_update.threat_entry_type); | 207 list_to_update.threat_entry_type); |
| 208 list_update_request->set_threat_type(list_to_update.threat_type); | 208 list_update_request->set_threat_type(list_to_update.threat_type); |
| 209 | 209 |
| 210 if (!state.empty()) { | 210 if (!state.empty()) { |
| 211 list_update_request->set_state(state); | 211 list_update_request->set_state(state); |
| 212 } | 212 } |
| 213 |
| 214 // TODO(vakh): Accept other compression formats also. |
| 215 // See: https://bugs.chromium.org/p/chromium/issues/detail?id=624567 |
| 216 list_update_request->mutable_constraints()->add_supported_compressions(RAW); |
| 213 } | 217 } |
| 214 | 218 |
| 215 // Serialize and Base64 encode. | 219 // Serialize and Base64 encode. |
| 216 std::string req_data, req_base64; | 220 std::string req_data, req_base64; |
| 217 request.SerializeToString(&req_data); | 221 request.SerializeToString(&req_data); |
| 218 base::Base64UrlEncode(req_data, base::Base64UrlEncodePolicy::INCLUDE_PADDING, | 222 base::Base64UrlEncode(req_data, base::Base64UrlEncodePolicy::INCLUDE_PADDING, |
| 219 &req_base64); | 223 &req_base64); |
| 220 return req_base64; | 224 return req_base64; |
| 221 } | 225 } |
| 222 | 226 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 346 |
| 343 void V4UpdateProtocolManager::GetUpdateUrlAndHeaders( | 347 void V4UpdateProtocolManager::GetUpdateUrlAndHeaders( |
| 344 const std::string& req_base64, | 348 const std::string& req_base64, |
| 345 GURL* gurl, | 349 GURL* gurl, |
| 346 net::HttpRequestHeaders* headers) const { | 350 net::HttpRequestHeaders* headers) const { |
| 347 V4ProtocolManagerUtil::GetRequestUrlAndHeaders( | 351 V4ProtocolManagerUtil::GetRequestUrlAndHeaders( |
| 348 req_base64, "threatListUpdates:fetch", config_, gurl, headers); | 352 req_base64, "threatListUpdates:fetch", config_, gurl, headers); |
| 349 } | 353 } |
| 350 | 354 |
| 351 } // namespace safe_browsing | 355 } // namespace safe_browsing |
| OLD | NEW |