Chromium Code Reviews| 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/safe_browsing_service.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1109 if (index != -1) | 1109 if (index != -1) |
| 1110 check->result = GetResultFromListname(full_hashes[index].list_name); | 1110 check->result = GetResultFromListname(full_hashes[index].list_name); |
| 1111 } | 1111 } |
| 1112 SafeBrowsingCheckDone(check); | 1112 SafeBrowsingCheckDone(check); |
| 1113 return (index != -1); | 1113 return (index != -1); |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 void SafeBrowsingService::DoDisplayBlockingPage( | 1116 void SafeBrowsingService::DoDisplayBlockingPage( |
| 1117 const UnsafeResource& resource) { | 1117 const UnsafeResource& resource) { |
| 1118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1119 DVLOG(1) << __FUNCTION__ << " " << resource.url.spec(); | |
|
arv (Not doing code reviews)
2012/08/22 14:33:45
remove these
mattm
2012/08/22 20:33:47
Done.
| |
| 1119 // Check if the user has already ignored our warning for this render_view | 1120 // Check if the user has already ignored our warning for this render_view |
| 1120 // and domain. | 1121 // and domain. |
| 1121 if (IsWhitelisted(resource)) { | 1122 if (IsWhitelisted(resource)) { |
| 1123 DVLOG(1) << "iswhitelisted"; | |
| 1122 if (!resource.callback.is_null()) { | 1124 if (!resource.callback.is_null()) { |
| 1123 BrowserThread::PostTask( | 1125 BrowserThread::PostTask( |
| 1124 BrowserThread::IO, FROM_HERE, base::Bind(resource.callback, true)); | 1126 BrowserThread::IO, FROM_HERE, base::Bind(resource.callback, true)); |
| 1125 } | 1127 } |
| 1126 return; | 1128 return; |
| 1127 } | 1129 } |
| 1128 | 1130 |
| 1129 // The tab might have been closed. | 1131 // The tab might have been closed. |
| 1130 WebContents* web_contents = | 1132 WebContents* web_contents = |
| 1131 tab_util::GetWebContentsByID(resource.render_process_host_id, | 1133 tab_util::GetWebContentsByID(resource.render_process_host_id, |
| 1132 resource.render_view_id); | 1134 resource.render_view_id); |
| 1133 | 1135 |
| 1134 if (!web_contents) { | 1136 if (!web_contents) { |
| 1137 DVLOG(1) << "tabgone"; | |
| 1135 // The tab is gone and we did not have a chance at showing the interstitial. | 1138 // The tab is gone and we did not have a chance at showing the interstitial. |
| 1136 // Just act as if "Don't Proceed" were chosen. | 1139 // Just act as if "Don't Proceed" were chosen. |
| 1137 std::vector<UnsafeResource> resources; | 1140 std::vector<UnsafeResource> resources; |
| 1138 resources.push_back(resource); | 1141 resources.push_back(resource); |
| 1139 BrowserThread::PostTask( | 1142 BrowserThread::PostTask( |
| 1140 BrowserThread::IO, FROM_HERE, | 1143 BrowserThread::IO, FROM_HERE, |
| 1141 base::Bind(&SafeBrowsingService::OnBlockingPageDone, | 1144 base::Bind(&SafeBrowsingService::OnBlockingPageDone, |
| 1142 this, resources, false)); | 1145 this, resources, false)); |
| 1143 return; | 1146 return; |
| 1144 } | 1147 } |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1444 Stop(); | 1447 Stop(); |
| 1445 | 1448 |
| 1446 if (csd_service_.get()) | 1449 if (csd_service_.get()) |
| 1447 csd_service_->SetEnabledAndRefreshState(enable); | 1450 csd_service_->SetEnabledAndRefreshState(enable); |
| 1448 if (download_service_.get()) { | 1451 if (download_service_.get()) { |
| 1449 download_service_->SetEnabled( | 1452 download_service_->SetEnabled( |
| 1450 enable && !CommandLine::ForCurrentProcess()->HasSwitch( | 1453 enable && !CommandLine::ForCurrentProcess()->HasSwitch( |
| 1451 switches::kDisableImprovedDownloadProtection)); | 1454 switches::kDisableImprovedDownloadProtection)); |
| 1452 } | 1455 } |
| 1453 } | 1456 } |
| OLD | NEW |