OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/download/download_create_info.h" |
| 6 |
| 7 #include <string> |
| 8 |
| 9 #include "base/format_macros.h" |
| 10 #include "base/stringprintf.h" |
| 11 |
| 12 DownloadCreateInfo::DownloadCreateInfo(const FilePath& path, |
| 13 const GURL& url, |
| 14 const base::Time& start_time, |
| 15 int64 received_bytes, |
| 16 int64 total_bytes, |
| 17 int32 state, |
| 18 int32 download_id, |
| 19 bool has_user_gesture) |
| 20 : path(path), |
| 21 url_chain(1, url), |
| 22 path_uniquifier(0), |
| 23 start_time(start_time), |
| 24 received_bytes(received_bytes), |
| 25 total_bytes(total_bytes), |
| 26 state(state), |
| 27 download_id(download_id), |
| 28 has_user_gesture(has_user_gesture), |
| 29 db_handle(0), |
| 30 prompt_user_for_save_location(false), |
| 31 is_dangerous_file(false), |
| 32 is_dangerous_url(false), |
| 33 is_extension_install(false) { |
| 34 } |
| 35 |
| 36 DownloadCreateInfo::DownloadCreateInfo() |
| 37 : path_uniquifier(0), |
| 38 received_bytes(0), |
| 39 total_bytes(0), |
| 40 state(-1), |
| 41 download_id(-1), |
| 42 has_user_gesture(false), |
| 43 db_handle(0), |
| 44 prompt_user_for_save_location(false), |
| 45 is_dangerous_file(false), |
| 46 is_dangerous_url(false), |
| 47 is_extension_install(false) { |
| 48 } |
| 49 |
| 50 DownloadCreateInfo::~DownloadCreateInfo() { |
| 51 } |
| 52 |
| 53 std::string DownloadCreateInfo::DebugString() const { |
| 54 return base::StringPrintf("{" |
| 55 " download_id = %d" |
| 56 " url = \"%s\"" |
| 57 " path = \"%" PRFilePath "\"" |
| 58 " received_bytes = %" PRId64 |
| 59 " total_bytes = %" PRId64 |
| 60 " child_id = %d" |
| 61 " render_view_id = %d" |
| 62 " request_id = %d" |
| 63 " prompt_user_for_save_location = %c" |
| 64 " }", |
| 65 download_id, |
| 66 url().spec().c_str(), |
| 67 path.value().c_str(), |
| 68 received_bytes, |
| 69 total_bytes, |
| 70 process_handle.child_id(), |
| 71 process_handle.render_view_id(), |
| 72 process_handle.request_id(), |
| 73 prompt_user_for_save_location ? 'T' : 'F'); |
| 74 } |
| 75 |
| 76 const GURL& DownloadCreateInfo::url() const { |
| 77 return url_chain.empty() ? GURL::EmptyGURL() : url_chain.back(); |
| 78 } |
OLD | NEW |