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 "webkit/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 |
27 // Checks whether a local path is handled by File System Provider API or not. | 27 // Checks whether a local path is handled by File System Provider API or not. |
28 bool IsFileSystemProviderLocalPath(const base::FilePath& local_path); | 28 bool IsFileSystemProviderLocalPath(const base::FilePath& local_path); |
29 | 29 |
30 // Finds a file system, which is responsible for handling the specified |url| by | 30 // 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 | 31 // analysing the mount path. Also, extract the file path from the virtual path |
32 // to be used by the file system operations. | 32 // to be used by the file system operations. |
33 class FileSystemURLParser { | 33 class FileSystemURLParser { |
34 public: | 34 public: |
35 explicit FileSystemURLParser(const fileapi::FileSystemURL& url); | 35 explicit FileSystemURLParser(const storage::FileSystemURL& url); |
36 virtual ~FileSystemURLParser(); | 36 virtual ~FileSystemURLParser(); |
37 | 37 |
38 // Parses the |url| passed to the constructor. If parsing succeeds, then | 38 // Parses the |url| passed to the constructor. If parsing succeeds, then |
39 // returns true. Otherwise, false. Must be called on UI thread. | 39 // returns true. Otherwise, false. Must be called on UI thread. |
40 bool Parse(); | 40 bool Parse(); |
41 | 41 |
42 ProvidedFileSystemInterface* file_system() const { return file_system_; } | 42 ProvidedFileSystemInterface* file_system() const { return file_system_; } |
43 const base::FilePath& file_path() const { return file_path_; } | 43 const base::FilePath& file_path() const { return file_path_; } |
44 | 44 |
45 private: | 45 private: |
46 fileapi::FileSystemURL url_; | 46 storage::FileSystemURL url_; |
47 ProvidedFileSystemInterface* file_system_; | 47 ProvidedFileSystemInterface* file_system_; |
48 base::FilePath file_path_; | 48 base::FilePath file_path_; |
49 | 49 |
50 DISALLOW_COPY_AND_ASSIGN(FileSystemURLParser); | 50 DISALLOW_COPY_AND_ASSIGN(FileSystemURLParser); |
51 }; | 51 }; |
52 | 52 |
53 // Finds a file system, which is responsible for handling the specified | 53 // 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 | 54 // |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. | 55 // from the local path to be used by the file system operations. |
56 class LocalPathParser { | 56 class LocalPathParser { |
(...skipping 14 matching lines...) Expand all Loading... |
71 ProvidedFileSystemInterface* file_system_; | 71 ProvidedFileSystemInterface* file_system_; |
72 base::FilePath file_path_; | 72 base::FilePath file_path_; |
73 | 73 |
74 DISALLOW_COPY_AND_ASSIGN(LocalPathParser); | 74 DISALLOW_COPY_AND_ASSIGN(LocalPathParser); |
75 }; | 75 }; |
76 } // namespace util | 76 } // namespace util |
77 } // namespace file_system_provider | 77 } // namespace file_system_provider |
78 } // namespace chromeos | 78 } // namespace chromeos |
79 | 79 |
80 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_MOUNT_PATH_UTIL_H_ | 80 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_MOUNT_PATH_UTIL_H_ |
OLD | NEW |