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

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: Rebase + Fixed win compile error by implementing GetMTPStorageInfoFromDeviceId in TestStorageNotifi… 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..8b1be40f85379c8fd4b9d9ac47a02ce9c6f82c42
--- /dev/null
+++ b/chrome/browser/media_gallery/win/mtp_device_object_enumerator.cc
@@ -0,0 +1,52 @@
+// Copyright (c) 2013 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_++));
+ return FilePath(current_object_->name);
+}
+
+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