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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 break; | 127 break; |
128 case SB_THREAT_TYPE_BINARY_MALWARE_HASH: | 128 case SB_THREAT_TYPE_BINARY_MALWARE_HASH: |
129 threat_list = "binhashhit"; | 129 threat_list = "binhashhit"; |
130 break; | 130 break; |
131 case SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL: | 131 case SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL: |
132 threat_list = "phishcsdhit"; | 132 threat_list = "phishcsdhit"; |
133 break; | 133 break; |
134 default: | 134 default: |
135 NOTREACHED(); | 135 NOTREACHED(); |
136 } | 136 } |
137 const std::string& malicious_str = malicious_url.is_valid() ? | |
138 malicious_url.spec() : ""; | |
139 const std::string& page_str = page_url.is_valid() ? | |
140 page_url.spec() : ""; | |
141 const std::string& referrer_str = referrer_url.is_valid() ? | |
142 referrer_url.spec() : ""; | |
Scott Hess - ex-Googler
2013/03/14 17:46:51
What does it mean to have a threat-hit but empty U
| |
137 return GURL(base::StringPrintf("%s&evts=%s&evtd=%s&evtr=%s&evhr=%s&evtb=%d", | 143 return GURL(base::StringPrintf("%s&evts=%s&evtd=%s&evtr=%s&evhr=%s&evtb=%d", |
138 url.c_str(), threat_list.c_str(), | 144 url.c_str(), threat_list.c_str(), |
139 net::EscapeQueryParamValue(malicious_url.spec(), true).c_str(), | 145 net::EscapeQueryParamValue(malicious_str, true).c_str(), |
140 net::EscapeQueryParamValue(page_url.spec(), true).c_str(), | 146 net::EscapeQueryParamValue(page_str, true).c_str(), |
141 net::EscapeQueryParamValue(referrer_url.spec(), true).c_str(), | 147 net::EscapeQueryParamValue(referrer_str, true).c_str(), |
142 is_subresource)); | 148 is_subresource)); |
143 } | 149 } |
144 | 150 |
145 GURL SafeBrowsingPingManager::MalwareDetailsUrl() const { | 151 GURL SafeBrowsingPingManager::MalwareDetailsUrl() const { |
146 std::string url = base::StringPrintf( | 152 std::string url = base::StringPrintf( |
147 "%s/clientreport/malware?client=%s&appver=%s&pver=1.0", | 153 "%s/clientreport/malware?client=%s&appver=%s&pver=1.0", |
148 url_prefix_.c_str(), | 154 url_prefix_.c_str(), |
149 client_name_.c_str(), | 155 client_name_.c_str(), |
150 version_.c_str()); | 156 version_.c_str()); |
151 std::string api_key = google_apis::GetAPIKey(); | 157 std::string api_key = google_apis::GetAPIKey(); |
152 if (!api_key.empty()) { | 158 if (!api_key.empty()) { |
153 base::StringAppendF(&url, "&key=%s", | 159 base::StringAppendF(&url, "&key=%s", |
154 net::EscapeQueryParamValue(api_key, true).c_str()); | 160 net::EscapeQueryParamValue(api_key, true).c_str()); |
155 } | 161 } |
156 return GURL(url); | 162 return GURL(url); |
157 } | 163 } |
OLD | NEW |