| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/safe_browsing/ping_manager.h" | 5 #include "chrome/browser/safe_browsing/ping_manager.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 GURL SafeBrowsingPingManager::SafeBrowsingHitUrl( | 106 GURL SafeBrowsingPingManager::SafeBrowsingHitUrl( |
| 107 const GURL& malicious_url, const GURL& page_url, | 107 const GURL& malicious_url, const GURL& page_url, |
| 108 const GURL& referrer_url, bool is_subresource, | 108 const GURL& referrer_url, bool is_subresource, |
| 109 SBThreatType threat_type) const { | 109 SBThreatType threat_type) const { |
| 110 DCHECK(threat_type == SB_THREAT_TYPE_URL_MALWARE || | 110 DCHECK(threat_type == SB_THREAT_TYPE_URL_MALWARE || |
| 111 threat_type == SB_THREAT_TYPE_URL_PHISHING || | 111 threat_type == SB_THREAT_TYPE_URL_PHISHING || |
| 112 threat_type == SB_THREAT_TYPE_BINARY_MALWARE_URL || | 112 threat_type == SB_THREAT_TYPE_BINARY_MALWARE_URL || |
| 113 threat_type == SB_THREAT_TYPE_BINARY_MALWARE_HASH || | 113 threat_type == SB_THREAT_TYPE_BINARY_MALWARE_HASH || |
| 114 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL); | 114 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL); |
| 115 std::string url = SafeBrowsingProtocolManagerHelper::ComposeUrl( | 115 std::string url = SafeBrowsingProtocolManagerHelper::ComposeUrl( |
| 116 url_prefix_, "report", client_name_, version_, ""); | 116 url_prefix_, "report", client_name_, version_, std::string()); |
| 117 std::string threat_list = "none"; | 117 std::string threat_list = "none"; |
| 118 switch (threat_type) { | 118 switch (threat_type) { |
| 119 case SB_THREAT_TYPE_URL_MALWARE: | 119 case SB_THREAT_TYPE_URL_MALWARE: |
| 120 threat_list = "malblhit"; | 120 threat_list = "malblhit"; |
| 121 break; | 121 break; |
| 122 case SB_THREAT_TYPE_URL_PHISHING: | 122 case SB_THREAT_TYPE_URL_PHISHING: |
| 123 threat_list = "phishblhit"; | 123 threat_list = "phishblhit"; |
| 124 break; | 124 break; |
| 125 case SB_THREAT_TYPE_BINARY_MALWARE_URL: | 125 case SB_THREAT_TYPE_BINARY_MALWARE_URL: |
| 126 threat_list = "binurlhit"; | 126 threat_list = "binurlhit"; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 148 url_prefix_.c_str(), | 148 url_prefix_.c_str(), |
| 149 client_name_.c_str(), | 149 client_name_.c_str(), |
| 150 version_.c_str()); | 150 version_.c_str()); |
| 151 std::string api_key = google_apis::GetAPIKey(); | 151 std::string api_key = google_apis::GetAPIKey(); |
| 152 if (!api_key.empty()) { | 152 if (!api_key.empty()) { |
| 153 base::StringAppendF(&url, "&key=%s", | 153 base::StringAppendF(&url, "&key=%s", |
| 154 net::EscapeQueryParamValue(api_key, true).c_str()); | 154 net::EscapeQueryParamValue(api_key, true).c_str()); |
| 155 } | 155 } |
| 156 return GURL(url); | 156 return GURL(url); |
| 157 } | 157 } |
| OLD | NEW |