Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: content/browser/download/save_file_resource_handler.h

Issue 2476163003: Refactor ResourceHandler API. (Closed)
Patch Set: Minor cleanups, one real fix Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_SAVE_FILE_RESOURCE_HANDLER_H_ 5 #ifndef CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_RESOURCE_HANDLER_H_
6 #define CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_RESOURCE_HANDLER_H_ 6 #define CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_RESOURCE_HANDLER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 int render_process_host_id, 43 int render_process_host_id,
44 int render_frame_routing_id, 44 int render_frame_routing_id,
45 const GURL& url, 45 const GURL& url,
46 AuthorizationState authorization_state); 46 AuthorizationState authorization_state);
47 ~SaveFileResourceHandler() override; 47 ~SaveFileResourceHandler() override;
48 48
49 // ResourceHandler Implementation: 49 // ResourceHandler Implementation:
50 50
51 // Saves the redirected URL to final_url_, we need to use the original 51 // Saves the redirected URL to final_url_, we need to use the original
52 // URL to match original request. 52 // URL to match original request.
53 bool OnRequestRedirected(const net::RedirectInfo& redirect_info, 53 void OnRequestRedirected(const net::RedirectInfo& redirect_info,
54 ResourceResponse* response, 54 ResourceResponse* response,
55 bool* defer) override; 55 bool* defer_or_cancel) override;
56 56
57 // Sends the download creation information to the download thread. 57 // Sends the download creation information to the download thread.
58 bool OnResponseStarted(ResourceResponse* response, bool* defer) override; 58 void OnResponseStarted(ResourceResponse* response,
59 bool* defer_or_cancel) override;
59 60
60 // Pass-through implementation. 61 // Pass-through implementation.
61 bool OnWillStart(const GURL& url, bool* defer) override; 62 void OnWillStart(const GURL& url, bool* defer_or_cancel) override;
62 63
63 // Creates a new buffer, which will be handed to the download thread for file 64 // Creates a new buffer, which will be handed to the download thread for file
64 // writing and deletion. 65 // writing and deletion.
65 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, 66 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf,
66 int* buf_size, 67 int* buf_size,
67 int min_size) override; 68 int min_size) override;
68 69
69 // Passes the buffer to the download file writer. 70 // Passes the buffer to the download file writer.
70 bool OnReadCompleted(int bytes_read, bool* defer) override; 71 void OnReadCompleted(int bytes_read, bool* defer_or_cancel) override;
71 72
72 void OnResponseCompleted(const net::URLRequestStatus& status, 73 void OnResponseCompleted(const net::URLRequestStatus& status,
73 bool* defer) override; 74 bool* defer) override;
74 75
75 // N/A to this flavor of SaveFileResourceHandler. 76 // N/A to this flavor of SaveFileResourceHandler.
76 void OnDataDownloaded(int bytes_downloaded) override; 77 void OnDataDownloaded(int bytes_downloaded) override;
77 78
78 // If the content-length header is not present (or contains something other 79 // If the content-length header is not present (or contains something other
79 // than numbers), StringToInt64 returns 0, which indicates 'unknown size' and 80 // than numbers), StringToInt64 returns 0, which indicates 'unknown size' and
80 // is handled correctly by the SaveManager. 81 // is handled correctly by the SaveManager.
(...skipping 18 matching lines...) Expand all
99 AuthorizationState authorization_state_; 100 AuthorizationState authorization_state_;
100 101
101 static const int kReadBufSize = 32768; // bytes 102 static const int kReadBufSize = 32768; // bytes
102 103
103 DISALLOW_COPY_AND_ASSIGN(SaveFileResourceHandler); 104 DISALLOW_COPY_AND_ASSIGN(SaveFileResourceHandler);
104 }; 105 };
105 106
106 } // namespace content 107 } // namespace content
107 108
108 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_RESOURCE_HANDLER_H_ 109 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_RESOURCE_HANDLER_H_
OLDNEW
« no previous file with comments | « content/browser/download/download_resource_handler.cc ('k') | content/browser/download/save_file_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698