| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 // |
| 5 // MTPDeviceObjectEnumerator implementation. |
| 6 |
| 7 #include "chrome/browser/media_gallery/win/mtp_device_object_enumerator.h" |
| 8 |
| 9 #include "base/threading/sequenced_worker_pool.h" |
| 10 #include "content/public/browser/browser_thread.h" |
| 11 |
| 12 namespace chrome { |
| 13 |
| 14 MTPDeviceObjectEnumerator::MTPDeviceObjectEnumerator( |
| 15 const MTPDeviceObjectEntries& entries) |
| 16 : object_entries_(entries), |
| 17 object_entry_iter_(object_entries_.begin()) { |
| 18 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| 19 } |
| 20 |
| 21 MTPDeviceObjectEnumerator::~MTPDeviceObjectEnumerator() { |
| 22 DCHECK(thread_checker_.CalledOnValidThread()); |
| 23 } |
| 24 |
| 25 FilePath MTPDeviceObjectEnumerator::Next() { |
| 26 DCHECK(thread_checker_.CalledOnValidThread()); |
| 27 if (object_entry_iter_ == object_entries_.end()) |
| 28 return FilePath(); |
| 29 |
| 30 current_object_ = *object_entry_iter_; |
| 31 ++object_entry_iter_; |
| 32 return FilePath(current_object_.file_name()); |
| 33 } |
| 34 |
| 35 int64 MTPDeviceObjectEnumerator::Size() { |
| 36 DCHECK(thread_checker_.CalledOnValidThread()); |
| 37 return current_object_.size(); |
| 38 } |
| 39 |
| 40 bool MTPDeviceObjectEnumerator::IsDirectory() { |
| 41 DCHECK(thread_checker_.CalledOnValidThread()); |
| 42 return current_object_.is_directory(); |
| 43 } |
| 44 |
| 45 base::Time MTPDeviceObjectEnumerator::LastModifiedTime() { |
| 46 DCHECK(thread_checker_.CalledOnValidThread()); |
| 47 return current_object_.last_modified_time(); |
| 48 } |
| 49 |
| 50 } // namespace chrome |
| OLD | NEW |