Index: webkit/fileapi/mtp_device_interface_linux.h |
diff --git a/webkit/fileapi/mtp_device_interface_linux.h b/webkit/fileapi/mtp_device_interface_linux.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..39d892a61a242d1246867a3e85ef3063148fd297 |
--- /dev/null |
+++ b/webkit/fileapi/mtp_device_interface_linux.h |
@@ -0,0 +1,59 @@ |
+// 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. |
+ |
+#ifndef WEBKIT_FILEAPI_MTP_DEVICE_INTERFACE_LINUX_H_ |
+#define WEBKIT_FILEAPI_MTP_DEVICE_INTERFACE_LINUX_H_ |
+ |
+#include "base/file_path.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/platform_file.h" |
+#include "base/timer.h" |
+#include "webkit/fileapi/file_system_file_util.h" |
+ |
+namespace base { |
+struct PlatformFileInfo; |
+class Time; |
+} |
+ |
+namespace fileapi { |
+ |
+using base::PlatformFileError; |
+using base::PlatformFileInfo; |
+ |
+// Helper class to support MTP device isolated file system operations. This |
+// class contains platform specific code to communicate with the attached |
+// MTP device. We instantiate this class per MTP device. MTP device is |
+// opened for communication during initialization and closed during |
+// destruction. |
+class MtpDeviceInterfaceLinux : |
+ public base::RefCountedThreadSafe<MtpDeviceInterfaceLinux> { |
+ public: |
+ MtpDeviceInterfaceLinux(const FilePath::StringType& device_id); |
+ |
+ PlatformFileError GetFileInfo(const FilePath& file_path, |
+ PlatformFileInfo* file_info); |
+ FileSystemFileUtil::AbstractFileEnumerator* CreateFileEnumerator( |
+ const FilePath& root, bool recursive); |
+ PlatformFileError Touch(const FilePath& file_path, |
+ const base::Time& last_access_time, |
+ const base::Time& last_modified_time); |
+ bool PathExists(const FilePath& file_path); |
+ bool DirectoryExists(const FilePath& file_path); |
+ bool IsDirectoryEmpty(const FilePath& file_path); |
+ |
+ protected: |
+ friend class base::RefCountedThreadSafe<MtpDeviceInterfaceLinux>; |
+ virtual ~MtpDeviceInterfaceLinux(); |
+ |
+ private: |
+ bool Init(); |
+ |
+ FilePath::StringType device_id_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(MtpDeviceInterfaceLinux); |
+}; |
+ |
+} // namespace fileapi |
+ |
+#endif // WEBKIT_FILEAPI_MTP_DEVICE_INTERFACE_LINUX_H_ |