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

Side by Side 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: Fix nit Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 #include "webkit/fileapi/media/mtp_device_interface_impl_linux.h"
6
7 #include "base/sequenced_task_runner.h"
8
9 namespace fileapi {
10
11 MtpDeviceInterfaceImplLinux::MtpDeviceInterfaceImplLinux(
12 const FilePath::StringType& device_id,
13 base::SequencedTaskRunner* media_task_runner)
14 : device_id_(device_id),
15 media_task_runner_(media_task_runner) {
16 // Initialize the device in LazyInit() function.
17 // This object is constructed on IO thread.
18 }
19
20 MtpDeviceInterfaceImplLinux::~MtpDeviceInterfaceImplLinux() {
21 // Do the clean up in DeleteOnCorrectThread() function.
22 // This object must be destructed on media_task_runner.
23 }
24
25 bool MtpDeviceInterfaceImplLinux::LazyInit() {
26 DCHECK(media_task_runner_->RunsTasksOnCurrentThread());
27
28 // TODO(kmadhusu, thestig): Open the device for communication. If is already
29 // opened, return.
30 return true;
31 }
32
33 void MtpDeviceInterfaceImplLinux::DeleteOnCorrectThread() const {
34 if (!media_task_runner_->RunsTasksOnCurrentThread()) {
35 media_task_runner_->DeleteSoon(FROM_HERE, this);
36 return;
37 }
38 delete this;
39 }
40
41 PlatformFileError MtpDeviceInterfaceImplLinux::GetFileInfo(
42 const FilePath& file_path,
43 PlatformFileInfo* file_info) {
44 if (!LazyInit())
45 return base::PLATFORM_FILE_ERROR_SECURITY;
46
47 NOTIMPLEMENTED();
48 return base::PLATFORM_FILE_ERROR_SECURITY;
49 }
50
51 FileSystemFileUtil::AbstractFileEnumerator*
52 MtpDeviceInterfaceImplLinux::CreateFileEnumerator(
53 const FilePath& root,
54 bool recursive) {
55 if (!LazyInit())
56 return new FileSystemFileUtil::EmptyFileEnumerator();
57
58 NOTIMPLEMENTED();
59 return new FileSystemFileUtil::EmptyFileEnumerator();
60 }
61
62 PlatformFileError MtpDeviceInterfaceImplLinux::Touch(
63 const FilePath& file_path,
64 const base::Time& last_access_time,
65 const base::Time& last_modified_time) {
66 if (!LazyInit())
67 return base::PLATFORM_FILE_ERROR_SECURITY;
68
69 NOTIMPLEMENTED();
70 return base::PLATFORM_FILE_ERROR_SECURITY;
71 }
72
73 bool MtpDeviceInterfaceImplLinux::PathExists(const FilePath& file_path) {
74 if (!LazyInit())
75 return false;
76
77 NOTIMPLEMENTED();
78 return false;
79 }
80
81 bool MtpDeviceInterfaceImplLinux::DirectoryExists(const FilePath& file_path) {
82 if (!LazyInit())
83 return false;
84
85 NOTIMPLEMENTED();
86 return false;
87 }
88
89 bool MtpDeviceInterfaceImplLinux::IsDirectoryEmpty(const FilePath& file_path) {
90 if (!LazyInit())
91 return false;
92
93 NOTIMPLEMENTED();
94 return true;
95 }
96
97 PlatformFileError MtpDeviceInterfaceImplLinux::CreateSnapshotFile(
98 const FilePath& device_file_path,
99 const FilePath& local_path,
100 PlatformFileInfo* file_info) {
101 if (!LazyInit())
102 return base::PLATFORM_FILE_ERROR_FAILED;
103
104 // Write the device_file_path data to local_path file and set the file_info
105 // accordingly.
106
107 NOTIMPLEMENTED();
108 return base::PLATFORM_FILE_ERROR_FAILED;
109 }
110
111 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698