| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 8 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| 9 #include "chrome/browser/renderer_host/resource_message_filter.h" | 9 #include "chrome/browser/renderer_host/resource_message_filter.h" |
| 10 #include "chrome/common/notification_service.h" | 10 #include "chrome/common/notification_service.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 } | 130 } |
| 131 | 131 |
| 132 bool SafeBrowsingResourceHandler::OnResponseCompleted( | 132 bool SafeBrowsingResourceHandler::OnResponseCompleted( |
| 133 int request_id, const URLRequestStatus& status, | 133 int request_id, const URLRequestStatus& status, |
| 134 const std::string& security_info) { | 134 const std::string& security_info) { |
| 135 CHECK(state_ == STATE_NONE); | 135 CHECK(state_ == STATE_NONE); |
| 136 CHECK(defer_state_ == DEFERRED_NONE); | 136 CHECK(defer_state_ == DEFERRED_NONE); |
| 137 return next_handler_->OnResponseCompleted(request_id, status, security_info); | 137 return next_handler_->OnResponseCompleted(request_id, status, security_info); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void SafeBrowsingResourceHandler::OnRequestClosed() { |
| 141 next_handler_->OnRequestClosed(); |
| 142 } |
| 143 |
| 140 // SafeBrowsingService::Client implementation, called on the IO thread once | 144 // SafeBrowsingService::Client implementation, called on the IO thread once |
| 141 // the URL has been classified. | 145 // the URL has been classified. |
| 142 void SafeBrowsingResourceHandler::OnUrlCheckResult( | 146 void SafeBrowsingResourceHandler::OnUrlCheckResult( |
| 143 const GURL& url, SafeBrowsingService::UrlCheckResult result) { | 147 const GURL& url, SafeBrowsingService::UrlCheckResult result) { |
| 144 CHECK(state_ == STATE_CHECKING_URL); | 148 CHECK(state_ == STATE_CHECKING_URL); |
| 145 CHECK(defer_state_ != DEFERRED_NONE); | 149 CHECK(defer_state_ != DEFERRED_NONE); |
| 146 CHECK(url == deferred_url_); | 150 CHECK(url == deferred_url_); |
| 147 | 151 |
| 148 timer_.Stop(); // Cancel the timeout timer. | 152 timer_.Stop(); // Cancel the timeout timer. |
| 149 safe_browsing_result_ = result; | 153 safe_browsing_result_ = result; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 rdh_->FollowDeferredRedirect(render_process_host_id_, request_id, | 293 rdh_->FollowDeferredRedirect(render_process_host_id_, request_id, |
| 290 false, GURL()); | 294 false, GURL()); |
| 291 } | 295 } |
| 292 } | 296 } |
| 293 | 297 |
| 294 void SafeBrowsingResourceHandler::ClearDeferredRequestInfo() { | 298 void SafeBrowsingResourceHandler::ClearDeferredRequestInfo() { |
| 295 deferred_request_id_ = -1; | 299 deferred_request_id_ = -1; |
| 296 deferred_url_ = GURL(); | 300 deferred_url_ = GURL(); |
| 297 deferred_redirect_response_ = NULL; | 301 deferred_redirect_response_ = NULL; |
| 298 } | 302 } |
| OLD | NEW |