| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 122       const GURL& url, | 122       const GURL& url, | 
| 123       std::string mime_type, | 123       std::string mime_type, | 
| 124       bool incognito) { | 124       bool incognito) { | 
| 125     std::string guid = base::ToUpperASCII(base::GenerateGUID()); | 125     std::string guid = base::ToUpperASCII(base::GenerateGUID()); | 
| 126 | 126 | 
| 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, | 132         guid, content::DownloadItem::kInvalidId + (++items_count_), | 
| 133         content::DownloadItem::kInvalidId + (++items_count_), |  | 
| 134         base::FilePath(FILE_PATH_LITERAL("current/path")), | 133         base::FilePath(FILE_PATH_LITERAL("current/path")), | 
| 135         base::FilePath(FILE_PATH_LITERAL("target/path")), | 134         base::FilePath(FILE_PATH_LITERAL("target/path")), url_chain, GURL(), | 
| 136         url_chain, | 135         GURL(), GURL(), GURL(), mime_type, std::string(), time_, time_, | 
| 137         GURL(), | 136         std::string(), std::string(), 1, 1, std::string(), state, danger, | 
| 138         GURL(), | 137         reason, false, time_, | 
| 139         GURL(), |  | 
| 140         GURL(), |  | 
| 141         mime_type, |  | 
| 142         std::string(), |  | 
| 143         time_, |  | 
| 144         time_, |  | 
| 145         std::string(), |  | 
| 146         std::string(), |  | 
| 147         1, |  | 
| 148         1, |  | 
| 149         std::string(), |  | 
| 150         state, |  | 
| 151         danger, |  | 
| 152         reason, |  | 
| 153         false, |  | 
| 154         std::vector<content::DownloadItem::ReceivedSlice>()); | 138         std::vector<content::DownloadItem::ReceivedSlice>()); | 
| 155 | 139 | 
| 156     return guid; | 140     return guid; | 
| 157   } | 141   } | 
| 158 | 142 | 
| 159   void RemoveDownload(const std::string& guid) { | 143   void RemoveDownload(const std::string& guid) { | 
| 160     content::DownloadItem* item = manager_->GetDownloadByGuid(guid); | 144     content::DownloadItem* item = manager_->GetDownloadByGuid(guid); | 
| 161     ids_to_remove_.insert(item->GetId()); | 145     ids_to_remove_.insert(item->GetId()); | 
| 162     item->Remove(); | 146     item->Remove(); | 
| 163   } | 147   } | 
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 390   EXPECT_EQ(7u, GetResult()); | 374   EXPECT_EQ(7u, GetResult()); | 
| 391 | 375 | 
| 392   SetDeletionPeriodPref(browsing_data::FOUR_WEEKS); | 376   SetDeletionPeriodPref(browsing_data::FOUR_WEEKS); | 
| 393   EXPECT_EQ(8u, GetResult()); | 377   EXPECT_EQ(8u, GetResult()); | 
| 394 | 378 | 
| 395   SetDeletionPeriodPref(browsing_data::ALL_TIME); | 379   SetDeletionPeriodPref(browsing_data::ALL_TIME); | 
| 396   EXPECT_EQ(11u, GetResult()); | 380   EXPECT_EQ(11u, GetResult()); | 
| 397 } | 381 } | 
| 398 | 382 | 
| 399 }  // namespace | 383 }  // namespace | 
| OLD | NEW | 
|---|