| 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 "webkit/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 std::string extension_id, | 24 const std::string& extension_id, |
| 25 int file_system_id); | 25 const std::string& file_system_id); |
| 26 | 26 |
| 27 // Finds file system, which is responsible for handling the specified |url| by | 27 // Finds file system, which is responsible for handling the specified |url| by |
| 28 // analysing the mount path. Also, extract the file path from the virtual path | 28 // analysing the mount path. Also, extract the file path from the virtual path |
| 29 // to be used by the file system operations. | 29 // to be used by the file system operations. |
| 30 class FileSystemURLParser { | 30 class FileSystemURLParser { |
| 31 public: | 31 public: |
| 32 explicit FileSystemURLParser(const fileapi::FileSystemURL& url); | 32 explicit FileSystemURLParser(const fileapi::FileSystemURL& url); |
| 33 virtual ~FileSystemURLParser(); | 33 virtual ~FileSystemURLParser(); |
| 34 | 34 |
| 35 // Parses the |url| passed to the constructor. If parsing succeeds, then | 35 // Parses the |url| passed to the constructor. If parsing succeeds, then |
| 36 // returns true. Otherwise, false. Must be called on UI thread. | 36 // returns true. Otherwise, false. Must be called on UI thread. |
| 37 bool Parse(); | 37 bool Parse(); |
| 38 | 38 |
| 39 ProvidedFileSystemInterface* file_system() const { return file_system_; } | 39 ProvidedFileSystemInterface* file_system() const { return file_system_; } |
| 40 const base::FilePath& file_path() const { return file_path_; } | 40 const base::FilePath& file_path() const { return file_path_; } |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 fileapi::FileSystemURL url_; | 43 fileapi::FileSystemURL url_; |
| 44 ProvidedFileSystemInterface* file_system_; | 44 ProvidedFileSystemInterface* file_system_; |
| 45 base::FilePath file_path_; | 45 base::FilePath file_path_; |
| 46 | 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(FileSystemURLParser); | 47 DISALLOW_COPY_AND_ASSIGN(FileSystemURLParser); |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 } // namespace util | 50 } // namespace util |
| 51 } // namespace file_system_provider | 51 } // namespace file_system_provider |
| 52 } // namespace chromeos | 52 } // namespace chromeos |
| 53 | 53 |
| 54 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_MOUNT_PATH_UTIL_H_ | 54 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_MOUNT_PATH_UTIL_H_ |
| OLD | NEW |