| 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/renderer_host/safe_browsing_resource_throttle.h" | 5 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.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_tracker.h" | 9 #include "chrome/browser/prerender/prerender_render_view_tracker.h" |
| 10 #include "chrome/browser/renderer_host/chrome_url_request_user_data.h" | 10 #include "chrome/browser/renderer_host/chrome_url_request_user_data.h" |
| 11 #include "content/public/browser/resource_throttle_controller.h" | 11 #include "content/public/browser/resource_throttle_controller.h" |
| 12 #include "net/base/load_flags.h" | 12 #include "net/base/load_flags.h" |
| 13 #include "net/url_request/url_request.h" | 13 #include "net/url_request/url_request.h" |
| 14 | 14 |
| 15 // Maximum time in milliseconds to wait for the safe browsing service to | 15 // Maximum time in milliseconds to wait for the safe browsing service to |
| 16 // verify a URL. After this amount of time the outstanding check will be | 16 // verify a URL. After this amount of time the outstanding check will be |
| 17 // aborted, and the URL will be treated as if it were safe. | 17 // aborted, and the URL will be treated as if it were safe. |
| 18 static const int kCheckUrlTimeoutMs = 5000; | 18 static const int kCheckUrlTimeoutMs = 5000; |
| 19 | 19 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 bool should_show_blocking_page = true; | 108 bool should_show_blocking_page = true; |
| 109 if (request_->load_flags() & net::LOAD_PREFETCH) { | 109 if (request_->load_flags() & net::LOAD_PREFETCH) { |
| 110 // Don't prefetch resources that fail safe browsing, disallow | 110 // Don't prefetch resources that fail safe browsing, disallow |
| 111 // them. | 111 // them. |
| 112 controller()->Cancel(); | 112 controller()->Cancel(); |
| 113 should_show_blocking_page = false; | 113 should_show_blocking_page = false; |
| 114 } else { | 114 } else { |
| 115 ChromeURLRequestUserData* user_data = | 115 ChromeURLRequestUserData* user_data = |
| 116 ChromeURLRequestUserData::Get(request_); | 116 ChromeURLRequestUserData::Get(request_); |
| 117 if (user_data && user_data->is_prerender()) { | 117 if (user_data && user_data->is_prerender()) { |
| 118 prerender::PrerenderTracker* prerender_tracker = g_browser_process-> | 118 prerender::PrerenderRenderViewTracker* prerender_render_view_tracker = |
| 119 prerender_tracker(); | 119 g_browser_process->prerender_render_view_tracker(); |
| 120 if (prerender_tracker->TryCancelOnIOThread( | 120 if (prerender_render_view_tracker->TryCancelOnIOThread( |
| 121 render_process_host_id_, | 121 render_process_host_id_, |
| 122 render_view_id_, | 122 render_view_id_, |
| 123 prerender::FINAL_STATUS_SAFE_BROWSING)) { | 123 prerender::FINAL_STATUS_SAFE_BROWSING)) { |
| 124 controller()->Cancel(); | 124 controller()->Cancel(); |
| 125 should_show_blocking_page = false; | 125 should_show_blocking_page = false; |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 if (should_show_blocking_page) | 129 if (should_show_blocking_page) |
| 130 StartDisplayingBlockingPage(url, result); | 130 StartDisplayingBlockingPage(url, result); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 OnBrowseUrlCheckResult(url_being_checked_, SafeBrowsingService::SAFE); | 197 OnBrowseUrlCheckResult(url_being_checked_, SafeBrowsingService::SAFE); |
| 198 } | 198 } |
| 199 | 199 |
| 200 void SafeBrowsingResourceThrottle::ResumeRequest() { | 200 void SafeBrowsingResourceThrottle::ResumeRequest() { |
| 201 CHECK(state_ == STATE_NONE); | 201 CHECK(state_ == STATE_NONE); |
| 202 CHECK(defer_state_ != DEFERRED_NONE); | 202 CHECK(defer_state_ != DEFERRED_NONE); |
| 203 | 203 |
| 204 defer_state_ = DEFERRED_NONE; | 204 defer_state_ = DEFERRED_NONE; |
| 205 controller()->Resume(); | 205 controller()->Resume(); |
| 206 } | 206 } |
| OLD | NEW |