OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_MOUNT_PATH_UTIL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_MOUNT_PATH_UTIL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_MOUNT_PATH_UTIL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_MOUNT_PATH_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "storage/browser/fileapi/file_system_url.h" | 11 #include "storage/browser/fileapi/file_system_url.h" |
12 | 12 |
13 class Profile; | 13 class Profile; |
14 | 14 |
15 namespace chromeos { | 15 namespace chromeos { |
16 namespace file_system_provider { | 16 namespace file_system_provider { |
17 | 17 |
18 class ProvidedFileSystemInterface; | 18 class ProvidedFileSystemInterface; |
19 | 19 |
20 namespace util { | 20 namespace util { |
21 | 21 |
22 // Constructs a safe mount point path for the provided file system. | 22 // Constructs a safe mount point path for the provided file system. |
23 base::FilePath GetMountPath(Profile* profile, | 23 base::FilePath GetMountPath(Profile* profile, |
24 const std::string& extension_id, | 24 const std::string& extension_id, |
25 const std::string& file_system_id); | 25 const std::string& file_system_id); |
26 | 26 // Constructs a safe mount point path for the plugin provided file system. |
| 27 base::FilePath GetPluginMountPath(Profile* profile, |
| 28 const std::string& source_id, |
| 29 const std::string& file_system_id); |
27 // Checks whether a local path is handled by File System Provider API or not. | 30 // Checks whether a local path is handled by File System Provider API or not. |
28 bool IsFileSystemProviderLocalPath(const base::FilePath& local_path); | 31 bool IsFileSystemProviderLocalPath(const base::FilePath& local_path); |
29 | 32 |
30 // Finds a file system, which is responsible for handling the specified |url| by | 33 // Finds a file system, which is responsible for handling the specified |url| by |
31 // analysing the mount path. Also, extract the file path from the virtual path | 34 // analysing the mount path. Also, extract the file path from the virtual path |
32 // to be used by the file system operations. | 35 // to be used by the file system operations. |
33 class FileSystemURLParser { | 36 class FileSystemURLParser { |
34 public: | 37 public: |
35 explicit FileSystemURLParser(const storage::FileSystemURL& url); | 38 explicit FileSystemURLParser(const storage::FileSystemURL& url); |
36 virtual ~FileSystemURLParser(); | 39 virtual ~FileSystemURLParser(); |
37 | 40 |
38 // Parses the |url| passed to the constructor. If parsing succeeds, then | 41 // Parses the |url| passed to the constructor. If parsing succeeds, then |
39 // returns true. Otherwise, false. Must be called on UI thread. | 42 // returns true. Otherwise, false. Must be called on UI thread. |
40 bool Parse(); | 43 bool Parse(); |
41 | 44 |
42 ProvidedFileSystemInterface* file_system() const { return file_system_; } | 45 ProvidedFileSystemInterface* file_system() const { return file_system_; } |
43 const base::FilePath& file_path() const { return file_path_; } | 46 const base::FilePath& file_path() const { return file_path_; } |
44 | 47 |
45 private: | 48 private: |
| 49 bool ParseExtensionProvided(); |
| 50 bool ParsePluginProvided(); |
46 storage::FileSystemURL url_; | 51 storage::FileSystemURL url_; |
47 ProvidedFileSystemInterface* file_system_; | 52 ProvidedFileSystemInterface* file_system_; |
48 base::FilePath file_path_; | 53 base::FilePath file_path_; |
49 | 54 |
50 DISALLOW_COPY_AND_ASSIGN(FileSystemURLParser); | 55 DISALLOW_COPY_AND_ASSIGN(FileSystemURLParser); |
51 }; | 56 }; |
52 | 57 |
53 // Finds a file system, which is responsible for handling the specified | 58 // Finds a file system, which is responsible for handling the specified |
54 // |local_path| by analysing the mount point name. Alsoo, extract the file path | 59 // |local_path| by analysing the mount point name. Alsoo, extract the file path |
55 // from the local path to be used by the file system operations. | 60 // from the local path to be used by the file system operations. |
(...skipping 15 matching lines...) Expand all Loading... |
71 ProvidedFileSystemInterface* file_system_; | 76 ProvidedFileSystemInterface* file_system_; |
72 base::FilePath file_path_; | 77 base::FilePath file_path_; |
73 | 78 |
74 DISALLOW_COPY_AND_ASSIGN(LocalPathParser); | 79 DISALLOW_COPY_AND_ASSIGN(LocalPathParser); |
75 }; | 80 }; |
76 } // namespace util | 81 } // namespace util |
77 } // namespace file_system_provider | 82 } // namespace file_system_provider |
78 } // namespace chromeos | 83 } // namespace chromeos |
79 | 84 |
80 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_MOUNT_PATH_UTIL_H_ | 85 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_MOUNT_PATH_UTIL_H_ |
OLD | NEW |