OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_DUPLICATE_RESOURCE_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_DUPLICATE_RESOURCE_HANDLER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "content/browser/renderer_host/layered_resource_handler.h" |
| 13 #include "googleurl/src/gurl.h" |
| 14 #include "webkit/glue/resource_type.h" |
| 15 |
| 16 namespace net { |
| 17 class IOBuffer; |
| 18 class URLRequest; |
| 19 class URLRequestStatus; |
| 20 } |
| 21 |
| 22 namespace content { |
| 23 |
| 24 class DuplicateResourceHandler: public LayeredResourceHandler { |
| 25 |
| 26 public: |
| 27 DuplicateResourceHandler(scoped_ptr<ResourceHandler> next_handler, |
| 28 ResourceType::Type resource_type, |
| 29 net::URLRequest* request); |
| 30 virtual ~DuplicateResourceHandler(); |
| 31 |
| 32 private: |
| 33 enum { kReadBufSize = 32768 }; |
| 34 |
| 35 // ResourceHandler implementation |
| 36 virtual bool OnWillRead(int request_id, |
| 37 net::IOBuffer** buf, |
| 38 int* buf_size, |
| 39 int min_size) OVERRIDE; |
| 40 virtual bool OnReadCompleted(int request_id, int bytes_read, |
| 41 bool* defer) OVERRIDE; |
| 42 virtual bool OnResponseCompleted(int request_id, |
| 43 const net::URLRequestStatus& status, |
| 44 const std::string& security_info) OVERRIDE; |
| 45 |
| 46 ResourceType::Type resource_type_; |
| 47 uint32 start_seed_; |
| 48 int bytes_read_; |
| 49 scoped_refptr<net::IOBuffer> read_buffer_; |
| 50 net::URLRequest* request_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(DuplicateResourceHandler); |
| 53 }; // class DuplicateResourceHandler |
| 54 |
| 55 } // namespace content |
| 56 |
| 57 |
| 58 #endif // CONTENT_BROWSER_RENDERER_HOST_DUPLICATE_RESOURCE_HANDLER_H_ |
OLD | NEW |