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

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

Issue 7174002: Change {Obfuscated|Local}FileSystemFileUtil non-Singleton to take an underlying *FileUtil. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebased. Created 9 years, 5 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/ref_counted.h"
16 #include "base/memory/singleton.h"
17 #include "base/platform_file.h" 15 #include "base/platform_file.h"
18 #include "base/tracked_objects.h"
19 #include "webkit/fileapi/file_system_file_util.h" 16 #include "webkit/fileapi/file_system_file_util.h"
20 #include "webkit/fileapi/file_system_types.h" 17 #include "webkit/fileapi/file_system_types.h"
21 18
22 namespace base { 19 namespace base {
23 struct PlatformFileInfo; 20 struct PlatformFileInfo;
24 class MessageLoopProxy; 21 class MessageLoopProxy;
25 class Time; 22 class Time;
26 } 23 }
27 24
28 class GURL; 25 class GURL;
29 26
30 namespace fileapi { 27 namespace fileapi {
31 28
32 using base::PlatformFile; 29 using base::PlatformFile;
33 using base::PlatformFileError; 30 using base::PlatformFileError;
34 31
35 class FileSystemOperationContext; 32 class FileSystemOperationContext;
36 33
34 // An instance of this class is created and owned by *MountPointProvider.
37 class LocalFileSystemFileUtil : public FileSystemFileUtil { 35 class LocalFileSystemFileUtil : public FileSystemFileUtil {
38 public: 36 public:
39 static LocalFileSystemFileUtil* GetInstance(); 37 // |underlying_file_util| is not owned by the instance. It will need to be
38 // a singleton or to be deleted by someone else.
39 explicit LocalFileSystemFileUtil(FileSystemFileUtil* underlying_file_util);
40 40
41 virtual PlatformFileError CreateOrOpen( 41 virtual PlatformFileError CreateOrOpen(
42 FileSystemOperationContext* context, 42 FileSystemOperationContext* context,
43 const FilePath& file_path, 43 const FilePath& file_path,
44 int file_flags, 44 int file_flags,
45 PlatformFile* file_handle, 45 PlatformFile* file_handle,
46 bool* created); 46 bool* created);
47 47
48 virtual PlatformFileError EnsureFileExists( 48 virtual PlatformFileError EnsureFileExists(
49 FileSystemOperationContext* context, 49 FileSystemOperationContext* context,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 const FilePath& file_path); 110 const FilePath& file_path);
111 111
112 virtual bool IsDirectoryEmpty( 112 virtual bool IsDirectoryEmpty(
113 FileSystemOperationContext* context, 113 FileSystemOperationContext* context,
114 const FilePath& file_path); 114 const FilePath& file_path);
115 115
116 virtual AbstractFileEnumerator* CreateFileEnumerator( 116 virtual AbstractFileEnumerator* CreateFileEnumerator(
117 FileSystemOperationContext* context, 117 FileSystemOperationContext* context,
118 const FilePath& root_path); 118 const FilePath& root_path);
119 119
120 protected:
121 LocalFileSystemFileUtil() { }
122
123 friend struct DefaultSingletonTraits<LocalFileSystemFileUtil>;
124 DISALLOW_COPY_AND_ASSIGN(LocalFileSystemFileUtil);
125
126 private: 120 private:
127 // Given the filesystem's root URL and a virtual path, produces a real, full 121 // Given the filesystem's root URL and a virtual path, produces a real, full
128 // local path. 122 // local path.
129 FilePath GetLocalPath( 123 FilePath GetLocalPath(
130 FileSystemOperationContext* context, 124 FileSystemOperationContext* context,
131 const GURL& origin_url, 125 const GURL& origin_url,
132 FileSystemType type, 126 FileSystemType type,
133 const FilePath& virtual_path); 127 const FilePath& virtual_path);
128
129 FileSystemFileUtil* underlying_file_util_;
130
131 DISALLOW_COPY_AND_ASSIGN(LocalFileSystemFileUtil);
134 }; 132 };
135 133
136 } // namespace fileapi 134 } // namespace fileapi
137 135
138 #endif // WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_FILE_UTIL_H_ 136 #endif // WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_test_helper.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