Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/download/download_history.h" | 5 #include "chrome/browser/download/download_history.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 if (!slow_create_download_) | 82 if (!slow_create_download_) |
| 83 FinishCreateDownload(); | 83 FinishCreateDownload(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void FinishCreateDownload() { | 86 void FinishCreateDownload() { |
| 87 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 87 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 88 create_download_callback_.Run(); | 88 create_download_callback_.Run(); |
| 89 create_download_callback_.Reset(); | 89 create_download_callback_.Reset(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void UpdateDownload(const history::DownloadRow& info) override { | 92 void UpdateDownload(const history::DownloadRow& info, |
| 93 bool should_commit_immediately) override { | |
| 93 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 94 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 94 update_download_ = info; | 95 update_download_ = info; |
|
asanka
2016/11/16 23:15:57
Store should_commit_immediately bit and test that
qinmin
2016/11/17 00:46:30
Done.
| |
| 95 } | 96 } |
| 96 | 97 |
| 97 void RemoveDownloads(const IdSet& ids) override { | 98 void RemoveDownloads(const IdSet& ids) override { |
| 98 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 99 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 99 for (IdSet::const_iterator it = ids.begin(); | 100 for (IdSet::const_iterator it = ids.begin(); |
| 100 it != ids.end(); ++it) { | 101 it != ids.end(); ++it) { |
| 101 remove_downloads_.insert(*it); | 102 remove_downloads_.insert(*it); |
| 102 } | 103 } |
| 103 } | 104 } |
| 104 | 105 |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 895 FinishCreateDownload(); | 896 FinishCreateDownload(); |
| 896 EXPECT_TRUE(DownloadHistory::IsPersisted(&item(0))); | 897 EXPECT_TRUE(DownloadHistory::IsPersisted(&item(0))); |
| 897 | 898 |
| 898 // ItemAdded should call OnDownloadUpdated, which should detect that the item | 899 // ItemAdded should call OnDownloadUpdated, which should detect that the item |
| 899 // changed while it was being added and call UpdateDownload immediately. | 900 // changed while it was being added and call UpdateDownload immediately. |
| 900 info.opened = true; | 901 info.opened = true; |
| 901 ExpectDownloadUpdated(info); | 902 ExpectDownloadUpdated(info); |
| 902 } | 903 } |
| 903 | 904 |
| 904 } // anonymous namespace | 905 } // anonymous namespace |
| OLD | NEW |