| OLD | NEW | 
|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 | 5 | 
| 6 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 6 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 
| 7 | 7 | 
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" | 
| 9 #include "base/histogram.h" | 9 #include "base/histogram.h" | 
| 10 #include "base/logging.h" | 10 #include "base/logging.h" | 
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 251   // The tab might have been closed. | 251   // The tab might have been closed. | 
| 252   TabContents* wc = | 252   TabContents* wc = | 
| 253       tab_util::GetTabContentsByID(resource.render_process_host_id, | 253       tab_util::GetTabContentsByID(resource.render_process_host_id, | 
| 254                                    resource.render_view_id); | 254                                    resource.render_view_id); | 
| 255 | 255 | 
| 256   if (!wc) { | 256   if (!wc) { | 
| 257     // The tab is gone and we did not have a chance at showing the interstitial. | 257     // The tab is gone and we did not have a chance at showing the interstitial. | 
| 258     // Just act as "Don't Proceed" was chosen. | 258     // Just act as "Don't Proceed" was chosen. | 
| 259     std::vector<UnsafeResource> resources; | 259     std::vector<UnsafeResource> resources; | 
| 260     resources.push_back(resource); | 260     resources.push_back(resource); | 
| 261     MessageLoop* message_loop; | 261     ChromeThread::PostTask( | 
| 262     if (g_browser_process->io_thread()) | 262       ChromeThread::IO, FROM_HERE, | 
| 263       message_loop = g_browser_process->io_thread()->message_loop(); | 263       NewRunnableMethod( | 
| 264     else  // For unit-tests, just post on the current thread. | 264           this, &SafeBrowsingService::OnBlockingPageDone, resources, false)); | 
| 265       message_loop = MessageLoop::current(); |  | 
| 266     message_loop->PostTask(FROM_HERE, NewRunnableMethod( |  | 
| 267         this, &SafeBrowsingService::OnBlockingPageDone, resources, false)); |  | 
| 268     return; | 265     return; | 
| 269   } | 266   } | 
| 270 | 267 | 
| 271   // Report the malware sub-resource to the SafeBrowsing servers if we have a | 268   // Report the malware sub-resource to the SafeBrowsing servers if we have a | 
| 272   // malware sub-resource on a safe page and only if the user has opted in to | 269   // malware sub-resource on a safe page and only if the user has opted in to | 
| 273   // reporting statistics. | 270   // reporting statistics. | 
| 274   PrefService* prefs = g_browser_process->local_state(); | 271   PrefService* prefs = g_browser_process->local_state(); | 
| 275   DCHECK(prefs); | 272   DCHECK(prefs); | 
| 276   if (prefs && prefs->GetBoolean(prefs::kMetricsReportingEnabled) && | 273   if (prefs && prefs->GetBoolean(prefs::kMetricsReportingEnabled) && | 
| 277       resource.resource_type != ResourceType::MAIN_FRAME && | 274       resource.resource_type != ResourceType::MAIN_FRAME && | 
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 672   // report if it's not there. | 669   // report if it's not there. | 
| 673   std::string list; | 670   std::string list; | 
| 674   std::vector<SBPrefix> prefix_hits; | 671   std::vector<SBPrefix> prefix_hits; | 
| 675   std::vector<SBFullHashResult> full_hits; | 672   std::vector<SBFullHashResult> full_hits; | 
| 676   database_->ContainsUrl(page_url, &list, &prefix_hits, &full_hits, | 673   database_->ContainsUrl(page_url, &list, &prefix_hits, &full_hits, | 
| 677                          protocol_manager_->last_update()); | 674                          protocol_manager_->last_update()); | 
| 678 | 675 | 
| 679   if (full_hits.empty()) | 676   if (full_hits.empty()) | 
| 680     protocol_manager_->ReportMalware(malware_url, page_url, referrer_url); | 677     protocol_manager_->ReportMalware(malware_url, page_url, referrer_url); | 
| 681 } | 678 } | 
| OLD | NEW | 
|---|