| 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 #ifndef CHROME_BROWSER_RENDERER_HOST_SAVE_FILE_RESOURCE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_SAVE_FILE_RESOURCE_HANDLER_H_ |
| 6 #define CHROME_BROWSER_RENDERER_HOST_SAVE_FILE_RESOURCE_HANDLER_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_SAVE_FILE_RESOURCE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/renderer_host/resource_handler.h" | 10 #include "chrome/browser/renderer_host/resource_handler.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 bool OnResponseStarted(int request_id, ResourceResponse* response); | 27 bool OnResponseStarted(int request_id, ResourceResponse* response); |
| 28 | 28 |
| 29 // Creates a new buffer, which will be handed to the download thread for file | 29 // Creates a new buffer, which will be handed to the download thread for file |
| 30 // writing and deletion. | 30 // writing and deletion. |
| 31 bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, | 31 bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, |
| 32 int min_size); | 32 int min_size); |
| 33 | 33 |
| 34 // Passes the buffer to the download file writer. | 34 // Passes the buffer to the download file writer. |
| 35 bool OnReadCompleted(int request_id, int* bytes_read); | 35 bool OnReadCompleted(int request_id, int* bytes_read); |
| 36 | 36 |
| 37 bool OnResponseCompleted(int request_id, const URLRequestStatus& status); | 37 bool OnResponseCompleted(int request_id, |
| 38 const URLRequestStatus& status, |
| 39 const std::string& security_info); |
| 38 | 40 |
| 39 // If the content-length header is not present (or contains something other | 41 // If the content-length header is not present (or contains something other |
| 40 // than numbers), StringToInt64 returns 0, which indicates 'unknown size' and | 42 // than numbers), StringToInt64 returns 0, which indicates 'unknown size' and |
| 41 // is handled correctly by the SaveManager. | 43 // is handled correctly by the SaveManager. |
| 42 void set_content_length(const std::string& content_length) { | 44 void set_content_length(const std::string& content_length) { |
| 43 content_length_ = StringToInt64(content_length); | 45 content_length_ = StringToInt64(content_length); |
| 44 } | 46 } |
| 45 | 47 |
| 46 void set_content_disposition(const std::string& content_disposition) { | 48 void set_content_disposition(const std::string& content_disposition) { |
| 47 content_disposition_ = content_disposition; | 49 content_disposition_ = content_disposition; |
| 48 } | 50 } |
| 49 | 51 |
| 50 private: | 52 private: |
| 51 int save_id_; | 53 int save_id_; |
| 52 int render_process_id_; | 54 int render_process_id_; |
| 53 int render_view_id_; | 55 int render_view_id_; |
| 54 scoped_refptr<net::IOBuffer> read_buffer_; | 56 scoped_refptr<net::IOBuffer> read_buffer_; |
| 55 std::string content_disposition_; | 57 std::string content_disposition_; |
| 56 GURL url_; | 58 GURL url_; |
| 57 GURL final_url_; | 59 GURL final_url_; |
| 58 int64 content_length_; | 60 int64 content_length_; |
| 59 SaveFileManager* save_manager_; | 61 SaveFileManager* save_manager_; |
| 60 | 62 |
| 61 static const int kReadBufSize = 32768; // bytes | 63 static const int kReadBufSize = 32768; // bytes |
| 62 | 64 |
| 63 DISALLOW_COPY_AND_ASSIGN(SaveFileResourceHandler); | 65 DISALLOW_COPY_AND_ASSIGN(SaveFileResourceHandler); |
| 64 }; | 66 }; |
| 65 #endif // CHROME_BROWSER_RENDERER_HOST_SAVE_FILE_RESOURCE_HANDLER_H_ | 67 #endif // CHROME_BROWSER_RENDERER_HOST_SAVE_FILE_RESOURCE_HANDLER_H_ |
| OLD | NEW |