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

Side by Side Diff: components/history/core/browser/download_row.cc

Issue 1781983002: [Downloads] Introduce GUIDs for downloads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 "components/history/core/browser/download_row.h" 5 #include "components/history/core/browser/download_row.h"
6 6
7 #include "components/history/core/browser/download_constants.h" 7 #include "components/history/core/browser/download_constants.h"
8 8
9 namespace history { 9 namespace history {
10 10
11 DownloadRow::DownloadRow() 11 DownloadRow::DownloadRow()
12 : received_bytes(0), 12 : received_bytes(0),
13 total_bytes(0), 13 total_bytes(0),
14 state(DownloadState::IN_PROGRESS), 14 state(DownloadState::IN_PROGRESS),
15 danger_type(DownloadDangerType::NOT_DANGEROUS), 15 danger_type(DownloadDangerType::NOT_DANGEROUS),
16 interrupt_reason(0),
16 id(kInvalidDownloadId), 17 id(kInvalidDownloadId),
17 opened(false) { 18 opened(false) {
18 // |interrupt_reason| is left undefined by this constructor as the value 19 // |interrupt_reason| is left undefined by this constructor as the value
19 // has no meaning unless |state| is equal to kStateInterrupted. 20 // has no meaning unless |state| is equal to kStateInterrupted.
20 } 21 }
21 22
22 DownloadRow::DownloadRow(const base::FilePath& current_path, 23 DownloadRow::DownloadRow(const base::FilePath& current_path,
23 const base::FilePath& target_path, 24 const base::FilePath& target_path,
24 const std::vector<GURL>& url_chain, 25 const std::vector<GURL>& url_chain,
25 const GURL& referrer, 26 const GURL& referrer,
27 const std::string& http_method,
26 const std::string& mime_type, 28 const std::string& mime_type,
27 const std::string& original_mime_type, 29 const std::string& original_mime_type,
28 const base::Time& start, 30 const base::Time& start,
29 const base::Time& end, 31 const base::Time& end,
30 const std::string& etag, 32 const std::string& etag,
31 const std::string& last_modified, 33 const std::string& last_modified,
32 int64_t received, 34 int64_t received,
33 int64_t total, 35 int64_t total,
34 DownloadState download_state, 36 DownloadState download_state,
35 DownloadDangerType danger_type, 37 DownloadDangerType danger_type,
36 DownloadInterruptReason interrupt_reason, 38 DownloadInterruptReason interrupt_reason,
39 const std::string& hash,
37 DownloadId id, 40 DownloadId id,
41 const std::string& guid,
38 bool download_opened, 42 bool download_opened,
39 const std::string& ext_id, 43 const std::string& ext_id,
40 const std::string& ext_name) 44 const std::string& ext_name)
41 : current_path(current_path), 45 : current_path(current_path),
42 target_path(target_path), 46 target_path(target_path),
43 url_chain(url_chain), 47 url_chain(url_chain),
44 referrer_url(referrer), 48 referrer_url(referrer),
49 http_method(http_method),
45 mime_type(mime_type), 50 mime_type(mime_type),
46 original_mime_type(original_mime_type), 51 original_mime_type(original_mime_type),
47 start_time(start), 52 start_time(start),
48 end_time(end), 53 end_time(end),
49 etag(etag), 54 etag(etag),
50 last_modified(last_modified), 55 last_modified(last_modified),
51 received_bytes(received), 56 received_bytes(received),
52 total_bytes(total), 57 total_bytes(total),
53 state(download_state), 58 state(download_state),
54 danger_type(danger_type), 59 danger_type(danger_type),
55 interrupt_reason(interrupt_reason), 60 interrupt_reason(interrupt_reason),
61 hash(hash),
56 id(id), 62 id(id),
63 guid(guid),
57 opened(download_opened), 64 opened(download_opened),
58 by_ext_id(ext_id), 65 by_ext_id(ext_id),
59 by_ext_name(ext_name) {} 66 by_ext_name(ext_name) {}
60 67
61 DownloadRow::DownloadRow(const DownloadRow& other) = default; 68 DownloadRow::DownloadRow(const DownloadRow& other) = default;
62 69
63 DownloadRow::~DownloadRow() { 70 DownloadRow::~DownloadRow() {}
71
72 bool DownloadRow::operator==(const DownloadRow& rhs) const {
svaldez 2016/03/14 16:59:50 Are the // for formatting?
asanka 2016/03/14 19:18:33 Yeah. It was pretty unreadable when all the clause
73 return current_path == rhs.current_path && //
74 target_path == rhs.target_path && //
75 url_chain == rhs.url_chain && //
76 referrer_url == rhs.referrer_url && //
77 http_method == rhs.http_method && //
78 mime_type == rhs.mime_type && //
79 original_mime_type == rhs.original_mime_type && //
80 start_time == rhs.start_time && //
81 end_time == rhs.end_time && //
82 etag == rhs.etag && //
83 last_modified == rhs.last_modified && //
84 received_bytes == rhs.received_bytes && //
85 total_bytes == rhs.total_bytes && //
86 state == rhs.state && //
87 danger_type == rhs.danger_type && //
88 interrupt_reason == rhs.interrupt_reason && //
89 hash == rhs.hash && //
90 id == rhs.id && //
91 guid == rhs.guid && //
92 opened == rhs.opened && //
93 by_ext_id == rhs.by_ext_id && //
94 by_ext_name == rhs.by_ext_name;
64 } 95 }
65 96
66 } // namespace history 97 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698