| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/renderer_host/safe_browsing_resource_handler.h" | 5 #include "chrome/browser/renderer_host/safe_browsing_resource_handler.h" |
| 6 | 6 |
| 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| 8 | 8 |
| 9 // Maximum time to wait for a gethash response from the Safe Browsing servers. | 9 // Maximum time to wait for a gethash response from the Safe Browsing servers. |
| 10 static const int kMaxGetHashMs = 1000; | 10 static const int kMaxGetHashMs = 1000; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 if (safe_browsing_->CheckUrl(url, this)) { | 30 if (safe_browsing_->CheckUrl(url, this)) { |
| 31 safe_browsing_result_ = SafeBrowsingService::URL_SAFE; | 31 safe_browsing_result_ = SafeBrowsingService::URL_SAFE; |
| 32 safe_browsing_->LogPauseDelay(base::TimeDelta()); // No delay. | 32 safe_browsing_->LogPauseDelay(base::TimeDelta()); // No delay. |
| 33 } else { | 33 } else { |
| 34 AddRef(); | 34 AddRef(); |
| 35 in_safe_browsing_check_ = true; | 35 in_safe_browsing_check_ = true; |
| 36 // Can't pause now because it's too early, so we'll do it in OnWillRead. | 36 // Can't pause now because it's too early, so we'll do it in OnWillRead. |
| 37 } | 37 } |
| 38 } | 38 } |
| 39 | 39 |
| 40 SafeBrowsingResourceHandler::~SafeBrowsingResourceHandler() { |
| 41 // If we're being deleted before the SafeBrowsing check has completed, cancel |
| 42 // the check. |
| 43 if (in_safe_browsing_check_) |
| 44 safe_browsing_->CancelCheck(this); |
| 45 } |
| 46 |
| 40 bool SafeBrowsingResourceHandler::OnUploadProgress(int request_id, | 47 bool SafeBrowsingResourceHandler::OnUploadProgress(int request_id, |
| 41 uint64 position, | 48 uint64 position, |
| 42 uint64 size) { | 49 uint64 size) { |
| 43 return next_handler_->OnUploadProgress(request_id, position, size); | 50 return next_handler_->OnUploadProgress(request_id, position, size); |
| 44 } | 51 } |
| 45 | 52 |
| 46 bool SafeBrowsingResourceHandler::OnRequestRedirected(int request_id, | 53 bool SafeBrowsingResourceHandler::OnRequestRedirected(int request_id, |
| 47 const GURL& new_url) { | 54 const GURL& new_url) { |
| 48 if (in_safe_browsing_check_) { | 55 if (in_safe_browsing_check_) { |
| 49 Release(); | 56 Release(); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 queued_security_info_); | 183 queued_security_info_); |
| 177 queued_error_.reset(); | 184 queued_error_.reset(); |
| 178 queued_security_info_.clear(); | 185 queued_security_info_.clear(); |
| 179 } | 186 } |
| 180 } else { | 187 } else { |
| 181 rdh_->CancelRequest(render_process_host_id_, paused_request_id_, false); | 188 rdh_->CancelRequest(render_process_host_id_, paused_request_id_, false); |
| 182 } | 189 } |
| 183 | 190 |
| 184 Release(); | 191 Release(); |
| 185 } | 192 } |
| OLD | NEW |