OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Implementation of the MalwareDetails class. | 5 // Implementation of the MalwareDetails class. |
6 | 6 |
7 #include "chrome/browser/safe_browsing/malware_details.h" | 7 #include "chrome/browser/safe_browsing/malware_details.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 } | 161 } |
162 | 162 |
163 GURL page_url = tab_contents()->GetURL(); | 163 GURL page_url = tab_contents()->GetURL(); |
164 if (IsPublicUrl(page_url)) { | 164 if (IsPublicUrl(page_url)) { |
165 report_->set_page_url(page_url.spec()); | 165 report_->set_page_url(page_url.spec()); |
166 } | 166 } |
167 | 167 |
168 GURL referrer_url; | 168 GURL referrer_url; |
169 NavigationEntry* nav_entry = tab_contents()->controller().GetActiveEntry(); | 169 NavigationEntry* nav_entry = tab_contents()->controller().GetActiveEntry(); |
170 if (nav_entry) { | 170 if (nav_entry) { |
171 referrer_url = nav_entry->referrer(); | 171 referrer_url = nav_entry->referrer().url; |
172 if (IsPublicUrl(referrer_url)) { | 172 if (IsPublicUrl(referrer_url)) { |
173 report_->set_referrer_url(referrer_url.spec()); | 173 report_->set_referrer_url(referrer_url.spec()); |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 // Add the nodes, starting from the page url. | 177 // Add the nodes, starting from the page url. |
178 AddUrl(page_url, GURL(), "", NULL); | 178 AddUrl(page_url, GURL(), "", NULL); |
179 | 179 |
180 // Add the resource_url and its original url, if non-empty and different. | 180 // Add the resource_url and its original url, if non-empty and different. |
181 if (!resource_.original_url.is_empty() && | 181 if (!resource_.original_url.is_empty() && |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 302 |
303 // Send the report, using the SafeBrowsingService. | 303 // Send the report, using the SafeBrowsingService. |
304 std::string serialized; | 304 std::string serialized; |
305 if (!report_->SerializeToString(&serialized)) { | 305 if (!report_->SerializeToString(&serialized)) { |
306 DLOG(ERROR) << "Unable to serialize the malware report."; | 306 DLOG(ERROR) << "Unable to serialize the malware report."; |
307 return; | 307 return; |
308 } | 308 } |
309 | 309 |
310 sb_service_->SendSerializedMalwareDetails(serialized); | 310 sb_service_->SendSerializedMalwareDetails(serialized); |
311 } | 311 } |
OLD | NEW |