| 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 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | |
| 10 #include <string> | 9 #include <string> |
| 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "content/public/browser/download_interrupt_reasons.h" | 16 #include "content/public/browser/download_interrupt_reasons.h" |
| 17 #include "content/public/browser/download_save_info.h" | 17 #include "content/public/browser/download_save_info.h" |
| 18 #include "content/public/common/referrer.h" | 18 #include "content/public/common/referrer.h" |
| 19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 20 | 20 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 save_info_.file_path = file_path; | 94 save_info_.file_path = file_path; |
| 95 } | 95 } |
| 96 void set_suggested_name(const base::string16& suggested_name) { | 96 void set_suggested_name(const base::string16& suggested_name) { |
| 97 save_info_.suggested_name = suggested_name; | 97 save_info_.suggested_name = suggested_name; |
| 98 } | 98 } |
| 99 void set_offset(int64_t offset) { save_info_.offset = offset; } | 99 void set_offset(int64_t offset) { save_info_.offset = offset; } |
| 100 void set_hash_state(const std::string& hash_state) { | 100 void set_hash_state(const std::string& hash_state) { |
| 101 save_info_.hash_state = hash_state; | 101 save_info_.hash_state = hash_state; |
| 102 } | 102 } |
| 103 void set_prompt(bool prompt) { save_info_.prompt_for_save_location = prompt; } | 103 void set_prompt(bool prompt) { save_info_.prompt_for_save_location = prompt; } |
| 104 void set_file(base::File file) { | 104 void set_file(base::File file) { save_info_.file = std::move(file); } |
| 105 save_info_.file = file.Pass(); | |
| 106 } | |
| 107 void set_do_not_prompt_for_login(bool do_not_prompt) { | 105 void set_do_not_prompt_for_login(bool do_not_prompt) { |
| 108 do_not_prompt_for_login_ = do_not_prompt; | 106 do_not_prompt_for_login_ = do_not_prompt; |
| 109 } | 107 } |
| 110 | 108 |
| 111 const OnStartedCallback& callback() const { return callback_; } | 109 const OnStartedCallback& callback() const { return callback_; } |
| 112 bool content_initiated() const { return content_initiated_; } | 110 bool content_initiated() const { return content_initiated_; } |
| 113 const std::string& last_modified() const { return last_modified_; } | 111 const std::string& last_modified() const { return last_modified_; } |
| 114 const std::string& etag() const { return etag_; } | 112 const std::string& etag() const { return etag_; } |
| 115 const std::string& method() const { return method_; } | 113 const std::string& method() const { return method_; } |
| 116 const std::string& post_body() const { return post_body_; } | 114 const std::string& post_body() const { return post_body_; } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 139 return save_info_.suggested_name; | 137 return save_info_.suggested_name; |
| 140 } | 138 } |
| 141 int64_t offset() const { return save_info_.offset; } | 139 int64_t offset() const { return save_info_.offset; } |
| 142 const std::string& hash_state() const { return save_info_.hash_state; } | 140 const std::string& hash_state() const { return save_info_.hash_state; } |
| 143 bool prompt() const { return save_info_.prompt_for_save_location; } | 141 bool prompt() const { return save_info_.prompt_for_save_location; } |
| 144 const GURL& url() const { return url_; } | 142 const GURL& url() const { return url_; } |
| 145 bool do_not_prompt_for_login() const { return do_not_prompt_for_login_; } | 143 bool do_not_prompt_for_login() const { return do_not_prompt_for_login_; } |
| 146 | 144 |
| 147 // Note that this is state changing--the DownloadUrlParameters object | 145 // Note that this is state changing--the DownloadUrlParameters object |
| 148 // will not have a file attached to it after this call. | 146 // will not have a file attached to it after this call. |
| 149 base::File GetFile() { return save_info_.file.Pass(); } | 147 base::File GetFile() { return std::move(save_info_.file); } |
| 150 | 148 |
| 151 private: | 149 private: |
| 152 OnStartedCallback callback_; | 150 OnStartedCallback callback_; |
| 153 bool content_initiated_; | 151 bool content_initiated_; |
| 154 RequestHeadersType request_headers_; | 152 RequestHeadersType request_headers_; |
| 155 std::string last_modified_; | 153 std::string last_modified_; |
| 156 std::string etag_; | 154 std::string etag_; |
| 157 std::string method_; | 155 std::string method_; |
| 158 std::string post_body_; | 156 std::string post_body_; |
| 159 int64_t post_id_; | 157 int64_t post_id_; |
| 160 bool prefer_cache_; | 158 bool prefer_cache_; |
| 161 Referrer referrer_; | 159 Referrer referrer_; |
| 162 std::string referrer_encoding_; | 160 std::string referrer_encoding_; |
| 163 int render_process_host_id_; | 161 int render_process_host_id_; |
| 164 int render_view_host_routing_id_; | 162 int render_view_host_routing_id_; |
| 165 int render_frame_host_routing_id_; | 163 int render_frame_host_routing_id_; |
| 166 ResourceContext* resource_context_; | 164 ResourceContext* resource_context_; |
| 167 DownloadSaveInfo save_info_; | 165 DownloadSaveInfo save_info_; |
| 168 GURL url_; | 166 GURL url_; |
| 169 bool do_not_prompt_for_login_; | 167 bool do_not_prompt_for_login_; |
| 170 | 168 |
| 171 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters); | 169 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters); |
| 172 }; | 170 }; |
| 173 | 171 |
| 174 } // namespace content | 172 } // namespace content |
| 175 | 173 |
| 176 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ | 174 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ |
| OLD | NEW |