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

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

Issue 9004019: Cleanup: Removing FileSystemPathManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 11 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_FILE_SYSTEM_CONTEXT_H_ 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "webkit/fileapi/file_system_types.h" 10 #include "webkit/fileapi/file_system_types.h"
11 #include "webkit/quota/special_storage_policy.h" 11 #include "webkit/quota/special_storage_policy.h"
12 12
13 class FilePath; 13 class FilePath;
14 class GURL; 14 class GURL;
15 15
16 namespace base { 16 namespace base {
17 class MessageLoopProxy; 17 class MessageLoopProxy;
18 } 18 }
19 19
20 namespace quota { 20 namespace quota {
21 class QuotaManagerProxy; 21 class QuotaManagerProxy;
22 } 22 }
23 23
24 namespace fileapi { 24 namespace fileapi {
25 25
26 class ExternalFileSystemMountPointProvider;
26 class FileSystemContext; 27 class FileSystemContext;
28 class FileSystemFileUtil;
29 class FileSystemMountPointProvider;
30 class FileSystemOptions;
27 class FileSystemPathManager; 31 class FileSystemPathManager;
28 class FileSystemQuotaUtil; 32 class FileSystemQuotaUtil;
29 class SandboxMountPointProvider; 33 class SandboxMountPointProvider;
30 34
31 struct DefaultContextDeleter; 35 struct DefaultContextDeleter;
32 36
33 // This class keeps and provides a file system context for FileSystem API. 37 // This class keeps and provides a file system context for FileSystem API.
34 // An instance of this class is created and owned by profile. 38 // An instance of this class is created and owned by profile.
35 class FileSystemContext 39 class FileSystemContext
36 : public base::RefCountedThreadSafe<FileSystemContext, 40 : public base::RefCountedThreadSafe<FileSystemContext,
37 DefaultContextDeleter> { 41 DefaultContextDeleter> {
38 public: 42 public:
39 FileSystemContext( 43 FileSystemContext(
40 scoped_refptr<base::MessageLoopProxy> file_message_loop, 44 scoped_refptr<base::MessageLoopProxy> file_message_loop,
41 scoped_refptr<base::MessageLoopProxy> io_message_loop, 45 scoped_refptr<base::MessageLoopProxy> io_message_loop,
42 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, 46 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy,
43 quota::QuotaManagerProxy* quota_manager_proxy, 47 quota::QuotaManagerProxy* quota_manager_proxy,
44 const FilePath& profile_path, 48 const FilePath& profile_path,
45 bool is_incognito, 49 const FileSystemOptions& options);
46 bool allow_file_access_from_files,
47 FileSystemPathManager* path_manager);
48 ~FileSystemContext(); 50 ~FileSystemContext();
49 51
50 // This method can be called on any thread. 52 // This method can be called on any thread.
51 bool DeleteDataForOriginOnFileThread(const GURL& origin_url); 53 bool DeleteDataForOriginOnFileThread(const GURL& origin_url);
52 bool DeleteDataForOriginAndTypeOnFileThread(const GURL& origin_url, 54 bool DeleteDataForOriginAndTypeOnFileThread(const GURL& origin_url,
53 FileSystemType type); 55 FileSystemType type);
54 56
55 FileSystemPathManager* path_manager() const { return path_manager_.get(); }
56 quota::QuotaManagerProxy* quota_manager_proxy() const { 57 quota::QuotaManagerProxy* quota_manager_proxy() const {
57 return quota_manager_proxy_.get(); 58 return quota_manager_proxy_.get();
58 } 59 }
59 60
60 // Returns a quota util for a given filesystem type. This may 61 // Returns a quota util for a given filesystem type. This may
61 // return NULL if the type does not support the usage tracking or 62 // return NULL if the type does not support the usage tracking or
62 // it is not a quota-managed storage. 63 // it is not a quota-managed storage.
63 FileSystemQuotaUtil* GetQuotaUtil(FileSystemType type) const; 64 FileSystemQuotaUtil* GetQuotaUtil(FileSystemType type) const;
64 65
66 // Returns the appropriate FileUtil instance for the given |type|.
67 // This may return NULL if it is given an invalid or unsupported filesystem
68 // type.
69 FileSystemFileUtil* GetFileUtil(FileSystemType type) const;
70
71 // Returns the mount point provider instance for the given |type|.
72 // This may return NULL if it is given an invalid or unsupported filesystem
73 // type.
74 FileSystemMountPointProvider* GetMountPointProvider(
75 FileSystemType type) const;
76
77 // Returns a FileSystemMountPointProvider instance for sandboxed filesystem
78 // types (e.g. TEMPORARY or PERSISTENT). This is equivalent to calling
79 // GetMountPointProvider(kFileSystemType{Temporary, Persistent}).
80 SandboxMountPointProvider* sandbox_provider() const;
81
82 // Returns a FileSystemMountPointProvider instance for external filesystem
83 // type, which is used only by chromeos for now. This is equivalent to
84 // calling GetMountPointProvider(kFileSystemTypeExternal).
85 ExternalFileSystemMountPointProvider* external_provider() const;
86
65 private: 87 private:
66 friend struct DefaultContextDeleter; 88 friend struct DefaultContextDeleter;
67 void DeleteOnCorrectThread() const; 89 void DeleteOnCorrectThread() const;
68 SandboxMountPointProvider* sandbox_provider() const;
69 90
70 scoped_refptr<base::MessageLoopProxy> file_message_loop_; 91 scoped_refptr<base::MessageLoopProxy> file_message_loop_;
71 scoped_refptr<base::MessageLoopProxy> io_message_loop_; 92 scoped_refptr<base::MessageLoopProxy> io_message_loop_;
72 93
73 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; 94 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_;
74 95
75 scoped_ptr<FileSystemPathManager> path_manager_; 96 // Mount point providers.
97 scoped_ptr<SandboxMountPointProvider> sandbox_provider_;
98 scoped_ptr<ExternalFileSystemMountPointProvider> external_provider_;
76 99
77 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); 100 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext);
78 }; 101 };
79 102
80 struct DefaultContextDeleter { 103 struct DefaultContextDeleter {
81 static void Destruct(const FileSystemContext* context) { 104 static void Destruct(const FileSystemContext* context) {
82 context->DeleteOnCorrectThread(); 105 context->DeleteOnCorrectThread();
83 } 106 }
84 }; 107 };
85 108
86 } // namespace fileapi 109 } // namespace fileapi
87 110
88 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ 111 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_
OLDNEW
« no previous file with comments | « webkit/chromeos/fileapi/cros_mount_point_provider.cc ('k') | webkit/fileapi/file_system_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698