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

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

Issue 1529363006: Introducing SavePackageId and SaveItemId as distinct IdType<...>-based types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed CR feedback from Daniel. Created 4 years, 11 months 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>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "content/browser/download/save_types.h"
14 #include "content/browser/loader/resource_handler.h" 15 #include "content/browser/loader/resource_handler.h"
15 #include "url/gurl.h" 16 #include "url/gurl.h"
16 17
17 namespace net { 18 namespace net {
18 class URLRequest; 19 class URLRequest;
19 } 20 }
20 21
21 namespace content { 22 namespace content {
22 class SaveFileManager; 23 class SaveFileManager;
23 24
24 // Forwards data to the save thread. 25 // Forwards data to the save thread.
25 class SaveFileResourceHandler : public ResourceHandler { 26 class SaveFileResourceHandler : public ResourceHandler {
26 public: 27 public:
27 SaveFileResourceHandler(net::URLRequest* request, 28 SaveFileResourceHandler(net::URLRequest* request,
28 int save_item_id, 29 SaveItemId save_item_id,
29 int save_package_id, 30 SavePackageId save_package_id,
30 int render_process_host_id, 31 int render_process_host_id,
31 int render_frame_routing_id, 32 int render_frame_routing_id,
32 const GURL& url, 33 const GURL& url,
33 SaveFileManager* manager); 34 SaveFileManager* manager);
34 ~SaveFileResourceHandler() override; 35 ~SaveFileResourceHandler() override;
35 36
36 // ResourceHandler Implementation: 37 // ResourceHandler Implementation:
37 38
38 // Saves the redirected URL to final_url_, we need to use the original 39 // Saves the redirected URL to final_url_, we need to use the original
39 // URL to match original request. 40 // URL to match original request.
(...skipping 29 matching lines...) Expand all
69 // If the content-length header is not present (or contains something other 70 // If the content-length header is not present (or contains something other
70 // than numbers), StringToInt64 returns 0, which indicates 'unknown size' and 71 // than numbers), StringToInt64 returns 0, which indicates 'unknown size' and
71 // is handled correctly by the SaveManager. 72 // is handled correctly by the SaveManager.
72 void set_content_length(const std::string& content_length); 73 void set_content_length(const std::string& content_length);
73 74
74 void set_content_disposition(const std::string& content_disposition) { 75 void set_content_disposition(const std::string& content_disposition) {
75 content_disposition_ = content_disposition; 76 content_disposition_ = content_disposition;
76 } 77 }
77 78
78 private: 79 private:
79 int save_item_id_; 80 SaveItemId save_item_id_;
80 int save_package_id_; 81 SavePackageId save_package_id_;
81 int render_process_id_; 82 int render_process_id_;
82 int render_frame_routing_id_; 83 int render_frame_routing_id_;
83 scoped_refptr<net::IOBuffer> read_buffer_; 84 scoped_refptr<net::IOBuffer> read_buffer_;
84 std::string content_disposition_; 85 std::string content_disposition_;
85 GURL url_; 86 GURL url_;
86 GURL final_url_; 87 GURL final_url_;
87 int64_t content_length_; 88 int64_t content_length_;
88 SaveFileManager* save_manager_; 89 SaveFileManager* save_manager_;
89 90
90 static const int kReadBufSize = 32768; // bytes 91 static const int kReadBufSize = 32768; // bytes
91 92
92 DISALLOW_COPY_AND_ASSIGN(SaveFileResourceHandler); 93 DISALLOW_COPY_AND_ASSIGN(SaveFileResourceHandler);
93 }; 94 };
94 95
95 } // namespace content 96 } // namespace content
96 97
97 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_RESOURCE_HANDLER_H_ 98 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_RESOURCE_HANDLER_H_
OLDNEW
« no previous file with comments | « content/browser/download/save_file_manager.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