OLD | NEW |
(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 #ifndef WEBKIT_FILEAPI_MTP_DEVICE_INTERFACE_LINUX_H_ |
| 6 #define WEBKIT_FILEAPI_MTP_DEVICE_INTERFACE_LINUX_H_ |
| 7 |
| 8 #include "base/file_path.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/platform_file.h" |
| 11 #include "base/timer.h" |
| 12 #include "webkit/fileapi/file_system_file_util.h" |
| 13 |
| 14 namespace base { |
| 15 struct PlatformFileInfo; |
| 16 class Time; |
| 17 } |
| 18 |
| 19 namespace fileapi { |
| 20 |
| 21 using base::PlatformFileError; |
| 22 using base::PlatformFileInfo; |
| 23 |
| 24 // Helper class to support MTP device isolated file system operations. This |
| 25 // class contains platform specific code to communicate with the attached |
| 26 // MTP device. We instantiate this class per MTP device. MTP device is |
| 27 // opened for communication during initialization and closed during |
| 28 // destruction. |
| 29 class MtpDeviceInterfaceLinux : |
| 30 public base::RefCountedThreadSafe<MtpDeviceInterfaceLinux> { |
| 31 public: |
| 32 MtpDeviceInterfaceLinux(const FilePath::StringType& device_id); |
| 33 |
| 34 PlatformFileError GetFileInfo(const FilePath& file_path, |
| 35 PlatformFileInfo* file_info); |
| 36 FileSystemFileUtil::AbstractFileEnumerator* CreateFileEnumerator( |
| 37 const FilePath& root, bool recursive); |
| 38 PlatformFileError Touch(const FilePath& file_path, |
| 39 const base::Time& last_access_time, |
| 40 const base::Time& last_modified_time); |
| 41 bool PathExists(const FilePath& file_path); |
| 42 bool DirectoryExists(const FilePath& file_path); |
| 43 bool IsDirectoryEmpty(const FilePath& file_path); |
| 44 |
| 45 protected: |
| 46 friend class base::RefCountedThreadSafe<MtpDeviceInterfaceLinux>; |
| 47 virtual ~MtpDeviceInterfaceLinux(); |
| 48 |
| 49 private: |
| 50 bool Init(); |
| 51 |
| 52 FilePath::StringType device_id_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(MtpDeviceInterfaceLinux); |
| 55 }; |
| 56 |
| 57 } // namespace fileapi |
| 58 |
| 59 #endif // WEBKIT_FILEAPI_MTP_DEVICE_INTERFACE_LINUX_H_ |
OLD | NEW |