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

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

Issue 7312023: Refactoring: Change all -FileUtils non-Singleton and to own underlying FileUtils. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Reflected the comments. Created 9 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
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 #ifndef WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_FILE_UTIL_H_ 5 #ifndef WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_FILE_UTIL_H_
6 #define WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_FILE_UTIL_H_ 6 #define WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_FILE_UTIL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/file_util_proxy.h" 13 #include "base/file_util_proxy.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/memory/scoped_ptr.h"
15 #include "base/platform_file.h" 16 #include "base/platform_file.h"
16 #include "webkit/fileapi/file_system_file_util.h" 17 #include "webkit/fileapi/file_system_file_util.h"
17 #include "webkit/fileapi/file_system_types.h" 18 #include "webkit/fileapi/file_system_types.h"
18 19
19 namespace base { 20 namespace base {
20 struct PlatformFileInfo; 21 struct PlatformFileInfo;
21 class MessageLoopProxy; 22 class MessageLoopProxy;
22 class Time; 23 class Time;
23 } 24 }
24 25
25 class GURL; 26 class GURL;
26 27
27 namespace fileapi { 28 namespace fileapi {
28 29
29 using base::PlatformFile; 30 using base::PlatformFile;
30 using base::PlatformFileError; 31 using base::PlatformFileError;
31 32
32 class FileSystemOperationContext; 33 class FileSystemOperationContext;
33 34
34 // An instance of this class is created and owned by *MountPointProvider. 35 // An instance of this class is created and owned by *MountPointProvider.
35 class LocalFileSystemFileUtil : public FileSystemFileUtil { 36 class LocalFileSystemFileUtil : public FileSystemFileUtil {
36 public: 37 public:
37 // |underlying_file_util| is not owned by the instance. It will need to be 38 // |underlying_file_util| is owned by the instance. It will be deleted by
38 // a singleton or to be deleted by someone else. 39 // the owner instance. For example, it can be instanciated as follows:
40 // FileSystemFileUtil* file_system_file_util =
41 // new LocalFileSystemFileUtil(new FileSystemFileUtil());
39 explicit LocalFileSystemFileUtil(FileSystemFileUtil* underlying_file_util); 42 explicit LocalFileSystemFileUtil(FileSystemFileUtil* underlying_file_util);
43 virtual ~LocalFileSystemFileUtil();
40 44
41 virtual PlatformFileError CreateOrOpen( 45 virtual PlatformFileError CreateOrOpen(
42 FileSystemOperationContext* context, 46 FileSystemOperationContext* context,
43 const FilePath& file_path, 47 const FilePath& file_path,
44 int file_flags, 48 int file_flags,
45 PlatformFile* file_handle, 49 PlatformFile* file_handle,
46 bool* created); 50 bool* created);
47 51
48 virtual PlatformFileError EnsureFileExists( 52 virtual PlatformFileError EnsureFileExists(
49 FileSystemOperationContext* context, 53 FileSystemOperationContext* context,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 123
120 private: 124 private:
121 // Given the filesystem's root URL and a virtual path, produces a real, full 125 // Given the filesystem's root URL and a virtual path, produces a real, full
122 // local path. 126 // local path.
123 FilePath GetLocalPath( 127 FilePath GetLocalPath(
124 FileSystemOperationContext* context, 128 FileSystemOperationContext* context,
125 const GURL& origin_url, 129 const GURL& origin_url,
126 FileSystemType type, 130 FileSystemType type,
127 const FilePath& virtual_path); 131 const FilePath& virtual_path);
128 132
129 FileSystemFileUtil* underlying_file_util_; 133 scoped_ptr<FileSystemFileUtil> underlying_file_util_;
130 134
131 DISALLOW_COPY_AND_ASSIGN(LocalFileSystemFileUtil); 135 DISALLOW_COPY_AND_ASSIGN(LocalFileSystemFileUtil);
132 }; 136 };
133 137
134 } // namespace fileapi 138 } // namespace fileapi
135 139
136 #endif // WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_FILE_UTIL_H_ 140 #endif // WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/file_writer_delegate_unittest.cc ('k') | webkit/fileapi/local_file_system_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698