Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: chrome/browser/media_gallery/win/mtp_device_object_enumerator.cc

Issue 11297002: [Media Gallery] Added code to support mtp device media file system on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + IWYU Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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/thread_restrictions.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()) {
Lei Zhang 2013/01/15 22:35:50 You should initialize |current_object_| to NULL.
kmadhusu 2013/01/15 23:41:58 Done.
18 base::ThreadRestrictions::AssertIOAllowed();
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())
Lei Zhang 2013/01/15 22:35:50 If we reached the end, |current_object_| still poi
kmadhusu 2013/01/15 23:41:58 Fixed.
28 return FilePath();
29
30 current_object_ = &(*(object_entry_iter_++));
31 if (current_object_)
32 return FilePath(current_object_->name);
33 return FilePath();
34 }
35
36 int64 MTPDeviceObjectEnumerator::Size() {
37 DCHECK(thread_checker_.CalledOnValidThread());
38 return current_object_ ? current_object_->size : 0;
39 }
40
41 bool MTPDeviceObjectEnumerator::IsDirectory() {
42 DCHECK(thread_checker_.CalledOnValidThread());
43 return current_object_ ? current_object_->is_directory : false;
44 }
45
46 base::Time MTPDeviceObjectEnumerator::LastModifiedTime() {
47 DCHECK(thread_checker_.CalledOnValidThread());
48 return current_object_ ? current_object_->last_modified_time : base::Time();
49 }
50
51 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698