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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 static const int kDownloadByteStreamSize; | 39 static const int kDownloadByteStreamSize; |
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( | 43 DownloadResourceHandler( |
44 uint32 id, | 44 uint32 id, |
45 net::URLRequest* request, | 45 net::URLRequest* request, |
46 const DownloadUrlParameters::OnStartedCallback& started_cb, | 46 const DownloadUrlParameters::OnStartedCallback& started_cb, |
47 scoped_ptr<DownloadSaveInfo> save_info); | 47 scoped_ptr<DownloadSaveInfo> save_info); |
48 | 48 |
49 virtual bool OnUploadProgress(uint64 position, uint64 size) OVERRIDE; | 49 virtual bool OnUploadProgress(uint64 position, uint64 size) override; |
50 | 50 |
51 virtual bool OnRequestRedirected(const net::RedirectInfo& redirect_info, | 51 virtual bool OnRequestRedirected(const net::RedirectInfo& redirect_info, |
52 ResourceResponse* response, | 52 ResourceResponse* response, |
53 bool* defer) OVERRIDE; | 53 bool* defer) override; |
54 | 54 |
55 // Send the download creation information to the download thread. | 55 // Send the download creation information to the download thread. |
56 virtual bool OnResponseStarted(ResourceResponse* response, | 56 virtual bool OnResponseStarted(ResourceResponse* response, |
57 bool* defer) OVERRIDE; | 57 bool* defer) override; |
58 | 58 |
59 // Pass-through implementation. | 59 // Pass-through implementation. |
60 virtual bool OnWillStart(const GURL& url, bool* defer) OVERRIDE; | 60 virtual bool OnWillStart(const GURL& url, bool* defer) override; |
61 | 61 |
62 // Pass-through implementation. | 62 // Pass-through implementation. |
63 virtual bool OnBeforeNetworkStart(const GURL& url, bool* defer) OVERRIDE; | 63 virtual bool OnBeforeNetworkStart(const GURL& url, bool* defer) override; |
64 | 64 |
65 // Create a new buffer, which will be handed to the download thread for file | 65 // Create a new buffer, which will be handed to the download thread for file |
66 // writing and deletion. | 66 // writing and deletion. |
67 virtual bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 67 virtual bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
68 int* buf_size, | 68 int* buf_size, |
69 int min_size) OVERRIDE; | 69 int min_size) override; |
70 | 70 |
71 virtual bool OnReadCompleted(int bytes_read, bool* defer) OVERRIDE; | 71 virtual bool OnReadCompleted(int bytes_read, bool* defer) override; |
72 | 72 |
73 virtual void OnResponseCompleted(const net::URLRequestStatus& status, | 73 virtual void OnResponseCompleted(const net::URLRequestStatus& status, |
74 const std::string& security_info, | 74 const std::string& security_info, |
75 bool* defer) OVERRIDE; | 75 bool* defer) override; |
76 | 76 |
77 // N/A to this flavor of DownloadHandler. | 77 // N/A to this flavor of DownloadHandler. |
78 virtual void OnDataDownloaded(int bytes_downloaded) OVERRIDE; | 78 virtual void OnDataDownloaded(int bytes_downloaded) override; |
79 | 79 |
80 void PauseRequest(); | 80 void PauseRequest(); |
81 void ResumeRequest(); | 81 void ResumeRequest(); |
82 | 82 |
83 // May result in this object being deleted by its owner. | 83 // May result in this object being deleted by its owner. |
84 void CancelRequest(); | 84 void CancelRequest(); |
85 | 85 |
86 std::string DebugString() const; | 86 std::string DebugString() const; |
87 | 87 |
88 private: | 88 private: |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 static const int kReadBufSize = 32768; // bytes | 132 static const int kReadBufSize = 32768; // bytes |
133 static const int kThrottleTimeMs = 200; // milliseconds | 133 static const int kThrottleTimeMs = 200; // milliseconds |
134 | 134 |
135 DISALLOW_COPY_AND_ASSIGN(DownloadResourceHandler); | 135 DISALLOW_COPY_AND_ASSIGN(DownloadResourceHandler); |
136 }; | 136 }; |
137 | 137 |
138 } // namespace content | 138 } // namespace content |
139 | 139 |
140 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ | 140 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ |
OLD | NEW |