| 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_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // static | 42 // static |
| 43 // This function is passed into ResourceDispatcherHostImpl during its | 43 // This function is passed into ResourceDispatcherHostImpl during its |
| 44 // creation and is used to create instances of DownloadResourceHandler as | 44 // creation and is used to create instances of DownloadResourceHandler as |
| 45 // needed. | 45 // needed. |
| 46 // TODO(ananta) | 46 // TODO(ananta) |
| 47 // Find a better way to achieve this. Ideally we want to move the logic of | 47 // Find a better way to achieve this. Ideally we want to move the logic of |
| 48 // creating DownloadResourceHandler instances out of | 48 // creating DownloadResourceHandler instances out of |
| 49 // ResourceDispatcherHostImpl. | 49 // ResourceDispatcherHostImpl. |
| 50 static std::unique_ptr<ResourceHandler> Create(net::URLRequest* request); | 50 static std::unique_ptr<ResourceHandler> Create(net::URLRequest* request); |
| 51 | 51 |
| 52 bool OnRequestRedirected(const net::RedirectInfo& redirect_info, | 52 void OnRequestRedirected(const net::RedirectInfo& redirect_info, |
| 53 ResourceResponse* response, | 53 ResourceResponse* response, |
| 54 bool* defer) override; | 54 bool* defer_or_cancel) override; |
| 55 | 55 |
| 56 // Send the download creation information to the download thread. | 56 // Send the download creation information to the download thread. |
| 57 bool OnResponseStarted(ResourceResponse* response, bool* defer) override; | 57 void OnResponseStarted(ResourceResponse* response, |
| 58 bool* defer_or_cancel) override; |
| 58 | 59 |
| 59 // Pass-through implementation. | 60 // Pass-through implementation. |
| 60 bool OnWillStart(const GURL& url, bool* defer) override; | 61 void OnWillStart(const GURL& url, bool* defer_or_cancel) override; |
| 61 | 62 |
| 62 // Create a new buffer, which will be handed to the download thread for file | 63 // Create a new buffer, which will be handed to the download thread for file |
| 63 // writing and deletion. | 64 // writing and deletion. |
| 64 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 65 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
| 65 int* buf_size, | 66 int* buf_size, |
| 66 int min_size) override; | 67 int min_size) override; |
| 67 | 68 |
| 68 bool OnReadCompleted(int bytes_read, bool* defer) override; | 69 void OnReadCompleted(int bytes_read, bool* defer_or_cancel) override; |
| 69 | 70 |
| 70 void OnResponseCompleted(const net::URLRequestStatus& status, | 71 void OnResponseCompleted(const net::URLRequestStatus& status, |
| 71 bool* defer) override; | 72 bool* defer) override; |
| 72 | 73 |
| 73 // N/A to this flavor of DownloadHandler. | 74 // N/A to this flavor of DownloadHandler. |
| 74 void OnDataDownloaded(int bytes_downloaded) override; | 75 void OnDataDownloaded(int bytes_downloaded) override; |
| 75 | 76 |
| 76 void PauseRequest(); | 77 void PauseRequest(); |
| 77 void ResumeRequest(); | 78 void ResumeRequest(); |
| 78 | 79 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 99 // deletion must occur on the IO thread. | 100 // deletion must occur on the IO thread. |
| 100 std::unique_ptr<DownloadTabInfo> tab_info_; | 101 std::unique_ptr<DownloadTabInfo> tab_info_; |
| 101 | 102 |
| 102 DownloadRequestCore core_; | 103 DownloadRequestCore core_; |
| 103 DISALLOW_COPY_AND_ASSIGN(DownloadResourceHandler); | 104 DISALLOW_COPY_AND_ASSIGN(DownloadResourceHandler); |
| 104 }; | 105 }; |
| 105 | 106 |
| 106 } // namespace content | 107 } // namespace content |
| 107 | 108 |
| 108 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ | 109 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ |
| OLD | NEW |