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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 void SafeBrowsingResourceHandler::OnGetHashTimeout() { | 71 void SafeBrowsingResourceHandler::OnGetHashTimeout() { |
72 if (!in_safe_browsing_check_) | 72 if (!in_safe_browsing_check_) |
73 return; | 73 return; |
74 | 74 |
75 safe_browsing_->CancelCheck(this); | 75 safe_browsing_->CancelCheck(this); |
76 OnUrlCheckResult(GURL::EmptyGURL(), SafeBrowsingService::URL_SAFE); | 76 OnUrlCheckResult(GURL::EmptyGURL(), SafeBrowsingService::URL_SAFE); |
77 } | 77 } |
78 | 78 |
79 bool SafeBrowsingResourceHandler::OnWillRead(int request_id, | 79 bool SafeBrowsingResourceHandler::OnWillRead(int request_id, |
80 char** buf, int* buf_size, | 80 net::IOBuffer** buf, int* buf_size, |
81 int min_size) { | 81 int min_size) { |
82 if (in_safe_browsing_check_ && pause_time_.is_null()) { | 82 if (in_safe_browsing_check_ && pause_time_.is_null()) { |
83 pause_time_ = base::Time::Now(); | 83 pause_time_ = base::Time::Now(); |
84 MessageLoop::current()->PostDelayedTask( | 84 MessageLoop::current()->PostDelayedTask( |
85 FROM_HERE, | 85 FROM_HERE, |
86 NewRunnableMethod(this, &SafeBrowsingResourceHandler::OnGetHashTimeout), | 86 NewRunnableMethod(this, &SafeBrowsingResourceHandler::OnGetHashTimeout), |
87 kMaxGetHashMs); | 87 kMaxGetHashMs); |
88 } | 88 } |
89 | 89 |
90 if (in_safe_browsing_check_ || displaying_blocking_page_) { | 90 if (in_safe_browsing_check_ || displaying_blocking_page_) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 next_handler_->OnResponseCompleted( | 170 next_handler_->OnResponseCompleted( |
171 queued_error_request_id_, *queued_error_.get()); | 171 queued_error_request_id_, *queued_error_.get()); |
172 queued_error_.reset(); | 172 queued_error_.reset(); |
173 } | 173 } |
174 } else { | 174 } else { |
175 rdh_->CancelRequest(render_process_host_id_, paused_request_id_, false); | 175 rdh_->CancelRequest(render_process_host_id_, paused_request_id_, false); |
176 } | 176 } |
177 | 177 |
178 Release(); | 178 Release(); |
179 } | 179 } |
OLD | NEW |