| 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 #include "content/browser/download/download_create_info.h" | 5 #include "content/browser/download/download_create_info.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 content::PageTransition transition_type) | 21 content::PageTransition transition_type) |
| 22 : start_time(start_time), | 22 : start_time(start_time), |
| 23 received_bytes(received_bytes), | 23 received_bytes(received_bytes), |
| 24 total_bytes(total_bytes), | 24 total_bytes(total_bytes), |
| 25 state(state), | 25 state(state), |
| 26 download_id(DownloadId::Invalid()), | 26 download_id(DownloadId::Invalid()), |
| 27 has_user_gesture(has_user_gesture), | 27 has_user_gesture(has_user_gesture), |
| 28 transition_type(transition_type), | 28 transition_type(transition_type), |
| 29 db_handle(0), | 29 db_handle(0), |
| 30 prompt_user_for_save_location(false), | 30 prompt_user_for_save_location(false), |
| 31 save_info(new content::DownloadSaveInfo()), |
| 31 request_bound_net_log(bound_net_log) { | 32 request_bound_net_log(bound_net_log) { |
| 32 } | 33 } |
| 33 | 34 |
| 34 DownloadCreateInfo::DownloadCreateInfo() | 35 DownloadCreateInfo::DownloadCreateInfo() |
| 35 : received_bytes(0), | 36 : received_bytes(0), |
| 36 total_bytes(0), | 37 total_bytes(0), |
| 37 state(-1), | 38 state(-1), |
| 38 download_id(DownloadId::Invalid()), | 39 download_id(DownloadId::Invalid()), |
| 39 has_user_gesture(false), | 40 has_user_gesture(false), |
| 40 transition_type(content::PAGE_TRANSITION_LINK), | 41 transition_type(content::PAGE_TRANSITION_LINK), |
| 41 db_handle(0), | 42 db_handle(0), |
| 42 prompt_user_for_save_location(false) { | 43 prompt_user_for_save_location(false), |
| 44 save_info(new content::DownloadSaveInfo()) { |
| 43 } | 45 } |
| 44 | 46 |
| 45 DownloadCreateInfo::~DownloadCreateInfo() { | 47 DownloadCreateInfo::~DownloadCreateInfo() { |
| 46 } | 48 } |
| 47 | 49 |
| 48 std::string DownloadCreateInfo::DebugString() const { | 50 std::string DownloadCreateInfo::DebugString() const { |
| 49 return base::StringPrintf("{" | 51 return base::StringPrintf("{" |
| 50 " download_id = %s" | 52 " download_id = %s" |
| 51 " url = \"%s\"" | 53 " url = \"%s\"" |
| 52 " save_info.file_path = \"%" PRFilePath "\"" | |
| 53 " received_bytes = %" PRId64 | 54 " received_bytes = %" PRId64 |
| 54 " total_bytes = %" PRId64 | 55 " total_bytes = %" PRId64 |
| 55 " prompt_user_for_save_location = %c" | 56 " prompt_user_for_save_location = %c" |
| 56 " }", | 57 " }", |
| 57 download_id.DebugString().c_str(), | 58 download_id.DebugString().c_str(), |
| 58 url().spec().c_str(), | 59 url().spec().c_str(), |
| 59 save_info.file_path.value().c_str(), | |
| 60 received_bytes, | 60 received_bytes, |
| 61 total_bytes, | 61 total_bytes, |
| 62 prompt_user_for_save_location ? 'T' : 'F'); | 62 prompt_user_for_save_location ? 'T' : 'F'); |
| 63 } | 63 } |
| 64 | 64 |
| 65 const GURL& DownloadCreateInfo::url() const { | 65 const GURL& DownloadCreateInfo::url() const { |
| 66 return url_chain.empty() ? GURL::EmptyGURL() : url_chain.back(); | 66 return url_chain.empty() ? GURL::EmptyGURL() : url_chain.back(); |
| 67 } | 67 } |
| OLD | NEW |