| 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/browsing_data/browsing_data_file_system_helper.h" | 5 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 BrowsingDataFileSystemHelperImpl::~BrowsingDataFileSystemHelperImpl() { | 70 BrowsingDataFileSystemHelperImpl::~BrowsingDataFileSystemHelperImpl() { |
| 71 } | 71 } |
| 72 | 72 |
| 73 void BrowsingDataFileSystemHelperImpl::StartFetching( | 73 void BrowsingDataFileSystemHelperImpl::StartFetching( |
| 74 const FetchCallback& callback) { | 74 const FetchCallback& callback) { |
| 75 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 75 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 76 DCHECK(!callback.is_null()); | 76 DCHECK(!callback.is_null()); |
| 77 file_task_runner()->PostTask( | 77 file_task_runner()->PostTask( |
| 78 FROM_HERE, | 78 FROM_HERE, |
| 79 base::Bind( | 79 base::BindOnce( |
| 80 &BrowsingDataFileSystemHelperImpl::FetchFileSystemInfoInFileThread, | 80 &BrowsingDataFileSystemHelperImpl::FetchFileSystemInfoInFileThread, |
| 81 this, callback)); | 81 this, callback)); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void BrowsingDataFileSystemHelperImpl::DeleteFileSystemOrigin( | 84 void BrowsingDataFileSystemHelperImpl::DeleteFileSystemOrigin( |
| 85 const GURL& origin) { | 85 const GURL& origin) { |
| 86 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 86 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 87 file_task_runner()->PostTask( | 87 file_task_runner()->PostTask( |
| 88 FROM_HERE, | 88 FROM_HERE, |
| 89 base::Bind( | 89 base::BindOnce( |
| 90 &BrowsingDataFileSystemHelperImpl::DeleteFileSystemOriginInFileThread, | 90 &BrowsingDataFileSystemHelperImpl::DeleteFileSystemOriginInFileThread, |
| 91 this, origin)); | 91 this, origin)); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void BrowsingDataFileSystemHelperImpl::FetchFileSystemInfoInFileThread( | 94 void BrowsingDataFileSystemHelperImpl::FetchFileSystemInfoInFileThread( |
| 95 const FetchCallback& callback) { | 95 const FetchCallback& callback) { |
| 96 DCHECK(file_task_runner()->RunsTasksOnCurrentThread()); | 96 DCHECK(file_task_runner()->RunsTasksOnCurrentThread()); |
| 97 DCHECK(!callback.is_null()); | 97 DCHECK(!callback.is_null()); |
| 98 | 98 |
| 99 // We check usage for these filesystem types. | 99 // We check usage for these filesystem types. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 124 file_system_info_map.insert( | 124 file_system_info_map.insert( |
| 125 std::make_pair(current, FileSystemInfo(current))).first; | 125 std::make_pair(current, FileSystemInfo(current))).first; |
| 126 inserted->second.usage_map[type] = usage; | 126 inserted->second.usage_map[type] = usage; |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 | 129 |
| 130 for (const auto& iter : file_system_info_map) | 130 for (const auto& iter : file_system_info_map) |
| 131 result.push_back(iter.second); | 131 result.push_back(iter.second); |
| 132 | 132 |
| 133 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 133 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 134 base::Bind(callback, result)); | 134 base::BindOnce(callback, result)); |
| 135 } | 135 } |
| 136 | 136 |
| 137 void BrowsingDataFileSystemHelperImpl::DeleteFileSystemOriginInFileThread( | 137 void BrowsingDataFileSystemHelperImpl::DeleteFileSystemOriginInFileThread( |
| 138 const GURL& origin) { | 138 const GURL& origin) { |
| 139 DCHECK(file_task_runner()->RunsTasksOnCurrentThread()); | 139 DCHECK(file_task_runner()->RunsTasksOnCurrentThread()); |
| 140 filesystem_context_->DeleteDataForOriginOnFileTaskRunner(origin); | 140 filesystem_context_->DeleteDataForOriginOnFileTaskRunner(origin); |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace | 143 } // namespace |
| 144 | 144 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 size_t CannedBrowsingDataFileSystemHelper::GetFileSystemCount() const { | 201 size_t CannedBrowsingDataFileSystemHelper::GetFileSystemCount() const { |
| 202 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 202 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 203 return file_system_info_.size(); | 203 return file_system_info_.size(); |
| 204 } | 204 } |
| 205 | 205 |
| 206 void CannedBrowsingDataFileSystemHelper::StartFetching( | 206 void CannedBrowsingDataFileSystemHelper::StartFetching( |
| 207 const FetchCallback& callback) { | 207 const FetchCallback& callback) { |
| 208 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 208 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 209 DCHECK(!callback.is_null()); | 209 DCHECK(!callback.is_null()); |
| 210 | 210 |
| 211 BrowserThread::PostTask( | 211 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 212 BrowserThread::UI, FROM_HERE, base::Bind(callback, file_system_info_)); | 212 base::BindOnce(callback, file_system_info_)); |
| 213 } | 213 } |
| OLD | NEW |