Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Side by Side Diff: components/safe_browsing_db/v4_get_hash_protocol_manager.cc

Issue 2356443002: Set client_id and client_version in requests sent to SafeBrowsing (Closed)
Patch Set: Make GetBase64SerializedUpdateRequestProto non static Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/safe_browsing_db/v4_get_hash_protocol_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_get_hash_protocol_manager.h" 5 #include "components/safe_browsing_db/v4_get_hash_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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 for (const ThreatEntryType tet : threat_entry_types_) { 432 for (const ThreatEntryType tet : threat_entry_types_) {
433 info->add_threat_entry_types(tet); 433 info->add_threat_entry_types(tet);
434 } 434 }
435 for (const ThreatType tt : threat_types_) { 435 for (const ThreatType tt : threat_types_) {
436 info->add_threat_types(tt); 436 info->add_threat_types(tt);
437 } 437 }
438 for (const HashPrefix& prefix : prefixes_to_request) { 438 for (const HashPrefix& prefix : prefixes_to_request) {
439 info->add_threat_entries()->set_hash(prefix); 439 info->add_threat_entries()->set_hash(prefix);
440 } 440 }
441 441
442 V4ProtocolManagerUtil::SetClientInfoFromConfig(req.mutable_client(), config_);
443
442 // Serialize and Base64 encode. 444 // Serialize and Base64 encode.
443 std::string req_data, req_base64; 445 std::string req_data, req_base64;
444 req.SerializeToString(&req_data); 446 req.SerializeToString(&req_data);
445 base::Base64UrlEncode(req_data, base::Base64UrlEncodePolicy::INCLUDE_PADDING, 447 base::Base64UrlEncode(req_data, base::Base64UrlEncodePolicy::INCLUDE_PADDING,
446 &req_base64); 448 &req_base64);
447 return req_base64; 449 return req_base64;
448 } 450 }
449 451
450 void V4GetHashProtocolManager::GetHashUrlAndHeaders( 452 void V4GetHashProtocolManager::GetHashUrlAndHeaders(
451 const std::string& req_base64, 453 const std::string& req_base64,
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 std::ostream& operator<<(std::ostream& os, const FullHashInfo& fhi) { 732 std::ostream& operator<<(std::ostream& os, const FullHashInfo& fhi) {
731 os << "{full_hash: " << fhi.full_hash << "; list_id: " << fhi.list_id 733 os << "{full_hash: " << fhi.full_hash << "; list_id: " << fhi.list_id
732 << "; positive_expiry: " << fhi.positive_expiry 734 << "; positive_expiry: " << fhi.positive_expiry
733 << "; metadata.api_permissions.size(): " 735 << "; metadata.api_permissions.size(): "
734 << fhi.metadata.api_permissions.size() << "}"; 736 << fhi.metadata.api_permissions.size() << "}";
735 return os; 737 return os;
736 } 738 }
737 #endif 739 #endif
738 740
739 } // namespace safe_browsing 741 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « no previous file | components/safe_browsing_db/v4_get_hash_protocol_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698