OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/common/file_system/file_system_dispatcher.h" | 5 #include "chrome/common/file_system/file_system_dispatcher.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "chrome/common/child_thread.h" | 8 #include "chrome/common/child_thread.h" |
9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
10 #include "chrome/common/render_messages_params.h" | 10 #include "chrome/common/render_messages_params.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 } | 92 } |
93 | 93 |
94 bool FileSystemDispatcher::ReadDirectory( | 94 bool FileSystemDispatcher::ReadDirectory( |
95 const FilePath& path, | 95 const FilePath& path, |
96 fileapi::FileSystemCallbackDispatcher* dispatcher) { | 96 fileapi::FileSystemCallbackDispatcher* dispatcher) { |
97 int request_id = dispatchers_.Add(dispatcher); | 97 int request_id = dispatchers_.Add(dispatcher); |
98 return ChildThread::current()->Send( | 98 return ChildThread::current()->Send( |
99 new ViewHostMsg_FileSystem_ReadDirectory(request_id, path)); | 99 new ViewHostMsg_FileSystem_ReadDirectory(request_id, path)); |
100 } | 100 } |
101 | 101 |
| 102 bool FileSystemDispatcher::TouchFile( |
| 103 const FilePath& path, |
| 104 const base::Time& last_access_time, |
| 105 const base::Time& last_modified_time, |
| 106 fileapi::FileSystemCallbackDispatcher* dispatcher) { |
| 107 int request_id = dispatchers_.Add(dispatcher); |
| 108 return ChildThread::current()->Send( |
| 109 new ViewHostMsg_FileSystem_TouchFile( |
| 110 request_id, path, last_access_time, last_modified_time)); |
| 111 } |
| 112 |
102 void FileSystemDispatcher::DidSucceed(int request_id) { | 113 void FileSystemDispatcher::DidSucceed(int request_id) { |
103 fileapi::FileSystemCallbackDispatcher* dispatcher = | 114 fileapi::FileSystemCallbackDispatcher* dispatcher = |
104 dispatchers_.Lookup(request_id); | 115 dispatchers_.Lookup(request_id); |
105 DCHECK(dispatcher); | 116 DCHECK(dispatcher); |
106 dispatcher->DidSucceed(); | 117 dispatcher->DidSucceed(); |
107 dispatchers_.Remove(request_id); | 118 dispatchers_.Remove(request_id); |
108 } | 119 } |
109 | 120 |
110 void FileSystemDispatcher::DidReadMetadata( | 121 void FileSystemDispatcher::DidReadMetadata( |
111 int request_id, const base::PlatformFileInfo& file_info) { | 122 int request_id, const base::PlatformFileInfo& file_info) { |
(...skipping 16 matching lines...) Expand all Loading... |
128 } | 139 } |
129 | 140 |
130 void FileSystemDispatcher::DidFail( | 141 void FileSystemDispatcher::DidFail( |
131 int request_id, base::PlatformFileError error_code) { | 142 int request_id, base::PlatformFileError error_code) { |
132 fileapi::FileSystemCallbackDispatcher* dispatcher = | 143 fileapi::FileSystemCallbackDispatcher* dispatcher = |
133 dispatchers_.Lookup(request_id); | 144 dispatchers_.Lookup(request_id); |
134 DCHECK(dispatcher); | 145 DCHECK(dispatcher); |
135 dispatcher->DidFail(error_code); | 146 dispatcher->DidFail(error_code); |
136 dispatchers_.Remove(request_id); | 147 dispatchers_.Remove(request_id); |
137 } | 148 } |
OLD | NEW |