| 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 #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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, | 88 FRIEND_TEST_ALL_PREFIXES(V4UpdateProtocolManagerTest, |
| 89 TestBase64EncodingUsesUrlEncoding); | 89 TestBase64EncodingUsesUrlEncoding); |
| 90 friend class V4UpdateProtocolManagerFactoryImpl; | 90 friend class V4UpdateProtocolManagerFactoryImpl; |
| 91 | 91 |
| 92 // Fills a FetchThreatListUpdatesRequest protocol buffer for a request. |
| 93 // Returns the serialized and base64 URL encoded request as a string. |
| 94 std::string GetBase64SerializedUpdateRequestProto(); |
| 95 |
| 92 // The method to populate |gurl| with the URL to be sent to the server. | 96 // The method to populate |gurl| with the URL to be sent to the server. |
| 93 // |request_base64| is the base64 encoded form of an instance of the protobuf | 97 // |request_base64| is the base64 encoded form of an instance of the protobuf |
| 94 // FetchThreatListUpdatesRequest. Also sets the appropriate header values for | 98 // FetchThreatListUpdatesRequest. Also sets the appropriate header values for |
| 95 // sending PVer4 requests in |headers|. | 99 // sending PVer4 requests in |headers|. |
| 96 void GetUpdateUrlAndHeaders(const std::string& request_base64, | 100 void GetUpdateUrlAndHeaders(const std::string& request_base64, |
| 97 GURL* gurl, | 101 GURL* gurl, |
| 98 net::HttpRequestHeaders* headers) const; | 102 net::HttpRequestHeaders* headers) const; |
| 99 | 103 |
| 100 // Fills a FetchThreatListUpdatesRequest protocol buffer for a request. | |
| 101 // Returns the serialized and base64 URL encoded request as a string. | |
| 102 static std::string GetBase64SerializedUpdateRequestProto( | |
| 103 const StoreStateMap& store_state_map); | |
| 104 | |
| 105 // Parses the base64 encoded response received from the server as a | 104 // Parses the base64 encoded response received from the server as a |
| 106 // FetchThreatListUpdatesResponse protobuf and returns each of the | 105 // FetchThreatListUpdatesResponse protobuf and returns each of the |
| 107 // ListUpdateResponse protobufs contained in it as a vector. | 106 // ListUpdateResponse protobufs contained in it as a vector. |
| 108 // Returns true if parsing is successful, false otherwise. | 107 // Returns true if parsing is successful, false otherwise. |
| 109 bool ParseUpdateResponse(const std::string& data_base64, | 108 bool ParseUpdateResponse(const std::string& data_base64, |
| 110 ParsedServerResponse* parsed_server_response); | 109 ParsedServerResponse* parsed_server_response); |
| 111 | 110 |
| 112 // Resets the update error counter and multiplier. | 111 // Resets the update error counter and multiplier. |
| 113 void ResetUpdateErrors(); | 112 void ResetUpdateErrors(); |
| 114 | 113 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 const V4ProtocolConfig& config, | 185 const V4ProtocolConfig& config, |
| 187 V4UpdateCallback callback) = 0; | 186 V4UpdateCallback callback) = 0; |
| 188 | 187 |
| 189 private: | 188 private: |
| 190 DISALLOW_COPY_AND_ASSIGN(V4UpdateProtocolManagerFactory); | 189 DISALLOW_COPY_AND_ASSIGN(V4UpdateProtocolManagerFactory); |
| 191 }; | 190 }; |
| 192 | 191 |
| 193 } // namespace safe_browsing | 192 } // namespace safe_browsing |
| 194 | 193 |
| 195 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_UPDATE_PROTOCOL_MANAGER_H_ | 194 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_UPDATE_PROTOCOL_MANAGER_H_ |
| OLD | NEW |