| 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/buffered_resource_handler.h" | 5 #include "chrome/browser/renderer_host/buffered_resource_handler.h" |
| 6 | 6 |
| 7 #include "base/histogram.h" | 7 #include "base/histogram.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "net/base/mime_sniffer.h" | 9 #include "net/base/mime_sniffer.h" |
| 10 #include "net/base/net_errors.h" |
| 10 #include "chrome/browser/renderer_host/download_throttling_resource_handler.h" | 11 #include "chrome/browser/renderer_host/download_throttling_resource_handler.h" |
| 11 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 12 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| 12 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
| 13 #include "net/base/mime_sniffer.h" | 14 #include "net/base/mime_sniffer.h" |
| 14 #include "net/base/io_buffer.h" | 15 #include "net/base/io_buffer.h" |
| 15 #include "net/http/http_response_headers.h" | 16 #include "net/http/http_response_headers.h" |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 const int kMaxBytesToSniff = 512; | 20 const int kMaxBytesToSniff = 512; |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 real_handler_ = download_handler; | 281 real_handler_ = download_handler; |
| 281 } | 282 } |
| 282 return real_handler_->OnResponseStarted(request_id, response_); | 283 return real_handler_->OnResponseStarted(request_id, response_); |
| 283 } | 284 } |
| 284 | 285 |
| 285 bool BufferedResourceHandler::DidBufferEnough(int bytes_read) { | 286 bool BufferedResourceHandler::DidBufferEnough(int bytes_read) { |
| 286 const int kRequiredLength = 256; | 287 const int kRequiredLength = 256; |
| 287 | 288 |
| 288 return bytes_read >= kRequiredLength; | 289 return bytes_read >= kRequiredLength; |
| 289 } | 290 } |
| OLD | NEW |