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

Side by Side Diff: webkit/fileapi/file_system_file_util_proxy.cc

Issue 6864040: Fixed file/directory url resolution for external mount point provider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/fileapi/file_system_file_util_proxy.h" 5 #include "webkit/fileapi/file_system_file_util_proxy.h"
6 6
7 #include "base/message_loop_proxy.h" 7 #include "base/message_loop_proxy.h"
8 #include "webkit/fileapi/file_system_context.h" 8 #include "webkit/fileapi/file_system_context.h"
9 #include "webkit/fileapi/file_system_file_util.h" 9 #include "webkit/fileapi/file_system_file_util.h"
10 #include "webkit/fileapi/file_system_operation_context.h" 10 #include "webkit/fileapi/file_system_operation_context.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 delete callback_; 185 delete callback_;
186 } 186 }
187 187
188 private: 188 private:
189 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; 189 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
190 FilePath file_path_; 190 FilePath file_path_;
191 fileapi::FileSystemFileUtilProxy::EnsureFileExistsCallback* callback_; 191 fileapi::FileSystemFileUtilProxy::EnsureFileExistsCallback* callback_;
192 bool created_; 192 bool created_;
193 }; 193 };
194 194
195
196 class RelayGetLocalPath : public MessageLoopRelay {
197 public:
198 RelayGetLocalPath(
199 const fileapi::FileSystemOperationContext& context,
200 const FilePath& virtual_path,
201 fileapi::FileSystemFileUtilProxy::GetLocalPathCallback* callback)
202 : MessageLoopRelay(context),
203 callback_(callback),
204 virtual_path_(virtual_path) {
205 DCHECK(callback);
206 }
207
208 protected:
209 virtual void RunWork() {
210 set_error_code(
211 file_system_file_util()->GetLocalFilePath(
212 context(), virtual_path_, &local_path_));
213 }
214
215 virtual void RunCallback() {
216 callback_->Run(error_code(), local_path_);
217 delete callback_;
218 }
219
220 private:
221 fileapi::FileSystemFileUtilProxy::GetLocalPathCallback* callback_;
222 FilePath virtual_path_;
223 FilePath local_path_;
224 };
225
195 class RelayGetFileInfo : public MessageLoopRelay { 226 class RelayGetFileInfo : public MessageLoopRelay {
196 public: 227 public:
197 RelayGetFileInfo( 228 RelayGetFileInfo(
198 const fileapi::FileSystemOperationContext& context, 229 const fileapi::FileSystemOperationContext& context,
199 const FilePath& file_path, 230 const FilePath& file_path,
200 fileapi::FileSystemFileUtilProxy::GetFileInfoCallback* callback) 231 fileapi::FileSystemFileUtilProxy::GetFileInfoCallback* callback)
201 : MessageLoopRelay(context), 232 : MessageLoopRelay(context),
202 callback_(callback), 233 callback_(callback),
203 file_path_(file_path) { 234 file_path_(file_path) {
204 DCHECK(callback); 235 DCHECK(callback);
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 // static 461 // static
431 bool FileSystemFileUtilProxy::EnsureFileExists( 462 bool FileSystemFileUtilProxy::EnsureFileExists(
432 const FileSystemOperationContext& context, 463 const FileSystemOperationContext& context,
433 scoped_refptr<MessageLoopProxy> message_loop_proxy, 464 scoped_refptr<MessageLoopProxy> message_loop_proxy,
434 const FilePath& file_path, 465 const FilePath& file_path,
435 EnsureFileExistsCallback* callback) { 466 EnsureFileExistsCallback* callback) {
436 return Start(FROM_HERE, message_loop_proxy, new RelayEnsureFileExists( 467 return Start(FROM_HERE, message_loop_proxy, new RelayEnsureFileExists(
437 context, message_loop_proxy, file_path, callback)); 468 context, message_loop_proxy, file_path, callback));
438 } 469 }
439 470
440 // Retrieves the information about a file. It is invalid to pass NULL for the 471 // static
441 // callback. 472 bool FileSystemFileUtilProxy::GetLocalPath(
473 const FileSystemOperationContext& context,
474 scoped_refptr<MessageLoopProxy> message_loop_proxy,
475 const FilePath& virtual_path,
476 GetLocalPathCallback* callback) {
477 return Start(FROM_HERE, message_loop_proxy,
478 new RelayGetLocalPath(context, virtual_path, callback));
479 }
480
481 // static
442 bool FileSystemFileUtilProxy::GetFileInfo( 482 bool FileSystemFileUtilProxy::GetFileInfo(
443 const FileSystemOperationContext& context, 483 const FileSystemOperationContext& context,
444 scoped_refptr<MessageLoopProxy> message_loop_proxy, 484 scoped_refptr<MessageLoopProxy> message_loop_proxy,
445 const FilePath& file_path, 485 const FilePath& file_path,
446 GetFileInfoCallback* callback) { 486 GetFileInfoCallback* callback) {
447 return Start(FROM_HERE, message_loop_proxy, new RelayGetFileInfo(context, 487 return Start(FROM_HERE, message_loop_proxy, new RelayGetFileInfo(context,
448 file_path, callback)); 488 file_path, callback));
449 } 489 }
450 490
451 // static 491 // static
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 const FileSystemOperationContext& context, 563 const FileSystemOperationContext& context,
524 scoped_refptr<MessageLoopProxy> message_loop_proxy, 564 scoped_refptr<MessageLoopProxy> message_loop_proxy,
525 const FilePath& path, 565 const FilePath& path,
526 int64 length, 566 int64 length,
527 StatusCallback* callback) { 567 StatusCallback* callback) {
528 return Start(FROM_HERE, message_loop_proxy, 568 return Start(FROM_HERE, message_loop_proxy,
529 new RelayTruncate(context, path, length, callback)); 569 new RelayTruncate(context, path, length, callback));
530 } 570 }
531 571
532 } // namespace fileapi 572 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698