Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: chrome/browser/safe_browsing/malware_details.cc

Issue 12227003: Don't add invalid URLs to MalwareDetails resources_ map. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 new_resource->set_url(url.spec()); 122 new_resource->set_url(url.spec());
123 new_resource->set_id(id); 123 new_resource->set_id(id);
124 resources_[url.spec()] = new_resource; 124 resources_[url.spec()] = new_resource;
125 return new_resource.get(); 125 return new_resource.get();
126 } 126 }
127 127
128 void MalwareDetails::AddUrl(const GURL& url, 128 void MalwareDetails::AddUrl(const GURL& url,
129 const GURL& parent, 129 const GURL& parent,
130 const std::string& tagname, 130 const std::string& tagname,
131 const std::vector<GURL>* children) { 131 const std::vector<GURL>* children) {
132 if (!IsPublicUrl(url)) 132 if (!url.is_valid() || !IsPublicUrl(url))
133 return; 133 return;
134 134
135 // Find (or create) the resource for the url. 135 // Find (or create) the resource for the url.
136 ClientMalwareReportRequest::Resource* url_resource = 136 ClientMalwareReportRequest::Resource* url_resource =
137 FindOrCreateResource(url); 137 FindOrCreateResource(url);
138 if (!tagname.empty()) { 138 if (!tagname.empty()) {
139 url_resource->set_tag_name(tagname); 139 url_resource->set_tag_name(tagname);
140 } 140 }
141 if (!parent.is_empty() && IsPublicUrl(parent)) { 141 if (!parent.is_empty() && IsPublicUrl(parent)) {
142 // Add the resource for the parent. 142 // Add the resource for the parent.
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 305
306 // Send the report, using the SafeBrowsingService. 306 // Send the report, using the SafeBrowsingService.
307 std::string serialized; 307 std::string serialized;
308 if (!report_->SerializeToString(&serialized)) { 308 if (!report_->SerializeToString(&serialized)) {
309 DLOG(ERROR) << "Unable to serialize the malware report."; 309 DLOG(ERROR) << "Unable to serialize the malware report.";
310 return; 310 return;
311 } 311 }
312 312
313 ui_manager_->SendSerializedMalwareDetails(serialized); 313 ui_manager_->SendSerializedMalwareDetails(serialized);
314 } 314 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698