summaryrefslogtreecommitdiffstats
path: root/chrome/browser/history/download_create_info.cc
blob: 67ffdc70ab1641409f9b584dcbf517ad065718db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/history/download_create_info.h"

#include <string>

#include "base/format_macros.h"
#include "base/stringprintf.h"

DownloadCreateInfo::DownloadCreateInfo(const FilePath& path,
                                       const GURL& url,
                                       base::Time start_time,
                                       int64 received_bytes,
                                       int64 total_bytes,
                                       int32 state,
                                       int32 download_id)
    : path(path),
      url(url),
      path_uniquifier(0),
      start_time(start_time),
      received_bytes(received_bytes),
      total_bytes(total_bytes),
      state(state),
      download_id(download_id),
      child_id(-1),
      render_view_id(-1),
      request_id(-1),
      db_handle(0),
      prompt_user_for_save_location(false),
      is_dangerous(false),
      is_extension_install(false) {
}

DownloadCreateInfo::DownloadCreateInfo()
    : path_uniquifier(0),
      received_bytes(0),
      total_bytes(0),
      state(-1),
      download_id(-1),
      child_id(-1),
      render_view_id(-1),
      request_id(-1),
      db_handle(0),
      prompt_user_for_save_location(false),
      is_dangerous(false),
      is_extension_install(false) {
}

DownloadCreateInfo::~DownloadCreateInfo() {
}

std::string DownloadCreateInfo::DebugString() const {
  return base::StringPrintf("{"
                            " url_ = \"%s\""
                            " path = \"%s\""
                            " received_bytes = %" PRId64
                            " total_bytes = %" PRId64
                            " child_id = %d"
                            " render_view_id = %d"
                            " request_id = %d"
                            " download_id = %d"
                            " prompt_user_for_save_location = %c"
                            " }",
                            url.spec().c_str(),
                            path.value().c_str(),
                            received_bytes,
                            total_bytes,
                            child_id,
                            render_view_id,
                            request_id,
                            download_id,
                            prompt_user_for_save_location ? 'T' : 'F');
}