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

Side by Side Diff: components/safe_browsing_db/v4_update_protocol_manager.h

Issue 2090593003: Small: Use WebBase64/UrlBase64 encoding for requests sent to the server. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@01_UpdateDbAndStores
Patch Set: git pull Created 4 years, 5 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
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 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_UPDATE_PROTOCOL_MANAGER_H_ 5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_UPDATE_PROTOCOL_MANAGER_H_
6 #define COMPONENTS_SAFE_BROWSING_DB_V4_UPDATE_PROTOCOL_MANAGER_H_ 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_UPDATE_PROTOCOL_MANAGER_H_
7 7
8 // A class that implements Chrome's interface with the SafeBrowsing V4 update 8 // A class that implements Chrome's interface with the SafeBrowsing V4 update
9 // protocol. 9 // protocol.
10 // 10 //
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 V4UpdateCallback callback); 78 V4UpdateCallback callback);
79 79
80 private: 80 private:
81 FRIEND_TEST_ALL_PREFIXES(V4UpdateProtocolManagerTest, 81 FRIEND_TEST_ALL_PREFIXES(V4UpdateProtocolManagerTest,
82 TestGetUpdatesErrorHandlingNetwork); 82 TestGetUpdatesErrorHandlingNetwork);
83 FRIEND_TEST_ALL_PREFIXES(V4UpdateProtocolManagerTest, 83 FRIEND_TEST_ALL_PREFIXES(V4UpdateProtocolManagerTest,
84 TestGetUpdatesErrorHandlingResponseCode); 84 TestGetUpdatesErrorHandlingResponseCode);
85 FRIEND_TEST_ALL_PREFIXES(V4UpdateProtocolManagerTest, TestGetUpdatesNoError); 85 FRIEND_TEST_ALL_PREFIXES(V4UpdateProtocolManagerTest, TestGetUpdatesNoError);
86 FRIEND_TEST_ALL_PREFIXES(V4UpdateProtocolManagerTest, 86 FRIEND_TEST_ALL_PREFIXES(V4UpdateProtocolManagerTest,
87 TestGetUpdatesWithOneBackoff); 87 TestGetUpdatesWithOneBackoff);
88 FRIEND_TEST_ALL_PREFIXES(V4UpdateProtocolManagerTest,
89 TestBase64EncodingUsesUrlEncoding);
88 friend class V4UpdateProtocolManagerFactoryImpl; 90 friend class V4UpdateProtocolManagerFactoryImpl;
89 91
90 // The method to populate |gurl| with the URL to be sent to the server. 92 // The method to populate |gurl| with the URL to be sent to the server.
91 // |request_base64| is the base64 encoded form of an instance of the protobuf 93 // |request_base64| is the base64 encoded form of an instance of the protobuf
92 // FetchThreatListUpdatesRequest. Also sets the appropriate header values for 94 // FetchThreatListUpdatesRequest. Also sets the appropriate header values for
93 // sending PVer4 requests in |headers|. 95 // sending PVer4 requests in |headers|.
94 void GetUpdateUrlAndHeaders(const std::string& request_base64, 96 void GetUpdateUrlAndHeaders(const std::string& request_base64,
95 GURL* gurl, 97 GURL* gurl,
96 net::HttpRequestHeaders* headers) const; 98 net::HttpRequestHeaders* headers) const;
97 99
98 // Fills a FetchThreatListUpdatesRequest protocol buffer for a request. 100 // Fills a FetchThreatListUpdatesRequest protocol buffer for a request.
99 // Returns the serialized and base 64 encoded request as a string. 101 // Returns the serialized and base64 URL encoded request as a string.
100 static std::string GetBase64SerializedUpdateRequestProto( 102 static std::string GetBase64SerializedUpdateRequestProto(
101 const StoreStateMap& store_state_map); 103 const StoreStateMap& store_state_map);
102 104
103 // Parses the base64 encoded response received from the server as a 105 // Parses the base64 encoded response received from the server as a
104 // FetchThreatListUpdatesResponse protobuf and returns each of the 106 // FetchThreatListUpdatesResponse protobuf and returns each of the
105 // ListUpdateResponse protobufs contained in it as a vector. 107 // ListUpdateResponse protobufs contained in it as a vector.
106 // Returns true if parsing is successful, false otherwise. 108 // Returns true if parsing is successful, false otherwise.
107 bool ParseUpdateResponse( 109 bool ParseUpdateResponse(
108 const std::string& data_base64, 110 const std::string& data_base64,
109 std::vector<ListUpdateResponse>* list_update_responses); 111 std::vector<ListUpdateResponse>* list_update_responses);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 const V4ProtocolConfig& config, 187 const V4ProtocolConfig& config,
186 V4UpdateCallback callback) = 0; 188 V4UpdateCallback callback) = 0;
187 189
188 private: 190 private:
189 DISALLOW_COPY_AND_ASSIGN(V4UpdateProtocolManagerFactory); 191 DISALLOW_COPY_AND_ASSIGN(V4UpdateProtocolManagerFactory);
190 }; 192 };
191 193
192 } // namespace safe_browsing 194 } // namespace safe_browsing
193 195
194 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_UPDATE_PROTOCOL_MANAGER_H_ 196 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_UPDATE_PROTOCOL_MANAGER_H_
OLDNEW
« no previous file with comments | « components/safe_browsing_db/v4_get_hash_protocol_manager.cc ('k') | components/safe_browsing_db/v4_update_protocol_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698