| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 194 |
| 195 std::string V4UpdateProtocolManager::GetBase64SerializedUpdateRequestProto() { | 195 std::string V4UpdateProtocolManager::GetBase64SerializedUpdateRequestProto() { |
| 196 DCHECK(!store_state_map_->empty()); | 196 DCHECK(!store_state_map_->empty()); |
| 197 // Build the request. Client info and client states are not added to the | 197 // Build the request. Client info and client states are not added to the |
| 198 // request protocol buffer. Client info is passed as params in the url. | 198 // request protocol buffer. Client info is passed as params in the url. |
| 199 FetchThreatListUpdatesRequest request; | 199 FetchThreatListUpdatesRequest request; |
| 200 for (const auto& entry : *store_state_map_) { | 200 for (const auto& entry : *store_state_map_) { |
| 201 const auto& list_to_update = entry.first; | 201 const auto& list_to_update = entry.first; |
| 202 const auto& state = entry.second; | 202 const auto& state = entry.second; |
| 203 ListUpdateRequest* list_update_request = request.add_list_update_requests(); | 203 ListUpdateRequest* list_update_request = request.add_list_update_requests(); |
| 204 list_update_request->set_platform_type(list_to_update.platform_type); | 204 list_update_request->set_platform_type(list_to_update.platform_type()); |
| 205 list_update_request->set_threat_entry_type( | 205 list_update_request->set_threat_entry_type( |
| 206 list_to_update.threat_entry_type); | 206 list_to_update.threat_entry_type()); |
| 207 list_update_request->set_threat_type(list_to_update.threat_type); | 207 list_update_request->set_threat_type(list_to_update.threat_type()); |
| 208 | 208 |
| 209 if (!state.empty()) { | 209 if (!state.empty()) { |
| 210 list_update_request->set_state(state); | 210 list_update_request->set_state(state); |
| 211 } | 211 } |
| 212 | 212 |
| 213 list_update_request->mutable_constraints()->add_supported_compressions(RAW); | 213 list_update_request->mutable_constraints()->add_supported_compressions(RAW); |
| 214 list_update_request->mutable_constraints()->add_supported_compressions( | 214 list_update_request->mutable_constraints()->add_supported_compressions( |
| 215 RICE); | 215 RICE); |
| 216 } | 216 } |
| 217 | 217 |
| (...skipping 131 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 |