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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 return true; | 275 return true; |
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(FROM_HERE, | 285 timer_.Start(base::TimeDelta::FromMilliseconds(kCheckUrlTimeoutMs), |
286 base::TimeDelta::FromMilliseconds(kCheckUrlTimeoutMs), | |
287 this, &SafeBrowsingResourceHandler::OnCheckUrlTimeout); | 286 this, &SafeBrowsingResourceHandler::OnCheckUrlTimeout); |
288 | 287 |
289 return false; | 288 return false; |
290 } | 289 } |
291 | 290 |
292 void SafeBrowsingResourceHandler::ResumeRequest() { | 291 void SafeBrowsingResourceHandler::ResumeRequest() { |
293 CHECK(state_ == STATE_NONE); | 292 CHECK(state_ == STATE_NONE); |
294 CHECK(defer_state_ != DEFERRED_NONE); | 293 CHECK(defer_state_ != DEFERRED_NONE); |
295 | 294 |
296 // Resume whatever stage got paused by the safe browsing check. | 295 // Resume whatever stage got paused by the safe browsing check. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 rdh_->FollowDeferredRedirect(render_process_host_id_, request_id, | 348 rdh_->FollowDeferredRedirect(render_process_host_id_, request_id, |
350 false, GURL()); | 349 false, GURL()); |
351 } | 350 } |
352 } | 351 } |
353 | 352 |
354 void SafeBrowsingResourceHandler::ClearDeferredRequestInfo() { | 353 void SafeBrowsingResourceHandler::ClearDeferredRequestInfo() { |
355 deferred_request_id_ = -1; | 354 deferred_request_id_ = -1; |
356 deferred_url_ = GURL(); | 355 deferred_url_ = GURL(); |
357 deferred_redirect_response_ = NULL; | 356 deferred_redirect_response_ = NULL; |
358 } | 357 } |
OLD | NEW |