| 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_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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 const DownloadSaveInfo& save_info); |
| 58 | 58 |
| 59 ~DownloadUrlParameters(); | 59 ~DownloadUrlParameters(); |
| 60 | 60 |
| 61 void set_content_initiated(bool content_initiated) { |
| 62 content_initiated_ = content_initiated; |
| 63 } |
| 61 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) { |
| 62 request_headers_.push_back(make_pair(name, value)); | 65 request_headers_.push_back(make_pair(name, value)); |
| 63 } | 66 } |
| 64 void set_referrer(const GURL& referrer) { referrer_ = referrer; } | 67 void set_referrer(const GURL& referrer) { referrer_ = referrer; } |
| 65 void set_referrer_encoding(const std::string& referrer_encoding) { | 68 void set_referrer_encoding(const std::string& referrer_encoding) { |
| 66 referrer_encoding_ = referrer_encoding; | 69 referrer_encoding_ = referrer_encoding; |
| 67 } | 70 } |
| 68 void set_load_flags(int load_flags) { load_flags_ |= load_flags; } | 71 void set_load_flags(int load_flags) { load_flags_ |= load_flags; } |
| 69 void set_method(const std::string& method) { | 72 void set_method(const std::string& method) { |
| 70 method_ = method; | 73 method_ = method; |
| 71 } | 74 } |
| 72 void set_post_body(const std::string& post_body) { | 75 void set_post_body(const std::string& post_body) { |
| 73 post_body_ = post_body; | 76 post_body_ = post_body; |
| 74 } | 77 } |
| 75 void set_prefer_cache(bool prefer_cache) { | 78 void set_prefer_cache(bool prefer_cache) { |
| 76 prefer_cache_ = prefer_cache; | 79 prefer_cache_ = prefer_cache; |
| 77 } | 80 } |
| 78 void set_post_id(int64 post_id) { post_id_ = post_id; } | 81 void set_post_id(int64 post_id) { post_id_ = post_id; } |
| 79 void set_callback(const OnStartedCallback& callback) { | 82 void set_callback(const OnStartedCallback& callback) { |
| 80 callback_ = callback; | 83 callback_ = callback; |
| 81 } | 84 } |
| 82 | 85 |
| 83 const OnStartedCallback& callback() const { return callback_; } | 86 const OnStartedCallback& callback() const { return callback_; } |
| 87 bool content_initiated() const { return content_initiated_; } |
| 84 int load_flags() const { return load_flags_; } | 88 int load_flags() const { return load_flags_; } |
| 85 const std::string& method() const { return method_; } | 89 const std::string& method() const { return method_; } |
| 86 const std::string& post_body() const { return post_body_; } | 90 const std::string& post_body() const { return post_body_; } |
| 87 int64 post_id() const { return post_id_; } | 91 int64 post_id() const { return post_id_; } |
| 88 bool prefer_cache() const { return prefer_cache_; } | 92 bool prefer_cache() const { return prefer_cache_; } |
| 89 const GURL& referrer() const { return referrer_; } | 93 const GURL& referrer() const { return referrer_; } |
| 90 const std::string& referrer_encoding() const { return referrer_encoding_; } | 94 const std::string& referrer_encoding() const { return referrer_encoding_; } |
| 91 int render_process_host_id() const { return render_process_host_id_; } | 95 int render_process_host_id() const { return render_process_host_id_; } |
| 92 int render_view_host_routing_id() const { | 96 int render_view_host_routing_id() const { |
| 93 return render_view_host_routing_id_; | 97 return render_view_host_routing_id_; |
| 94 } | 98 } |
| 95 RequestHeadersType::const_iterator request_headers_begin() const { | 99 RequestHeadersType::const_iterator request_headers_begin() const { |
| 96 return request_headers_.begin(); | 100 return request_headers_.begin(); |
| 97 } | 101 } |
| 98 RequestHeadersType::const_iterator request_headers_end() const { | 102 RequestHeadersType::const_iterator request_headers_end() const { |
| 99 return request_headers_.end(); | 103 return request_headers_.end(); |
| 100 } | 104 } |
| 101 content::ResourceContext* resource_context() const { | 105 content::ResourceContext* resource_context() const { |
| 102 return resource_context_; | 106 return resource_context_; |
| 103 } | 107 } |
| 104 ResourceDispatcherHost* resource_dispatcher_host() const { | 108 ResourceDispatcherHost* resource_dispatcher_host() const { |
| 105 return resource_dispatcher_host_; | 109 return resource_dispatcher_host_; |
| 106 } | 110 } |
| 107 const DownloadSaveInfo& save_info() const { return save_info_; } | 111 const DownloadSaveInfo& save_info() const { return save_info_; } |
| 108 const GURL& url() const { return url_; } | 112 const GURL& url() const { return url_; } |
| 109 | 113 |
| 110 private: | 114 private: |
| 111 OnStartedCallback callback_; | 115 OnStartedCallback callback_; |
| 116 bool content_initiated_; |
| 112 RequestHeadersType request_headers_; | 117 RequestHeadersType request_headers_; |
| 113 int load_flags_; | 118 int load_flags_; |
| 114 std::string method_; | 119 std::string method_; |
| 115 std::string post_body_; | 120 std::string post_body_; |
| 116 int64 post_id_; | 121 int64 post_id_; |
| 117 bool prefer_cache_; | 122 bool prefer_cache_; |
| 118 GURL referrer_; | 123 GURL referrer_; |
| 119 std::string referrer_encoding_; | 124 std::string referrer_encoding_; |
| 120 int render_process_host_id_; | 125 int render_process_host_id_; |
| 121 int render_view_host_routing_id_; | 126 int render_view_host_routing_id_; |
| 122 ResourceContext* resource_context_; | 127 ResourceContext* resource_context_; |
| 123 ResourceDispatcherHost* resource_dispatcher_host_; | 128 ResourceDispatcherHost* resource_dispatcher_host_; |
| 124 DownloadSaveInfo save_info_; | 129 DownloadSaveInfo save_info_; |
| 125 GURL url_; | 130 GURL url_; |
| 126 | 131 |
| 127 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters); | 132 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters); |
| 128 }; | 133 }; |
| 129 | 134 |
| 130 } // namespace content | 135 } // namespace content |
| 131 | 136 |
| 132 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ | 137 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ |
| OLD | NEW |