OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/browsing_data/downloads_counter.h" | 5 #include "chrome/browser/browsing_data/downloads_counter.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/guid.h" | 10 #include "base/guid.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 std::vector<GURL> url_chain; | 127 std::vector<GURL> url_chain; |
128 url_chain.push_back(url); | 128 url_chain.push_back(url); |
129 | 129 |
130 content::DownloadManager* manager = incognito ? otr_manager_ : manager_; | 130 content::DownloadManager* manager = incognito ? otr_manager_ : manager_; |
131 manager->CreateDownloadItem( | 131 manager->CreateDownloadItem( |
132 guid, content::DownloadItem::kInvalidId + (++items_count_), | 132 guid, content::DownloadItem::kInvalidId + (++items_count_), |
133 base::FilePath(FILE_PATH_LITERAL("current/path")), | 133 base::FilePath(FILE_PATH_LITERAL("current/path")), |
134 base::FilePath(FILE_PATH_LITERAL("target/path")), url_chain, GURL(), | 134 base::FilePath(FILE_PATH_LITERAL("target/path")), url_chain, GURL(), |
135 GURL(), GURL(), GURL(), mime_type, std::string(), time_, time_, | 135 GURL(), GURL(), GURL(), mime_type, std::string(), time_, time_, |
136 std::string(), std::string(), 1, 1, std::string(), state, danger, | 136 std::string(), std::string(), 1, 1, std::string(), state, danger, |
137 reason, false, time_, | 137 reason, false, time_, false, |
138 std::vector<content::DownloadItem::ReceivedSlice>()); | 138 std::vector<content::DownloadItem::ReceivedSlice>()); |
139 | 139 |
140 return guid; | 140 return guid; |
141 } | 141 } |
142 | 142 |
143 void RemoveDownload(const std::string& guid) { | 143 void RemoveDownload(const std::string& guid) { |
144 content::DownloadItem* item = manager_->GetDownloadByGuid(guid); | 144 content::DownloadItem* item = manager_->GetDownloadByGuid(guid); |
145 ids_to_remove_.insert(item->GetId()); | 145 ids_to_remove_.insert(item->GetId()); |
146 item->Remove(); | 146 item->Remove(); |
147 } | 147 } |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 EXPECT_EQ(7u, GetResult()); | 378 EXPECT_EQ(7u, GetResult()); |
379 | 379 |
380 SetDeletionPeriodPref(browsing_data::TimePeriod::FOUR_WEEKS); | 380 SetDeletionPeriodPref(browsing_data::TimePeriod::FOUR_WEEKS); |
381 EXPECT_EQ(8u, GetResult()); | 381 EXPECT_EQ(8u, GetResult()); |
382 | 382 |
383 SetDeletionPeriodPref(browsing_data::TimePeriod::ALL_TIME); | 383 SetDeletionPeriodPref(browsing_data::TimePeriod::ALL_TIME); |
384 EXPECT_EQ(11u, GetResult()); | 384 EXPECT_EQ(11u, GetResult()); |
385 } | 385 } |
386 | 386 |
387 } // namespace | 387 } // namespace |
OLD | NEW |