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

Side by Side Diff: webkit/fileapi/file_system_operation.h

Issue 3417018: Adding a TouchFile() operation. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 3 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
« no previous file with comments | « chrome/common/render_messages_internal.h ('k') | webkit/fileapi/file_system_operation.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util_proxy.h" 11 #include "base/file_util_proxy.h"
12 #include "base/message_loop_proxy.h" 12 #include "base/message_loop_proxy.h"
13 #include "base/platform_file.h" 13 #include "base/platform_file.h"
14 #include "base/ref_counted.h" 14 #include "base/ref_counted.h"
15 #include "base/scoped_callback_factory.h" 15 #include "base/scoped_callback_factory.h"
16 #include "base/scoped_ptr.h" 16 #include "base/scoped_ptr.h"
17 17
18 namespace base {
19 class Time;
20 }
21
18 namespace fileapi { 22 namespace fileapi {
19 23
20 class FileSystemCallbackDispatcher; 24 class FileSystemCallbackDispatcher;
21 25
22 // This class is designed to serve one-time file system operation per instance. 26 // This class is designed to serve one-time file system operation per instance.
23 // Only one method(CreateFile, CreateDirectory, Copy, Move, DirectoryExists, 27 // Only one method(CreateFile, CreateDirectory, Copy, Move, DirectoryExists,
24 // GetMetadata, ReadDirectory and Remove) may be called during the lifetime of 28 // GetMetadata, ReadDirectory and Remove) may be called during the lifetime of
25 // this object and it should be called no more than once. 29 // this object and it should be called no more than once.
26 class FileSystemOperation { 30 class FileSystemOperation {
27 public: 31 public:
(...skipping 20 matching lines...) Expand all
48 void DirectoryExists(const FilePath& path); 52 void DirectoryExists(const FilePath& path);
49 53
50 void FileExists(const FilePath& path); 54 void FileExists(const FilePath& path);
51 55
52 void GetMetadata(const FilePath& path); 56 void GetMetadata(const FilePath& path);
53 57
54 void ReadDirectory(const FilePath& path); 58 void ReadDirectory(const FilePath& path);
55 59
56 void Remove(const FilePath& path); 60 void Remove(const FilePath& path);
57 61
62 void TouchFile(const FilePath& path,
63 const base::Time& last_access_time,
64 const base::Time& last_modified_time);
65
58 protected: 66 protected:
59 // Proxy for calling file_util_proxy methods. 67 // Proxy for calling file_util_proxy methods.
60 scoped_refptr<base::MessageLoopProxy> proxy_; 68 scoped_refptr<base::MessageLoopProxy> proxy_;
61 69
62 private: 70 private:
63 // Callbacks for above methods. 71 // Callbacks for above methods.
64 void DidCreateFileExclusive( 72 void DidCreateFileExclusive(
65 base::PlatformFileError rv, base::PassPlatformFile file, bool created); 73 base::PlatformFileError rv, base::PassPlatformFile file, bool created);
66 74
67 // Returns success even if the file already existed. 75 // Returns success even if the file already existed.
68 void DidCreateFileNonExclusive( 76 void DidCreateFileNonExclusive(
69 base::PlatformFileError rv, base::PassPlatformFile file, bool created); 77 base::PlatformFileError rv, base::PassPlatformFile file, bool created);
70 78
71 // Generic callback that translates platform errors to WebKit error codes. 79 // Generic callback that translates platform errors to WebKit error codes.
72 void DidFinishFileOperation(base::PlatformFileError rv); 80 void DidFinishFileOperation(base::PlatformFileError rv);
73 81
74 void DidDirectoryExists(base::PlatformFileError rv, 82 void DidDirectoryExists(base::PlatformFileError rv,
75 const base::PlatformFileInfo& file_info); 83 const base::PlatformFileInfo& file_info);
76 84
77 void DidFileExists(base::PlatformFileError rv, 85 void DidFileExists(base::PlatformFileError rv,
78 const base::PlatformFileInfo& file_info); 86 const base::PlatformFileInfo& file_info);
79 87
80 void DidGetMetadata(base::PlatformFileError rv, 88 void DidGetMetadata(base::PlatformFileError rv,
81 const base::PlatformFileInfo& file_info); 89 const base::PlatformFileInfo& file_info);
82 90
83 void DidReadDirectory( 91 void DidReadDirectory(
84 base::PlatformFileError rv, 92 base::PlatformFileError rv,
85 const std::vector<base::file_util_proxy::Entry>& entries); 93 const std::vector<base::file_util_proxy::Entry>& entries);
86 94
95 void DidTouchFile(base::PlatformFileError rv);
96
87 scoped_ptr<FileSystemCallbackDispatcher> dispatcher_; 97 scoped_ptr<FileSystemCallbackDispatcher> dispatcher_;
88 98
89 base::ScopedCallbackFactory<FileSystemOperation> callback_factory_; 99 base::ScopedCallbackFactory<FileSystemOperation> callback_factory_;
90 100
91 #ifndef NDEBUG 101 #ifndef NDEBUG
92 // A flag to make sure we call operation only once per instance. 102 // A flag to make sure we call operation only once per instance.
93 bool operation_pending_; 103 bool operation_pending_;
94 #endif 104 #endif
95 105
96 DISALLOW_COPY_AND_ASSIGN(FileSystemOperation); 106 DISALLOW_COPY_AND_ASSIGN(FileSystemOperation);
97 }; 107 };
98 108
99 } // namespace fileapi 109 } // namespace fileapi
100 110
101 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ 111 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_
OLDNEW
« no previous file with comments | « chrome/common/render_messages_internal.h ('k') | webkit/fileapi/file_system_operation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698