| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 ListUpdateRequest* list_update_request = request.add_list_update_requests(); | 205 ListUpdateRequest* list_update_request = request.add_list_update_requests(); |
| 206 list_update_request->set_platform_type(list_to_update.platform_type); | 206 list_update_request->set_platform_type(list_to_update.platform_type); |
| 207 list_update_request->set_threat_entry_type( | 207 list_update_request->set_threat_entry_type( |
| 208 list_to_update.threat_entry_type); | 208 list_to_update.threat_entry_type); |
| 209 list_update_request->set_threat_type(list_to_update.threat_type); | 209 list_update_request->set_threat_type(list_to_update.threat_type); |
| 210 | 210 |
| 211 if (!state.empty()) { | 211 if (!state.empty()) { |
| 212 list_update_request->set_state(state); | 212 list_update_request->set_state(state); |
| 213 } | 213 } |
| 214 | 214 |
| 215 // TODO(vakh): Accept other compression formats also. | |
| 216 // See: https://bugs.chromium.org/p/chromium/issues/detail?id=624567 | |
| 217 list_update_request->mutable_constraints()->add_supported_compressions(RAW); | 215 list_update_request->mutable_constraints()->add_supported_compressions(RAW); |
| 216 list_update_request->mutable_constraints()->add_supported_compressions( |
| 217 RICE); |
| 218 } | 218 } |
| 219 | 219 |
| 220 // Serialize and Base64 encode. | 220 // Serialize and Base64 encode. |
| 221 std::string req_data, req_base64; | 221 std::string req_data, req_base64; |
| 222 request.SerializeToString(&req_data); | 222 request.SerializeToString(&req_data); |
| 223 base::Base64UrlEncode(req_data, base::Base64UrlEncodePolicy::INCLUDE_PADDING, | 223 base::Base64UrlEncode(req_data, base::Base64UrlEncodePolicy::INCLUDE_PADDING, |
| 224 &req_base64); | 224 &req_base64); |
| 225 return req_base64; | 225 return req_base64; |
| 226 } | 226 } |
| 227 | 227 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 | 349 |
| 350 void V4UpdateProtocolManager::GetUpdateUrlAndHeaders( | 350 void V4UpdateProtocolManager::GetUpdateUrlAndHeaders( |
| 351 const std::string& req_base64, | 351 const std::string& req_base64, |
| 352 GURL* gurl, | 352 GURL* gurl, |
| 353 net::HttpRequestHeaders* headers) const { | 353 net::HttpRequestHeaders* headers) const { |
| 354 V4ProtocolManagerUtil::GetRequestUrlAndHeaders( | 354 V4ProtocolManagerUtil::GetRequestUrlAndHeaders( |
| 355 req_base64, "threatListUpdates:fetch", config_, gurl, headers); | 355 req_base64, "threatListUpdates:fetch", config_, gurl, headers); |
| 356 } | 356 } |
| 357 | 357 |
| 358 } // namespace safe_browsing | 358 } // namespace safe_browsing |
| OLD | NEW |