| OLD | NEW |
| 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 #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/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/prerender/prerender_final_status.h" | 9 #include "chrome/browser/prerender/prerender_final_status.h" |
| 10 #include "chrome/browser/prerender/prerender_tracker.h" | 10 #include "chrome/browser/prerender/prerender_tracker.h" |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 } | 276 } |
| 277 | 277 |
| 278 AddRef(); // Balanced in OnUrlCheckResult(). | 278 AddRef(); // Balanced in OnUrlCheckResult(). |
| 279 state_ = STATE_CHECKING_URL; | 279 state_ = STATE_CHECKING_URL; |
| 280 | 280 |
| 281 // Record the start time of the check. | 281 // Record the start time of the check. |
| 282 url_check_start_time_ = base::TimeTicks::Now(); | 282 url_check_start_time_ = base::TimeTicks::Now(); |
| 283 | 283 |
| 284 // Start a timer to abort the check if it takes too long. | 284 // Start a timer to abort the check if it takes too long. |
| 285 timer_.Start(base::TimeDelta::FromMilliseconds(kCheckUrlTimeoutMs), | 285 timer_.Start(base::TimeDelta::FromMilliseconds(kCheckUrlTimeoutMs), |
| 286 this, &SafeBrowsingResourceHandler::OnCheckUrlTimeout); | 286 this, &SafeBrowsingResourceHandler::OnCheckUrlTimeout, |
| 287 FROM_HERE); |
| 287 | 288 |
| 288 return false; | 289 return false; |
| 289 } | 290 } |
| 290 | 291 |
| 291 void SafeBrowsingResourceHandler::ResumeRequest() { | 292 void SafeBrowsingResourceHandler::ResumeRequest() { |
| 292 CHECK(state_ == STATE_NONE); | 293 CHECK(state_ == STATE_NONE); |
| 293 CHECK(defer_state_ != DEFERRED_NONE); | 294 CHECK(defer_state_ != DEFERRED_NONE); |
| 294 | 295 |
| 295 // Resume whatever stage got paused by the safe browsing check. | 296 // Resume whatever stage got paused by the safe browsing check. |
| 296 switch (defer_state_) { | 297 switch (defer_state_) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 rdh_->FollowDeferredRedirect(render_process_host_id_, request_id, | 349 rdh_->FollowDeferredRedirect(render_process_host_id_, request_id, |
| 349 false, GURL()); | 350 false, GURL()); |
| 350 } | 351 } |
| 351 } | 352 } |
| 352 | 353 |
| 353 void SafeBrowsingResourceHandler::ClearDeferredRequestInfo() { | 354 void SafeBrowsingResourceHandler::ClearDeferredRequestInfo() { |
| 354 deferred_request_id_ = -1; | 355 deferred_request_id_ = -1; |
| 355 deferred_url_ = GURL(); | 356 deferred_url_ = GURL(); |
| 356 deferred_redirect_response_ = NULL; | 357 deferred_redirect_response_ = NULL; |
| 357 } | 358 } |
| OLD | NEW |