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

Side by Side Diff: webkit/fileapi/file_system_path_manager.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
« no previous file with comments | « webkit/fileapi/file_system_options.cc ('k') | webkit/fileapi/file_system_path_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_PATH_MANAGER_H_
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_PATH_MANAGER_H_
7 #pragma once
8
9 #include "base/callback.h"
10 #include "base/file_path.h"
11 #include "base/file_util.h"
12 #include "webkit/fileapi/file_system_types.h"
13 #include "webkit/quota/special_storage_policy.h"
14
15 class GURL;
16
17 namespace base {
18 class MessageLoopProxy;
19 }
20
21 namespace fileapi {
22
23 class ExternalFileSystemMountPointProvider;
24 class FileSystemFileUtil;
25 class FileSystemMountPointProvider;
26 class SandboxMountPointProvider;
27
28 class FileSystemPathManager {
29 public:
30 FileSystemPathManager(
31 scoped_refptr<base::MessageLoopProxy> file_message_loop,
32 const FilePath& profile_path,
33 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy,
34 bool is_incognito,
35 bool allow_file_access_from_files);
36 virtual ~FileSystemPathManager();
37
38 // Callback for GetFileSystemRootPath.
39 // If the request is accepted and the root filesystem for the origin exists
40 // the callback is called with success=true and valid root_path and name.
41 // If the request is accepted, |create| is specified for
42 // GetFileSystemRootPath, and the root directory does not exist, it creates
43 // a new one and calls back with success=true if the creation has succeeded.
44 typedef base::Callback<void(bool /* success */,
45 const FilePath& /* root_path */,
46 const std::string& /* name */)>
47 GetRootPathCallback;
48
49 // Retrieves the root path for the given |origin_url| and |type|, and
50 // calls the given |callback| with the root path and name.
51 // If |create| is true this also creates the directory if it doesn't exist.
52 virtual void ValidateFileSystemRootAndGetURL(
53 const GURL& origin_url,
54 FileSystemType type,
55 bool create,
56 const FileSystemPathManager::GetRootPathCallback& callback);
57
58 // Like GetFileSystemRootPath, but synchronous, and can be called only while
59 // running on the file thread.
60 virtual FilePath ValidateFileSystemRootAndGetPathOnFileThread(
61 const GURL& origin_url,
62 FileSystemType type,
63 const FilePath& virtual_path,
64 bool create);
65
66 // Returns true if the given |url|'s scheme is allowed to access
67 // filesystem.
68 bool IsAllowedScheme(const GURL& url) const;
69
70 // Returns the string representation of the given filesystem |type|.
71 // Returns an empty string if the |type| is invalid.
72 static std::string GetFileSystemTypeString(FileSystemType type);
73
74 // Checks if a given |name| contains any restricted names/chars in it.
75 bool IsRestrictedFileName(FileSystemType type,
76 const FilePath& filename);
77
78 // Checks if an origin has access to a particular filesystem type and
79 // file element represented by |virtual_path|.
80 bool IsAccessAllowed(const GURL& origin, FileSystemType type,
81 const FilePath& virtual_path);
82
83 // Returns the appropriate FileUtil instance for the given |type|.
84 // This may return NULL if it is given an invalid or unsupported filesystem
85 // type.
86 FileSystemFileUtil* GetFileUtil(FileSystemType type) const;
87
88 // Returns a FileSystemMountPointProvider instance for sandboxed filesystem
89 // types (e.g. TEMPORARY or PERSISTENT).
90 SandboxMountPointProvider* sandbox_provider() const {
91 return sandbox_provider_.get();
92 }
93
94 // Returns a FileSystemMountPointProvider instance for external filesystem
95 // type, which is used only by chromeos for now.
96 ExternalFileSystemMountPointProvider* external_provider() const {
97 return external_provider_.get();
98 }
99
100 bool is_incognito() const {
101 return is_incognito_;
102 }
103
104 private:
105 // Returns the mount point provider instance for the given |type|.
106 // This may return NULL if it is given an invalid or unsupported filesystem
107 // type.
108 FileSystemMountPointProvider* GetMountPointProvider(
109 FileSystemType type) const;
110
111 const bool is_incognito_;
112 const bool allow_file_access_from_files_;
113 scoped_ptr<SandboxMountPointProvider> sandbox_provider_;
114 scoped_ptr<ExternalFileSystemMountPointProvider> external_provider_;
115
116 DISALLOW_COPY_AND_ASSIGN(FileSystemPathManager);
117 };
118
119 } // namespace fileapi
120
121 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_PATH_MANAGER_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_options.cc ('k') | webkit/fileapi/file_system_path_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698