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/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 fetcher->Start(); | 94 fetcher->Start(); |
95 safebrowsing_reports_.insert(fetcher); | 95 safebrowsing_reports_.insert(fetcher); |
96 } | 96 } |
97 | 97 |
98 GURL SafeBrowsingPingManager::SafeBrowsingHitUrl( | 98 GURL SafeBrowsingPingManager::SafeBrowsingHitUrl( |
99 const GURL& malicious_url, const GURL& page_url, | 99 const GURL& malicious_url, const GURL& page_url, |
100 const GURL& referrer_url, bool is_subresource, | 100 const GURL& referrer_url, bool is_subresource, |
101 SBThreatType threat_type) const { | 101 SBThreatType threat_type) const { |
102 DCHECK(threat_type == SB_THREAT_TYPE_URL_MALWARE || | 102 DCHECK(threat_type == SB_THREAT_TYPE_URL_MALWARE || |
103 threat_type == SB_THREAT_TYPE_URL_PHISHING || | 103 threat_type == SB_THREAT_TYPE_URL_PHISHING || |
| 104 threat_type == SB_THREAT_TYPE_URL_UNWANTED || |
104 threat_type == SB_THREAT_TYPE_BINARY_MALWARE_URL || | 105 threat_type == SB_THREAT_TYPE_BINARY_MALWARE_URL || |
105 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL || | 106 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL || |
106 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL); | 107 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL); |
107 std::string url = SafeBrowsingProtocolManagerHelper::ComposeUrl( | 108 std::string url = SafeBrowsingProtocolManagerHelper::ComposeUrl( |
108 url_prefix_, "report", client_name_, version_, std::string()); | 109 url_prefix_, "report", client_name_, version_, std::string()); |
109 std::string threat_list = "none"; | 110 std::string threat_list = "none"; |
110 switch (threat_type) { | 111 switch (threat_type) { |
111 case SB_THREAT_TYPE_URL_MALWARE: | 112 case SB_THREAT_TYPE_URL_MALWARE: |
112 threat_list = "malblhit"; | 113 threat_list = "malblhit"; |
113 break; | 114 break; |
114 case SB_THREAT_TYPE_URL_PHISHING: | 115 case SB_THREAT_TYPE_URL_PHISHING: |
115 threat_list = "phishblhit"; | 116 threat_list = "phishblhit"; |
116 break; | 117 break; |
| 118 case SB_THREAT_TYPE_URL_UNWANTED: |
| 119 threat_list = "uwsblhit"; |
| 120 break; |
117 case SB_THREAT_TYPE_BINARY_MALWARE_URL: | 121 case SB_THREAT_TYPE_BINARY_MALWARE_URL: |
118 threat_list = "binurlhit"; | 122 threat_list = "binurlhit"; |
119 break; | 123 break; |
120 case SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL: | 124 case SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL: |
121 threat_list = "phishcsdhit"; | 125 threat_list = "phishcsdhit"; |
122 break; | 126 break; |
123 case SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL: | 127 case SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL: |
124 threat_list = "malcsdhit"; | 128 threat_list = "malcsdhit"; |
125 break; | 129 break; |
126 default: | 130 default: |
(...skipping 13 matching lines...) Expand all Loading... |
140 url_prefix_.c_str(), | 144 url_prefix_.c_str(), |
141 client_name_.c_str(), | 145 client_name_.c_str(), |
142 version_.c_str()); | 146 version_.c_str()); |
143 std::string api_key = google_apis::GetAPIKey(); | 147 std::string api_key = google_apis::GetAPIKey(); |
144 if (!api_key.empty()) { | 148 if (!api_key.empty()) { |
145 base::StringAppendF(&url, "&key=%s", | 149 base::StringAppendF(&url, "&key=%s", |
146 net::EscapeQueryParamValue(api_key, true).c_str()); | 150 net::EscapeQueryParamValue(api_key, true).c_str()); |
147 } | 151 } |
148 return GURL(url); | 152 return GURL(url); |
149 } | 153 } |
OLD | NEW |