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