| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_RENDERER_HOST_SAVE_FILE_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_SAVE_FILE_RESOURCE_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_SAVE_FILE_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_SAVE_FILE_RESOURCE_HANDLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 bool* defer) OVERRIDE; | 45 bool* defer) OVERRIDE; |
| 46 | 46 |
| 47 // Creates a new buffer, which will be handed to the download thread for file | 47 // Creates a new buffer, which will be handed to the download thread for file |
| 48 // writing and deletion. | 48 // writing and deletion. |
| 49 virtual bool OnWillRead(int request_id, | 49 virtual bool OnWillRead(int request_id, |
| 50 net::IOBuffer** buf, | 50 net::IOBuffer** buf, |
| 51 int* buf_size, | 51 int* buf_size, |
| 52 int min_size) OVERRIDE; | 52 int min_size) OVERRIDE; |
| 53 | 53 |
| 54 // Passes the buffer to the download file writer. | 54 // Passes the buffer to the download file writer. |
| 55 virtual bool OnReadCompleted(int request_id, int* bytes_read, | 55 virtual bool OnReadCompleted(int request_id, int bytes_read, |
| 56 bool* defer) OVERRIDE; | 56 bool* defer) OVERRIDE; |
| 57 | 57 |
| 58 virtual bool OnResponseCompleted(int request_id, | 58 virtual bool OnResponseCompleted(int request_id, |
| 59 const net::URLRequestStatus& status, | 59 const net::URLRequestStatus& status, |
| 60 const std::string& security_info) OVERRIDE; | 60 const std::string& security_info) OVERRIDE; |
| 61 | 61 |
| 62 // If the content-length header is not present (or contains something other | 62 // If the content-length header is not present (or contains something other |
| 63 // than numbers), StringToInt64 returns 0, which indicates 'unknown size' and | 63 // than numbers), StringToInt64 returns 0, which indicates 'unknown size' and |
| 64 // is handled correctly by the SaveManager. | 64 // is handled correctly by the SaveManager. |
| 65 void set_content_length(const std::string& content_length); | 65 void set_content_length(const std::string& content_length); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 78 GURL final_url_; | 78 GURL final_url_; |
| 79 int64 content_length_; | 79 int64 content_length_; |
| 80 SaveFileManager* save_manager_; | 80 SaveFileManager* save_manager_; |
| 81 | 81 |
| 82 static const int kReadBufSize = 32768; // bytes | 82 static const int kReadBufSize = 32768; // bytes |
| 83 | 83 |
| 84 DISALLOW_COPY_AND_ASSIGN(SaveFileResourceHandler); | 84 DISALLOW_COPY_AND_ASSIGN(SaveFileResourceHandler); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 #endif // CONTENT_BROWSER_RENDERER_HOST_SAVE_FILE_RESOURCE_HANDLER_H_ | 87 #endif // CONTENT_BROWSER_RENDERER_HOST_SAVE_FILE_RESOURCE_HANDLER_H_ |
| OLD | NEW |