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 24 matching lines...) Expand all Loading... |
35 : public ResourceHandler, | 35 : public ResourceHandler, |
36 public DownloadRequestCore::Delegate, | 36 public DownloadRequestCore::Delegate, |
37 public base::SupportsWeakPtr<DownloadResourceHandler> { | 37 public base::SupportsWeakPtr<DownloadResourceHandler> { |
38 public: | 38 public: |
39 struct DownloadTabInfo; | 39 struct DownloadTabInfo; |
40 | 40 |
41 // started_cb will be called exactly once on the UI thread. | 41 // started_cb will be called exactly once on the UI thread. |
42 // |id| should be invalid if the id should be automatically assigned. | 42 // |id| should be invalid if the id should be automatically assigned. |
43 DownloadResourceHandler(net::URLRequest* request); | 43 DownloadResourceHandler(net::URLRequest* request); |
44 | 44 |
| 45 // static |
| 46 // This function is passed into ResourceDispatcherHostImpl during its |
| 47 // creation and is used to create instances of DownloadResourceHandler as |
| 48 // needed. |
| 49 // TODO(ananta) |
| 50 // Find a better way to achieve this. Ideally we want to move the logic of |
| 51 // creating DownloadResourceHandler instances out of |
| 52 // ResourceDispatcherHostImpl. |
| 53 static std::unique_ptr<ResourceHandler> Create(net::URLRequest* request); |
| 54 |
45 bool OnRequestRedirected(const net::RedirectInfo& redirect_info, | 55 bool OnRequestRedirected(const net::RedirectInfo& redirect_info, |
46 ResourceResponse* response, | 56 ResourceResponse* response, |
47 bool* defer) override; | 57 bool* defer) override; |
48 | 58 |
49 // Send the download creation information to the download thread. | 59 // Send the download creation information to the download thread. |
50 bool OnResponseStarted(ResourceResponse* response, bool* defer) override; | 60 bool OnResponseStarted(ResourceResponse* response, bool* defer) override; |
51 | 61 |
52 // Pass-through implementation. | 62 // Pass-through implementation. |
53 bool OnWillStart(const GURL& url, bool* defer) override; | 63 bool OnWillStart(const GURL& url, bool* defer) override; |
54 | 64 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // deletion must occur on the IO thread. | 103 // deletion must occur on the IO thread. |
94 std::unique_ptr<DownloadTabInfo> tab_info_; | 104 std::unique_ptr<DownloadTabInfo> tab_info_; |
95 | 105 |
96 DownloadRequestCore core_; | 106 DownloadRequestCore core_; |
97 DISALLOW_COPY_AND_ASSIGN(DownloadResourceHandler); | 107 DISALLOW_COPY_AND_ASSIGN(DownloadResourceHandler); |
98 }; | 108 }; |
99 | 109 |
100 } // namespace content | 110 } // namespace content |
101 | 111 |
102 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ | 112 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ |
OLD | NEW |