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

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

Issue 8956059: Rename NavigationController to NavigationControllerImpl and put it into the content namespace. Al... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 12 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
OLDNEW
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"
11 #include "chrome/browser/net/chrome_url_request_context.h" 11 #include "chrome/browser/net/chrome_url_request_context.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/safe_browsing/malware_details_cache.h" 13 #include "chrome/browser/safe_browsing/malware_details_cache.h"
14 #include "chrome/browser/safe_browsing/malware_details_history.h" 14 #include "chrome/browser/safe_browsing/malware_details_history.h"
15 #include "chrome/browser/safe_browsing/report.pb.h" 15 #include "chrome/browser/safe_browsing/report.pb.h"
16 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 16 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
17 #include "chrome/common/safe_browsing/safebrowsing_messages.h" 17 #include "chrome/common/safe_browsing/safebrowsing_messages.h"
18 #include "content/browser/renderer_host/render_view_host.h" 18 #include "content/browser/renderer_host/render_view_host.h"
19 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
20 #include "content/public/browser/navigation_entry.h" 20 #include "content/public/browser/navigation_entry.h"
21 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
22 #include "net/base/io_buffer.h" 22 #include "net/base/io_buffer.h"
23 #include "net/disk_cache/disk_cache.h" 23 #include "net/disk_cache/disk_cache.h"
24 #include "net/url_request/url_request_context_getter.h" 24 #include "net/url_request/url_request_context_getter.h"
25 25
26 using content::BrowserThread; 26 using content::BrowserThread;
27 using content::NavigationEntry;
27 using content::WebContents; 28 using content::WebContents;
28 using safe_browsing::ClientMalwareReportRequest; 29 using safe_browsing::ClientMalwareReportRequest;
29 30
30 // Keep in sync with KMaxNodes in renderer/safe_browsing/malware_dom_details 31 // Keep in sync with KMaxNodes in renderer/safe_browsing/malware_dom_details
31 static const uint32 kMaxDomNodes = 500; 32 static const uint32 kMaxDomNodes = 500;
32 33
33 // static 34 // static
34 MalwareDetailsFactory* MalwareDetails::factory_ = NULL; 35 MalwareDetailsFactory* MalwareDetails::factory_ = NULL;
35 36
36 // The default MalwareDetailsFactory. Global, made a singleton so we 37 // The default MalwareDetailsFactory. Global, made a singleton so we
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 if (IsPublicUrl(resource_.url)) { 162 if (IsPublicUrl(resource_.url)) {
162 report_->set_malware_url(resource_.url.spec()); 163 report_->set_malware_url(resource_.url.spec());
163 } 164 }
164 165
165 GURL page_url = web_contents()->GetURL(); 166 GURL page_url = web_contents()->GetURL();
166 if (IsPublicUrl(page_url)) { 167 if (IsPublicUrl(page_url)) {
167 report_->set_page_url(page_url.spec()); 168 report_->set_page_url(page_url.spec());
168 } 169 }
169 170
170 GURL referrer_url; 171 GURL referrer_url;
171 content::NavigationEntry* nav_entry = 172 NavigationEntry* nav_entry = web_contents()->GetController().GetActiveEntry();
172 web_contents()->GetController().GetActiveEntry();
173 if (nav_entry) { 173 if (nav_entry) {
174 referrer_url = nav_entry->GetReferrer().url; 174 referrer_url = nav_entry->GetReferrer().url;
175 if (IsPublicUrl(referrer_url)) { 175 if (IsPublicUrl(referrer_url)) {
176 report_->set_referrer_url(referrer_url.spec()); 176 report_->set_referrer_url(referrer_url.spec());
177 } 177 }
178 } 178 }
179 179
180 // Add the nodes, starting from the page url. 180 // Add the nodes, starting from the page url.
181 AddUrl(page_url, GURL(), "", NULL); 181 AddUrl(page_url, GURL(), "", NULL);
182 182
(...skipping 122 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 sb_service_->SendSerializedMalwareDetails(serialized); 313 sb_service_->SendSerializedMalwareDetails(serialized);
314 } 314 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698