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

Unified Diff: components/safe_browsing_db/v4_protocol_manager_util.h

Issue 2229533002: Revert of Simple: Move PVer4 related code from util.* to v4_protocol_manager_util.* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: components/safe_browsing_db/v4_protocol_manager_util.h
diff --git a/components/safe_browsing_db/v4_protocol_manager_util.h b/components/safe_browsing_db/v4_protocol_manager_util.h
index fc6472b23f6bf4297b7a32ede24d99f700f5127f..6b81e8b5c0bf5703aded8ee36d5e1c0bb47b20a3 100644
--- a/components/safe_browsing_db/v4_protocol_manager_util.h
+++ b/components/safe_browsing_db/v4_protocol_manager_util.h
@@ -13,7 +13,6 @@
#include "base/gtest_prod_util.h"
#include "base/hash.h"
-#include "base/strings/string_piece.h"
#include "components/safe_browsing_db/safebrowsing.pb.h"
#include "net/url_request/url_request_status.h"
#include "url/gurl.h"
@@ -23,12 +22,6 @@
} // namespace net
namespace safe_browsing {
-
-// A hash prefix sent by the SafeBrowsing PVer4 service.
-typedef std::string HashPrefix;
-
-// A full SHA256 hash.
-typedef HashPrefix FullHash;
typedef FetchThreatListUpdatesRequest::ListUpdateRequest ListUpdateRequest;
typedef FetchThreatListUpdatesResponse::ListUpdateResponse ListUpdateResponse;
@@ -77,26 +70,6 @@
std::ostream& operator<<(std::ostream& os, const UpdateListIdentifier& id);
-#if defined(OS_WIN)
-#define PLATFORM_TYPE WINDOWS_PLATFORM
-#elif defined(OS_LINUX)
-#define PLATFORM_TYPE LINUX_PLATFORM
-#elif defined(OS_MACOSX)
-#define PLATFORM_TYPE OSX_PLATFORM
-#else
-// This should ideally never compile but it is getting compiled on Android.
-// See: https://bugs.chromium.org/p/chromium/issues/detail?id=621647
-// TODO(vakh): Once that bug is fixed, this should be removed. If we leave
-// the platform_type empty, the server won't recognize the request and
-// return an error response which will pollute our UMA metrics.
-#define PLATFORM_TYPE LINUX_PLATFORM
-#endif
-
-const UpdateListIdentifier kUrlMalwareId(PLATFORM_TYPE, URL, MALWARE_THREAT);
-const UpdateListIdentifier kUrlSocengId(PLATFORM_TYPE,
- URL,
- SOCIAL_ENGINEERING_PUBLIC);
-
// The set of interesting lists and ASCII filenames for their hash prefix
// stores. The stores are created inside the user-data directory.
// For instance, the UpdateListIdentifier could be for URL expressions for UwS
@@ -144,29 +117,14 @@
// A class that provides static methods related to the Pver4 protocol.
class V4ProtocolManagerUtil {
public:
- // Canonicalizes url as per Google Safe Browsing Specification.
- // See: https://developers.google.com/safe-browsing/v4/urls-hashing
- static void CanonicalizeUrl(const GURL& url,
- std::string* canonicalized_hostname,
- std::string* canonicalized_path,
- std::string* canonicalized_query);
-
- // This method returns the host suffix combinations from the hostname in the
- // URL, as described here:
- // https://developers.google.com/safe-browsing/v4/urls-hashing
- static void GenerateHostVariantsToCheck(const std::string& host,
- std::vector<std::string>* hosts);
-
- // This method returns the path prefix combinations from the path in the
- // URL, as described here:
- // https://developers.google.com/safe-browsing/v4/urls-hashing
- static void GeneratePathVariantsToCheck(const std::string& path,
- const std::string& query,
- std::vector<std::string>* paths);
-
- // Given a URL, returns all the patterns we need to check.
- static void GeneratePatternsToCheck(const GURL& url,
- std::vector<std::string>* urls);
+ // Record HTTP response code when there's no error in fetching an HTTP
+ // request, and the error code, when there is.
+ // |metric_name| is the name of the UMA metric to record the response code or
+ // error code against, |status| represents the status of the HTTP request, and
+ // |response code| represents the HTTP response code received from the server.
+ static void RecordHttpResponseOrErrorCode(const char* metric_name,
+ const net::URLRequestStatus& status,
+ int response_code);
// Generates a Pver4 request URL and sets the appropriate header values.
// |request_base64| is the serialized request protocol buffer encoded in
@@ -187,26 +145,12 @@
static base::TimeDelta GetNextBackOffInterval(size_t* error_count,
size_t* multiplier);
- // Record HTTP response code when there's no error in fetching an HTTP
- // request, and the error code, when there is.
- // |metric_name| is the name of the UMA metric to record the response code or
- // error code against, |status| represents the status of the HTTP request, and
- // |response code| represents the HTTP response code received from the server.
- static void RecordHttpResponseOrErrorCode(const char* metric_name,
- const net::URLRequestStatus& status,
- int response_code);
-
- // Generate the set of FullHashes to check for |url|.
- static void UrlToFullHashes(const GURL& url,
- base::hash_set<FullHash>* full_hashes);
-
private:
V4ProtocolManagerUtil(){};
- FRIEND_TEST_ALL_PREFIXES(V4ProtocolManagerUtilTest, TestBackOffLogic);
- FRIEND_TEST_ALL_PREFIXES(V4ProtocolManagerUtilTest,
+ FRIEND_TEST_ALL_PREFIXES(SafeBrowsingV4ProtocolManagerUtilTest,
+ TestBackOffLogic);
+ FRIEND_TEST_ALL_PREFIXES(SafeBrowsingV4ProtocolManagerUtilTest,
TestGetRequestUrlAndUpdateHeaders);
- FRIEND_TEST_ALL_PREFIXES(V4ProtocolManagerUtilTest, UrlParsing);
- FRIEND_TEST_ALL_PREFIXES(V4ProtocolManagerUtilTest, CanonicalizeUrl);
// Composes a URL using |prefix|, |method| (e.g.: encodedFullHashes).
// |request_base64|, |client_id|, |version| and |key_param|. |prefix|
@@ -218,18 +162,6 @@
// Sets the HTTP headers expected by a standard PVer4 request.
static void UpdateHeaders(net::HttpRequestHeaders* headers);
-
- // Given a URL, returns all the hosts we need to check. They are returned
- // in order of size (i.e. b.c is first, then a.b.c).
- static void GenerateHostsToCheck(const GURL& url,
- std::vector<std::string>* hosts);
-
- // Given a URL, returns all the paths we need to check.
- static void GeneratePathsToCheck(const GURL& url,
- std::vector<std::string>* paths);
-
- static std::string RemoveConsecutiveChars(base::StringPiece str,
- const char c);
DISALLOW_COPY_AND_ASSIGN(V4ProtocolManagerUtil);
};
« no previous file with comments | « components/safe_browsing_db/v4_local_database_manager.cc ('k') | components/safe_browsing_db/v4_protocol_manager_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698