| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/file_path.h" |
| 11 #include "content/browser/renderer_host/resource_handler.h" | 12 #include "content/browser/renderer_host/resource_handler.h" |
| 12 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 13 | 14 |
| 14 class SaveFileManager; | 15 class SaveFileManager; |
| 15 | 16 |
| 16 // Forwards data to the save thread. | 17 // Forwards data to the save thread. |
| 17 class SaveFileResourceHandler : public ResourceHandler { | 18 class SaveFileResourceHandler : public ResourceHandler { |
| 18 public: | 19 public: |
| 19 SaveFileResourceHandler(int render_process_host_id, | 20 SaveFileResourceHandler(int render_process_host_id, |
| 20 int render_view_id, | 21 int render_view_id, |
| 21 const GURL& url, | 22 const GURL& url, |
| 23 const FilePath& default_download_dir, |
| 22 SaveFileManager* manager); | 24 SaveFileManager* manager); |
| 23 | 25 |
| 24 // ResourceHandler Implementation: | 26 // ResourceHandler Implementation: |
| 25 virtual bool OnUploadProgress(int request_id, uint64 position, uint64 size); | 27 virtual bool OnUploadProgress(int request_id, uint64 position, uint64 size); |
| 26 | 28 |
| 27 // Saves the redirected URL to final_url_, we need to use the original | 29 // Saves the redirected URL to final_url_, we need to use the original |
| 28 // URL to match original request. | 30 // URL to match original request. |
| 29 virtual bool OnRequestRedirected(int request_id, const GURL& url, | 31 virtual bool OnRequestRedirected(int request_id, const GURL& url, |
| 30 ResourceResponse* response, bool* defer); | 32 ResourceResponse* response, bool* defer); |
| 31 | 33 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 62 virtual ~SaveFileResourceHandler(); | 64 virtual ~SaveFileResourceHandler(); |
| 63 | 65 |
| 64 int save_id_; | 66 int save_id_; |
| 65 int render_process_id_; | 67 int render_process_id_; |
| 66 int render_view_id_; | 68 int render_view_id_; |
| 67 scoped_refptr<net::IOBuffer> read_buffer_; | 69 scoped_refptr<net::IOBuffer> read_buffer_; |
| 68 std::string content_disposition_; | 70 std::string content_disposition_; |
| 69 GURL url_; | 71 GURL url_; |
| 70 GURL final_url_; | 72 GURL final_url_; |
| 71 int64 content_length_; | 73 int64 content_length_; |
| 74 FilePath default_download_dir_; |
| 72 SaveFileManager* save_manager_; | 75 SaveFileManager* save_manager_; |
| 73 | 76 |
| 74 static const int kReadBufSize = 32768; // bytes | 77 static const int kReadBufSize = 32768; // bytes |
| 75 | 78 |
| 76 DISALLOW_COPY_AND_ASSIGN(SaveFileResourceHandler); | 79 DISALLOW_COPY_AND_ASSIGN(SaveFileResourceHandler); |
| 77 }; | 80 }; |
| 78 | 81 |
| 79 #endif // CHROME_BROWSER_RENDERER_HOST_SAVE_FILE_RESOURCE_HANDLER_H_ | 82 #endif // CHROME_BROWSER_RENDERER_HOST_SAVE_FILE_RESOURCE_HANDLER_H_ |
| OLD | NEW |