Respond with QuotaExceededError when IndexedDB has no disk space on open.
[chromium-blink-merge.git] / content / browser / download / download_create_info.cc
blob8c47cabd038064be28085248c14968d353a791b6
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
3 // found in the LICENSE file.
5 #include "content/browser/download/download_create_info.h"
7 #include <string>
9 #include "base/format_macros.h"
10 #include "base/strings/stringprintf.h"
12 namespace content {
14 DownloadCreateInfo::DownloadCreateInfo(
15 const base::Time& start_time,
16 int64 total_bytes,
17 const net::BoundNetLog& bound_net_log,
18 bool has_user_gesture,
19 PageTransition transition_type)
20 : start_time(start_time),
21 total_bytes(total_bytes),
22 download_id(DownloadItem::kInvalidId),
23 has_user_gesture(has_user_gesture),
24 transition_type(transition_type),
25 save_info(new DownloadSaveInfo()),
26 request_bound_net_log(bound_net_log) {
29 DownloadCreateInfo::DownloadCreateInfo()
30 : total_bytes(0),
31 download_id(DownloadItem::kInvalidId),
32 has_user_gesture(false),
33 transition_type(PAGE_TRANSITION_LINK),
34 save_info(new DownloadSaveInfo()) {
37 DownloadCreateInfo::~DownloadCreateInfo() {
40 std::string DownloadCreateInfo::DebugString() const {
41 return base::StringPrintf("{"
42 " download_id = %u"
43 " url = \"%s\""
44 " request_handle = %s"
45 " total_bytes = %" PRId64
46 " }",
47 download_id,
48 url().spec().c_str(),
49 request_handle.DebugString().c_str(),
50 total_bytes);
53 const GURL& DownloadCreateInfo::url() const {
54 return url_chain.empty() ? GURL::EmptyGURL() : url_chain.back();
57 } // namespace content