Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: chrome/browser/history/download_history_info.cc

Issue 6969009: Reduced the lifetime of DownloadCreateInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with trunk Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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/history/download_history_info.h"
6
7 #include "chrome/browser/download/download_item.h"
Paweł Hajdan Jr. 2011/05/19 16:18:25 If possible I'd like to avoid a dependency on down
Randy Smith (Not in Mondays) 2011/05/19 17:05:27 That makes sense to me. My guess is that the depe
Paweł Hajdan Jr. 2011/05/19 19:11:24 I'd prefer an accessor that returns a copy of Down
ahendrickson 2011/05/19 20:16:49 Done.
8
9 DownloadHistoryInfo::DownloadHistoryInfo()
10 : download_id(-1),
11 received_bytes(0),
12 total_bytes(0),
13 state(0),
14 db_handle(0) {
15 }
16
17 DownloadHistoryInfo::DownloadHistoryInfo(const DownloadItem& item)
18 : download_id(item.id()),
19 path(item.full_path()),
20 url_chain(item.url_chain()),
21 referrer_url(item.referrer_url()),
22 start_time(item.start_time()),
23 received_bytes(item.received_bytes()),
24 total_bytes(item.total_bytes()),
25 state(item.state()),
26 db_handle(item.db_handle()) {
27 }
28
29 DownloadHistoryInfo::DownloadHistoryInfo(const std::vector<GURL>& urls,
30 const GURL& referrer,
31 int64 total_bytes)
32 : download_id(-1),
33 url_chain(urls),
34 referrer_url(referrer),
35 start_time(base::Time::Now()),
36 received_bytes(0),
37 total_bytes(total_bytes),
38 state(0),
39 db_handle(0) {
40 }
41
42 DownloadHistoryInfo::DownloadHistoryInfo(const FilePath& path,
43 const GURL& url,
44 const base::Time& start,
45 int64 received,
46 int64 total,
47 int32 download_state)
48 : download_id(1),
49 path(path),
50 url_chain(1, url),
51 start_time(start),
52 received_bytes(received),
53 total_bytes(total),
54 state(download_state),
55 db_handle(0) {
56 }
57
58 DownloadHistoryInfo::DownloadHistoryInfo(const FilePath& path,
59 const std::vector<GURL>& url,
60 const GURL& referrer,
61 const base::Time& start,
62 int64 received,
63 int64 total,
64 int32 download_state,
65 int64 handle,
66 int32 id)
67 : download_id(id),
68 path(path),
69 url_chain(url),
70 referrer_url(referrer),
71 start_time(start),
72 received_bytes(received),
73 total_bytes(total),
74 state(download_state),
75 db_handle(handle) {
76 }
77
78 const GURL& DownloadHistoryInfo::url() const {
79 return url_chain.empty() ? GURL::EmptyGURL() : url_chain.back();
80 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698