| 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_protocol_manager_util.h" | 5 #include "components/safe_browsing_db/v4_protocol_manager_util.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/metrics/sparse_histogram.h" | 8 #include "base/metrics/sparse_histogram.h" |
| 9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 #else | 78 #else |
| 79 // This should ideally never compile but it is getting compiled on Android. | 79 // This should ideally never compile but it is getting compiled on Android. |
| 80 // See: https://bugs.chromium.org/p/chromium/issues/detail?id=621647 | 80 // See: https://bugs.chromium.org/p/chromium/issues/detail?id=621647 |
| 81 // TODO(vakh): Once that bug is fixed, this should be removed. If we leave | 81 // TODO(vakh): Once that bug is fixed, this should be removed. If we leave |
| 82 // the platform_type empty, the server won't recognize the request and | 82 // the platform_type empty, the server won't recognize the request and |
| 83 // return an error response which will pollute our UMA metrics. | 83 // return an error response which will pollute our UMA metrics. |
| 84 return LINUX_PLATFORM; | 84 return LINUX_PLATFORM; |
| 85 #endif | 85 #endif |
| 86 } | 86 } |
| 87 | 87 |
| 88 const UpdateListIdentifier GetChromeUrlApiId() { |
| 89 return UpdateListIdentifier(CHROME_PLATFORM, URL, API_ABUSE); |
| 90 } |
| 91 |
| 88 const UpdateListIdentifier GetUrlMalwareId() { | 92 const UpdateListIdentifier GetUrlMalwareId() { |
| 89 return UpdateListIdentifier(GetCurrentPlatformType(), URL, MALWARE_THREAT); | 93 return UpdateListIdentifier(GetCurrentPlatformType(), URL, MALWARE_THREAT); |
| 90 } | 94 } |
| 91 | 95 |
| 92 const UpdateListIdentifier GetUrlSocEngId() { | 96 const UpdateListIdentifier GetUrlSocEngId() { |
| 93 return UpdateListIdentifier(GetCurrentPlatformType(), URL, | 97 return UpdateListIdentifier(GetCurrentPlatformType(), URL, |
| 94 SOCIAL_ENGINEERING_PUBLIC); | 98 SOCIAL_ENGINEERING_PUBLIC); |
| 95 } | 99 } |
| 96 | 100 |
| 97 const UpdateListIdentifier GetChromeUrlApiId() { | |
| 98 return UpdateListIdentifier(CHROME_PLATFORM, URL, API_ABUSE); | |
| 99 } | |
| 100 | |
| 101 // The Safe Browsing V4 server URL prefix. | 101 // The Safe Browsing V4 server URL prefix. |
| 102 const char kSbV4UrlPrefix[] = "https://safebrowsing.googleapis.com/v4"; | 102 const char kSbV4UrlPrefix[] = "https://safebrowsing.googleapis.com/v4"; |
| 103 | 103 |
| 104 StoreAndHashPrefix::StoreAndHashPrefix(UpdateListIdentifier list_id, | 104 StoreAndHashPrefix::StoreAndHashPrefix(UpdateListIdentifier list_id, |
| 105 HashPrefix hash_prefix) | 105 HashPrefix hash_prefix) |
| 106 : list_id(list_id), hash_prefix(hash_prefix) {} | 106 : list_id(list_id), hash_prefix(hash_prefix) {} |
| 107 | 107 |
| 108 StoreAndHashPrefix::~StoreAndHashPrefix() {} | 108 StoreAndHashPrefix::~StoreAndHashPrefix() {} |
| 109 | 109 |
| 110 bool StoreAndHashPrefix::operator==(const StoreAndHashPrefix& other) const { | 110 bool StoreAndHashPrefix::operator==(const StoreAndHashPrefix& other) const { |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 } | 490 } |
| 491 | 491 |
| 492 if (!paths->empty() && paths->back() != path) | 492 if (!paths->empty() && paths->back() != path) |
| 493 paths->push_back(path); | 493 paths->push_back(path); |
| 494 | 494 |
| 495 if (!query.empty()) | 495 if (!query.empty()) |
| 496 paths->push_back(path + "?" + query); | 496 paths->push_back(path + "?" + query); |
| 497 } | 497 } |
| 498 | 498 |
| 499 } // namespace safe_browsing | 499 } // namespace safe_browsing |
| OLD | NEW |