| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | |
| 11 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
| 12 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 14 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 13 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 15 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 16 #include "webkit/browser/fileapi/file_system_context.h" | 15 #include "webkit/browser/fileapi/file_system_context.h" |
| 17 #include "webkit/browser/fileapi/file_system_quota_util.h" | 16 #include "webkit/browser/fileapi/file_system_quota_util.h" |
| 18 #include "webkit/common/fileapi/file_system_types.h" | 17 #include "webkit/common/fileapi/file_system_types.h" |
| 19 | 18 |
| 20 using content::BrowserThread; | 19 using content::BrowserThread; |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 } | 247 } |
| 249 | 248 |
| 250 size_t CannedBrowsingDataFileSystemHelper::GetFileSystemCount() const { | 249 size_t CannedBrowsingDataFileSystemHelper::GetFileSystemCount() const { |
| 251 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 250 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 252 return file_system_info_.size(); | 251 return file_system_info_.size(); |
| 253 } | 252 } |
| 254 | 253 |
| 255 void CannedBrowsingDataFileSystemHelper::StartFetching( | 254 void CannedBrowsingDataFileSystemHelper::StartFetching( |
| 256 const base::Callback<void(const std::list<FileSystemInfo>&)>& callback) { | 255 const base::Callback<void(const std::list<FileSystemInfo>&)>& callback) { |
| 257 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 256 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 258 DCHECK(!is_fetching_); | 257 DCHECK(!callback.is_null()); |
| 259 DCHECK_EQ(false, callback.is_null()); | |
| 260 is_fetching_ = true; | |
| 261 completion_callback_ = callback; | |
| 262 | 258 |
| 263 BrowserThread::PostTask( | 259 BrowserThread::PostTask( |
| 264 BrowserThread::UI, FROM_HERE, | 260 BrowserThread::UI, FROM_HERE, base::Bind(callback, file_system_info_)); |
| 265 base::Bind(&CannedBrowsingDataFileSystemHelper::NotifyOnUIThread, this)); | |
| 266 } | 261 } |
| 267 | |
| 268 void CannedBrowsingDataFileSystemHelper::NotifyOnUIThread() { | |
| 269 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 270 DCHECK(is_fetching_); | |
| 271 completion_callback_.Run(file_system_info_); | |
| 272 completion_callback_.Reset(); | |
| 273 is_fetching_ = false; | |
| 274 } | |
| OLD | NEW |