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

Unified Diff: webkit/fileapi/media/mtp_device_interface_impl_linux.cc

Issue 10781014: Isolated FS for media devices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 8 years, 5 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: webkit/fileapi/media/mtp_device_interface_impl_linux.cc
diff --git a/webkit/fileapi/media/mtp_device_interface_impl_linux.cc b/webkit/fileapi/media/mtp_device_interface_impl_linux.cc
new file mode 100644
index 0000000000000000000000000000000000000000..06d3b088eaa5393f0e25dc45e10cdd00b508b0b8
--- /dev/null
+++ b/webkit/fileapi/media/mtp_device_interface_impl_linux.cc
@@ -0,0 +1,95 @@
+// 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.
+
+#include "webkit/fileapi/media/mtp_device_interface_impl_linux.h"
+
+#include "base/sequenced_task_runner.h"
+
+namespace fileapi {
+
+MtpDeviceInterfaceImplLinux::MtpDeviceInterfaceImplLinux(
+ const FilePath::StringType& device_id,
+ base::SequencedTaskRunner* media_task_runner)
+ : device_id_(device_id),
+ media_task_runner_(media_task_runner) {
+ // Initialize the device in LazyInit() function.
+ // This object is constructed on IO thread.
+}
+
+MtpDeviceInterfaceImplLinux::~MtpDeviceInterfaceImplLinux() {
+ // Do the clean up in DeleteOnCurrentThread() function.
+ // This object is destructed by media_task_runner.
+}
+
+bool MtpDeviceInterfaceImplLinux::LazyInit() {
+ if (!media_task_runner_->RunsTasksOnCurrentThread())
+ return false;
+
+ // TODO(kmadhusu, thestig): Open the device for communication. If is already
+ // opened, return.
+ return true;
+}
+
+void MtpDeviceInterfaceImplLinux::DeleteOnCorrectThread() const {
+ media_task_runner_->DeleteSoon(FROM_HERE, this);
+}
+
+
+PlatformFileError MtpDeviceInterfaceImplLinux::GetFileInfo(
+ const FilePath& file_path,
+ PlatformFileInfo* file_info) {
+ if (!LazyInit())
+ return base::PLATFORM_FILE_ERROR_SECURITY;
+
+ NOTIMPLEMENTED();
+ return base::PLATFORM_FILE_ERROR_SECURITY;
+}
+
+FileSystemFileUtil::AbstractFileEnumerator*
+ MtpDeviceInterfaceImplLinux::CreateFileEnumerator(
+ const FilePath& root,
+ bool recursive) {
+ if (!LazyInit())
+ return new FileSystemFileUtil::EmptyFileEnumerator();
+
+ NOTIMPLEMENTED();
+ return new FileSystemFileUtil::EmptyFileEnumerator();
+}
+
+PlatformFileError MtpDeviceInterfaceImplLinux::Touch(
+ const FilePath& file_path,
+ const base::Time& last_access_time,
+ const base::Time& last_modified_time) {
+ if (!LazyInit())
+ return base::PLATFORM_FILE_ERROR_SECURITY;
+
+ NOTIMPLEMENTED();
+ return base::PLATFORM_FILE_ERROR_SECURITY;
+}
+
+bool MtpDeviceInterfaceImplLinux::PathExists(const FilePath& file_path) {
+ if (!LazyInit())
+ return false;
+
+ NOTIMPLEMENTED();
+ return false;
+}
+
+bool MtpDeviceInterfaceImplLinux::DirectoryExists(const FilePath& file_path) {
+ if (!LazyInit())
+ return false;
+
+ NOTIMPLEMENTED();
+ return false;
+}
+
+bool MtpDeviceInterfaceImplLinux::IsDirectoryEmpty(const FilePath& file_path) {
+ if (!LazyInit())
+ return false;
+
+ NOTIMPLEMENTED();
+ return true;
+}
+
+} // namespace fileapi

Powered by Google App Engine
This is Rietveld 408576698