| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef CONTENT_BROWSER_LOADER_STREAM_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_STREAM_RESOURCE_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_LOADER_STREAM_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_LOADER_STREAM_RESOURCE_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "content/browser/loader/resource_handler.h" | 10 #include "content/browser/loader/resource_handler.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 virtual bool OnResponseStarted(int request_id, | 44 virtual bool OnResponseStarted(int request_id, |
| 45 ResourceResponse* resp, | 45 ResourceResponse* resp, |
| 46 bool* defer) OVERRIDE; | 46 bool* defer) OVERRIDE; |
| 47 | 47 |
| 48 virtual bool OnWillStart(int request_id, | 48 virtual bool OnWillStart(int request_id, |
| 49 const GURL& url, | 49 const GURL& url, |
| 50 bool* defer) OVERRIDE; | 50 bool* defer) OVERRIDE; |
| 51 | 51 |
| 52 // Create a new buffer to store received data. | 52 // Create a new buffer to store received data. |
| 53 virtual bool OnWillRead(int request_id, | 53 virtual bool OnWillRead(int request_id, |
| 54 scoped_refptr<net::IOBuffer>* buf, | 54 net::IOBuffer** buf, |
| 55 int* buf_size, | 55 int* buf_size, |
| 56 int min_size) OVERRIDE; | 56 int min_size) OVERRIDE; |
| 57 | 57 |
| 58 // A read was completed, forward the data to the Stream. | 58 // A read was completed, forward the data to the Stream. |
| 59 virtual bool OnReadCompleted(int request_id, | 59 virtual bool OnReadCompleted(int request_id, |
| 60 int bytes_read, | 60 int bytes_read, |
| 61 bool* defer) OVERRIDE; | 61 bool* defer) OVERRIDE; |
| 62 | 62 |
| 63 virtual bool OnResponseCompleted(int request_id, | 63 virtual bool OnResponseCompleted(int request_id, |
| 64 const net::URLRequestStatus& status, | 64 const net::URLRequestStatus& status, |
| 65 const std::string& sec_info) OVERRIDE; | 65 const std::string& sec_info) OVERRIDE; |
| 66 | 66 |
| 67 virtual void OnDataDownloaded(int request_id, int bytes_downloaded) OVERRIDE; | 67 virtual void OnDataDownloaded(int request_id, int bytes_downloaded) OVERRIDE; |
| 68 | 68 |
| 69 Stream* stream() { return stream_.get(); } | 69 Stream* stream() { return stream_.get(); } |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 virtual void OnSpaceAvailable(Stream* stream) OVERRIDE; | 72 virtual void OnSpaceAvailable(Stream* stream) OVERRIDE; |
| 73 virtual void OnClose(Stream* stream) OVERRIDE; | 73 virtual void OnClose(Stream* stream) OVERRIDE; |
| 74 | 74 |
| 75 net::URLRequest* request_; |
| 75 scoped_refptr<Stream> stream_; | 76 scoped_refptr<Stream> stream_; |
| 76 scoped_refptr<net::IOBuffer> read_buffer_; | 77 scoped_refptr<net::IOBuffer> read_buffer_; |
| 77 DISALLOW_COPY_AND_ASSIGN(StreamResourceHandler); | 78 DISALLOW_COPY_AND_ASSIGN(StreamResourceHandler); |
| 78 }; | 79 }; |
| 79 | 80 |
| 80 } // namespace content | 81 } // namespace content |
| 81 | 82 |
| 82 #endif // CONTENT_BROWSER_LOADER_STREAM_RESOURCE_HANDLER_H_ | 83 #endif // CONTENT_BROWSER_LOADER_STREAM_RESOURCE_HANDLER_H_ |
| OLD | NEW |