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

Unified 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: Addressed comments 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media_gallery/win/mtp_device_object_enumerator.cc
diff --git a/chrome/browser/media_gallery/win/mtp_device_object_enumerator.cc b/chrome/browser/media_gallery/win/mtp_device_object_enumerator.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ff9751b8e6ce6b7cb881261cd2a7f9ced59e84bc
--- /dev/null
+++ b/chrome/browser/media_gallery/win/mtp_device_object_enumerator.cc
@@ -0,0 +1,54 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// MTPDeviceObjectEnumerator implementation.
+
+#include "chrome/browser/media_gallery/win/mtp_device_object_enumerator.h"
+
+#include "base/threading/thread_restrictions.h"
+#include "content/public/browser/browser_thread.h"
+
+namespace chrome {
+
+MTPDeviceObjectEnumerator::MTPDeviceObjectEnumerator(
+ const MTPDeviceObjectEntries& entries)
+ : object_entries_(entries),
+ object_entry_iter_(object_entries_.begin()),
+ current_object_(NULL) {
+ base::ThreadRestrictions::AssertIOAllowed();
+}
+
+MTPDeviceObjectEnumerator::~MTPDeviceObjectEnumerator() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+}
+
+FilePath MTPDeviceObjectEnumerator::Next() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ if (object_entry_iter_ == object_entries_.end()) {
+ current_object_ = NULL;
+ return FilePath();
+ }
+
+ current_object_ = &(*(object_entry_iter_++));
+ if (current_object_)
Lei Zhang 2013/01/16 00:34:46 BTW, |current_object_| cannot be NULL.
kmadhusu 2013/01/16 01:36:59 Fixed.
+ return FilePath(current_object_->name);
+ return FilePath();
+}
+
+int64 MTPDeviceObjectEnumerator::Size() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ return current_object_ ? current_object_->size : 0;
+}
+
+bool MTPDeviceObjectEnumerator::IsDirectory() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ return current_object_ ? current_object_->is_directory : false;
+}
+
+base::Time MTPDeviceObjectEnumerator::LastModifiedTime() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ return current_object_ ? current_object_->last_modified_time : base::Time();
+}
+
+} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698