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

Side by Side Diff: content/public/browser/download_url_parameters.h

Issue 11028131: Shift passage of FileStream in downloads system to be by scoped_ptr<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated Al's comments. Created 8 years, 2 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 | Annotate | Revision Log
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_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_
6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ 6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 29 matching lines...) Expand all
40 public: 40 public:
41 // If there is an error, then |item| will be NULL. 41 // If there is an error, then |item| will be NULL.
42 typedef base::Callback<void(DownloadItem*, net::Error)> OnStartedCallback; 42 typedef base::Callback<void(DownloadItem*, net::Error)> OnStartedCallback;
43 43
44 typedef std::pair<std::string, std::string> RequestHeadersNameValuePair; 44 typedef std::pair<std::string, std::string> RequestHeadersNameValuePair;
45 typedef std::vector<RequestHeadersNameValuePair> RequestHeadersType; 45 typedef std::vector<RequestHeadersNameValuePair> RequestHeadersType;
46 46
47 static DownloadUrlParameters* FromWebContents( 47 static DownloadUrlParameters* FromWebContents(
48 WebContents* web_contents, 48 WebContents* web_contents,
49 const GURL& url, 49 const GURL& url,
50 const DownloadSaveInfo& save_info); 50 scoped_ptr<DownloadSaveInfo> save_info);
51 51
52 DownloadUrlParameters( 52 DownloadUrlParameters(
53 const GURL& url, 53 const GURL& url,
54 int render_process_host_id, 54 int render_process_host_id,
55 int render_view_host_routing_id, 55 int render_view_host_routing_id,
56 content::ResourceContext* resource_context, 56 content::ResourceContext* resource_context,
57 const DownloadSaveInfo& save_info); 57 scoped_ptr<DownloadSaveInfo> save_info);
58 58
59 ~DownloadUrlParameters(); 59 ~DownloadUrlParameters();
60 60
61 void set_content_initiated(bool content_initiated) { 61 void set_content_initiated(bool content_initiated) {
62 content_initiated_ = content_initiated; 62 content_initiated_ = content_initiated;
63 } 63 }
64 void add_request_header(const std::string& name, const std::string& value) { 64 void add_request_header(const std::string& name, const std::string& value) {
65 request_headers_.push_back(make_pair(name, value)); 65 request_headers_.push_back(make_pair(name, value));
66 } 66 }
67 void set_referrer(const Referrer& referrer) { referrer_ = referrer; } 67 void set_referrer(const Referrer& referrer) { referrer_ = referrer; }
68 void set_referrer_encoding(const std::string& referrer_encoding) { 68 void set_referrer_encoding(const std::string& referrer_encoding) {
69 referrer_encoding_ = referrer_encoding; 69 referrer_encoding_ = referrer_encoding;
70 } 70 }
71 void set_load_flags(int load_flags) { load_flags_ |= load_flags; } 71 void set_load_flags(int load_flags) { load_flags_ |= load_flags; }
72 void set_method(const std::string& method) { 72 void set_method(const std::string& method) {
73 method_ = method; 73 method_ = method;
74 } 74 }
75 void set_post_body(const std::string& post_body) { 75 void set_post_body(const std::string& post_body) {
76 post_body_ = post_body; 76 post_body_ = post_body;
77 } 77 }
78 void set_prefer_cache(bool prefer_cache) { 78 void set_prefer_cache(bool prefer_cache) {
79 prefer_cache_ = prefer_cache; 79 prefer_cache_ = prefer_cache;
80 } 80 }
81 void set_post_id(int64 post_id) { post_id_ = post_id; } 81 void set_post_id(int64 post_id) { post_id_ = post_id; }
82 void set_callback(const OnStartedCallback& callback) { 82 void set_callback(const OnStartedCallback& callback) {
83 callback_ = callback; 83 callback_ = callback;
84 } 84 }
85 85
86 // Note that this nulls the internal copy of the DownloadSaveInfo!
87 scoped_ptr<DownloadSaveInfo> GetSaveInfo();
88
86 const OnStartedCallback& callback() const { return callback_; } 89 const OnStartedCallback& callback() const { return callback_; }
87 bool content_initiated() const { return content_initiated_; } 90 bool content_initiated() const { return content_initiated_; }
88 int load_flags() const { return load_flags_; } 91 int load_flags() const { return load_flags_; }
89 const std::string& method() const { return method_; } 92 const std::string& method() const { return method_; }
90 const std::string& post_body() const { return post_body_; } 93 const std::string& post_body() const { return post_body_; }
91 int64 post_id() const { return post_id_; } 94 int64 post_id() const { return post_id_; }
92 bool prefer_cache() const { return prefer_cache_; } 95 bool prefer_cache() const { return prefer_cache_; }
93 const Referrer& referrer() const { return referrer_; } 96 const Referrer& referrer() const { return referrer_; }
94 const std::string& referrer_encoding() const { return referrer_encoding_; } 97 const std::string& referrer_encoding() const { return referrer_encoding_; }
95 int render_process_host_id() const { return render_process_host_id_; } 98 int render_process_host_id() const { return render_process_host_id_; }
96 int render_view_host_routing_id() const { 99 int render_view_host_routing_id() const {
97 return render_view_host_routing_id_; 100 return render_view_host_routing_id_;
98 } 101 }
99 RequestHeadersType::const_iterator request_headers_begin() const { 102 RequestHeadersType::const_iterator request_headers_begin() const {
100 return request_headers_.begin(); 103 return request_headers_.begin();
101 } 104 }
102 RequestHeadersType::const_iterator request_headers_end() const { 105 RequestHeadersType::const_iterator request_headers_end() const {
103 return request_headers_.end(); 106 return request_headers_.end();
104 } 107 }
105 content::ResourceContext* resource_context() const { 108 content::ResourceContext* resource_context() const {
106 return resource_context_; 109 return resource_context_;
107 } 110 }
108 ResourceDispatcherHost* resource_dispatcher_host() const { 111 ResourceDispatcherHost* resource_dispatcher_host() const {
109 return resource_dispatcher_host_; 112 return resource_dispatcher_host_;
110 } 113 }
111 const DownloadSaveInfo& save_info() const { return save_info_; }
112 const GURL& url() const { return url_; } 114 const GURL& url() const { return url_; }
113 115
114 private: 116 private:
115 OnStartedCallback callback_; 117 OnStartedCallback callback_;
116 bool content_initiated_; 118 bool content_initiated_;
117 RequestHeadersType request_headers_; 119 RequestHeadersType request_headers_;
118 int load_flags_; 120 int load_flags_;
119 std::string method_; 121 std::string method_;
120 std::string post_body_; 122 std::string post_body_;
121 int64 post_id_; 123 int64 post_id_;
122 bool prefer_cache_; 124 bool prefer_cache_;
123 Referrer referrer_; 125 Referrer referrer_;
124 std::string referrer_encoding_; 126 std::string referrer_encoding_;
125 int render_process_host_id_; 127 int render_process_host_id_;
126 int render_view_host_routing_id_; 128 int render_view_host_routing_id_;
127 ResourceContext* resource_context_; 129 ResourceContext* resource_context_;
128 ResourceDispatcherHost* resource_dispatcher_host_; 130 ResourceDispatcherHost* resource_dispatcher_host_;
129 DownloadSaveInfo save_info_; 131 scoped_ptr<DownloadSaveInfo> save_info_;
130 GURL url_; 132 GURL url_;
131 133
132 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters); 134 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters);
133 }; 135 };
134 136
135 } // namespace content 137 } // namespace content
136 138
137 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ 139 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_
OLDNEW
« no previous file with comments | « content/public/browser/download_save_info.h ('k') | content/public/browser/download_url_parameters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698