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 21 matching lines...) Expand all Loading... |
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, const URLRequestStatus& status); |
38 | 38 |
39 // If the content-length header is not present (or contains something other | 39 // If the content-length header is not present (or contains something other |
40 // than numbers), StringToInt64 returns 0, which indicates 'unknown size' and | 40 // than numbers), StringToInt64 returns 0, which indicates 'unknown size' and |
41 // is handled correctly by the SaveManager. | 41 // is handled correctly by the SaveManager. |
42 void set_content_length(const std::string& content_length) { | 42 void set_content_length(const std::string& content_length); |
43 content_length_ = StringToInt64(content_length); | |
44 } | |
45 | 43 |
46 void set_content_disposition(const std::string& content_disposition) { | 44 void set_content_disposition(const std::string& content_disposition) { |
47 content_disposition_ = content_disposition; | 45 content_disposition_ = content_disposition; |
48 } | 46 } |
49 | 47 |
50 private: | 48 private: |
51 int save_id_; | 49 int save_id_; |
52 int render_process_id_; | 50 int render_process_id_; |
53 int render_view_id_; | 51 int render_view_id_; |
54 scoped_refptr<net::IOBuffer> read_buffer_; | 52 scoped_refptr<net::IOBuffer> read_buffer_; |
55 std::string content_disposition_; | 53 std::string content_disposition_; |
56 GURL url_; | 54 GURL url_; |
57 GURL final_url_; | 55 GURL final_url_; |
58 int64 content_length_; | 56 int64 content_length_; |
59 SaveFileManager* save_manager_; | 57 SaveFileManager* save_manager_; |
60 | 58 |
61 static const int kReadBufSize = 32768; // bytes | 59 static const int kReadBufSize = 32768; // bytes |
62 | 60 |
63 DISALLOW_COPY_AND_ASSIGN(SaveFileResourceHandler); | 61 DISALLOW_COPY_AND_ASSIGN(SaveFileResourceHandler); |
64 }; | 62 }; |
| 63 |
65 #endif // CHROME_BROWSER_RENDERER_HOST_SAVE_FILE_RESOURCE_HANDLER_H_ | 64 #endif // CHROME_BROWSER_RENDERER_HOST_SAVE_FILE_RESOURCE_HANDLER_H_ |
OLD | NEW |