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_MEDIA_MTP_DEVICE_INTERFACE_IMPL_LINUX_H_ | |
6 #define WEBKIT_FILEAPI_MEDIA_MTP_DEVICE_INTERFACE_IMPL_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/sequenced_task_runner_helpers.h" | |
12 #include "base/timer.h" | |
13 #include "webkit/fileapi/file_system_file_util.h" | |
14 #include "webkit/fileapi/media/media_device_interface.h" | |
15 | |
16 namespace base { | |
17 struct PlatformFileInfo; | |
18 class SequencedTaskRunner; | |
19 class Time; | |
20 } | |
21 | |
22 namespace fileapi { | |
23 | |
24 struct DefaultMtpDeviceInterfaceImplDeleter; | |
25 | |
26 // Helper class to support MTP device isolated file system operations. This | |
27 // class contains platform specific code to communicate with the attached | |
28 // MTP device. We instantiate this class per MTP device. MTP device is | |
29 // opened for communication during initialization and closed during | |
30 // destruction. | |
31 class MtpDeviceInterfaceImplLinux : | |
Lei Zhang
2012/07/31 20:04:37
nit:
class VeryLongClass
: public Foo...
kmadhusu
2012/08/01 01:43:59
Done.
| |
32 public MediaDeviceInterface, | |
33 public base::RefCountedThreadSafe<MtpDeviceInterfaceImplLinux, | |
34 DefaultMtpDeviceInterfaceImplDeleter> { | |
35 public: | |
36 MtpDeviceInterfaceImplLinux( | |
37 const FilePath::StringType& device_id, | |
38 base::SequencedTaskRunner* media_task_runner) OVERRIDE; | |
Lei Zhang
2012/07/31 20:48:18
I don't think the ctor needs OVERRIDE.
kmadhusu
2012/08/01 01:43:59
Fixed.
| |
39 | |
40 // MediaDeviceInterface methods. | |
41 virtual base::PlatformFileError GetFileInfo( | |
42 const FilePath& file_path, | |
43 base::PlatformFileInfo* file_info) OVERRIDE; | |
44 | |
kinuko
2012/07/31 20:32:31
nit: no new lines between overrides from the same
kmadhusu
2012/08/01 01:43:59
Done.
| |
45 virtual FileSystemFileUtil::AbstractFileEnumerator* CreateFileEnumerator( | |
46 const FilePath& root, | |
47 bool recursive) OVERRIDE; | |
48 | |
49 virtual base::PlatformFileError Touch( | |
50 const FilePath& file_path, | |
51 const base::Time& last_access_time, | |
52 const base::Time& last_modified_time) OVERRIDE; | |
53 | |
54 virtual bool PathExists(const FilePath& file_path) OVERRIDE; | |
55 virtual bool DirectoryExists(const FilePath& file_path) OVERRIDE; | |
56 virtual bool IsDirectoryEmpty(const FilePath& file_path) OVERRIDE; | |
57 virtual base::PlatformFileError CreateSnapshotFile( | |
58 const FilePath& device_file_path, | |
59 const FilePath& local_path, | |
60 base::PlatformFileInfo* file_info) OVERRIDE; | |
61 | |
62 private: | |
63 friend struct DefaultMtpDeviceInterfaceImplDeleter; | |
64 friend class base::DeleteHelper<MtpDeviceInterfaceImplLinux>; | |
65 friend class base::RefCountedThreadSafe<MtpDeviceInterfaceImplLinux, | |
66 DefaultMtpDeviceInterfaceImplDeleter>; | |
67 | |
68 virtual ~MtpDeviceInterfaceImplLinux(); | |
69 void DeleteOnCorrectThread() const; | |
70 | |
71 // Device initialization should be done in |media_task_runner_|. | |
72 bool LazyInit(); | |
73 | |
74 // Mtp device id. | |
75 FilePath::StringType device_id_; | |
76 scoped_refptr<base::SequencedTaskRunner> media_task_runner_; | |
77 | |
78 DISALLOW_COPY_AND_ASSIGN(MtpDeviceInterfaceImplLinux); | |
79 }; | |
80 | |
81 struct DefaultMtpDeviceInterfaceImplDeleter { | |
82 static void Destruct(const MtpDeviceInterfaceImplLinux* device_impl) { | |
83 device_impl->DeleteOnCorrectThread(); | |
84 } | |
85 }; | |
86 | |
87 } // namespace fileapi | |
88 | |
89 #endif // WEBKIT_FILEAPI_MEDIA_MTP_DEVICE_INTERFACE_IMPL_LINUX_H_ | |
OLD | NEW |