OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // This file provides File API related utilities. | 5 // This file provides File API related utilities. |
6 | 6 |
7 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILEAPI_UTIL_H_ | 7 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILEAPI_UTIL_H_ |
8 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILEAPI_UTIL_H_ | 8 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILEAPI_UTIL_H_ |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/files/file.h" | 13 #include "base/files/file.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
16 #include "webkit/browser/fileapi/file_system_operation_runner.h" | 16 #include "storage/browser/fileapi/file_system_operation_runner.h" |
17 | 17 |
18 class Profile; | 18 class Profile; |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 class RenderViewHost; | 21 class RenderViewHost; |
22 } | 22 } |
23 | 23 |
24 namespace fileapi { | 24 namespace storage { |
25 class FileSystemContext; | 25 class FileSystemContext; |
26 } | 26 } |
27 | 27 |
28 namespace file_manager { | 28 namespace file_manager { |
29 namespace util { | 29 namespace util { |
30 | 30 |
31 // Structure information necessary to create a EntryDefinition, and therefore | 31 // Structure information necessary to create a EntryDefinition, and therefore |
32 // an Entry object on the JavaScript side. | 32 // an Entry object on the JavaScript side. |
33 struct FileDefinition { | 33 struct FileDefinition { |
34 base::FilePath virtual_path; | 34 base::FilePath virtual_path; |
(...skipping 23 matching lines...) Expand all Loading... |
58 typedef base::Callback<void(const EntryDefinition& entry_definition)> | 58 typedef base::Callback<void(const EntryDefinition& entry_definition)> |
59 EntryDefinitionCallback; | 59 EntryDefinitionCallback; |
60 | 60 |
61 // The callback used by ConvertFileDefinitionListToEntryDefinitionList. Returns | 61 // The callback used by ConvertFileDefinitionListToEntryDefinitionList. Returns |
62 // the result of the conversion as a list. | 62 // the result of the conversion as a list. |
63 typedef base::Callback<void(scoped_ptr< | 63 typedef base::Callback<void(scoped_ptr< |
64 EntryDefinitionList> entry_definition_list)> EntryDefinitionListCallback; | 64 EntryDefinitionList> entry_definition_list)> EntryDefinitionListCallback; |
65 | 65 |
66 // Returns a file system context associated with the given profile and the | 66 // Returns a file system context associated with the given profile and the |
67 // extension ID. | 67 // extension ID. |
68 fileapi::FileSystemContext* GetFileSystemContextForExtensionId( | 68 storage::FileSystemContext* GetFileSystemContextForExtensionId( |
69 Profile* profile, | 69 Profile* profile, |
70 const std::string& extension_id); | 70 const std::string& extension_id); |
71 | 71 |
72 // Returns a file system context associated with the given profile and the | 72 // Returns a file system context associated with the given profile and the |
73 // render view host. | 73 // render view host. |
74 fileapi::FileSystemContext* GetFileSystemContextForRenderViewHost( | 74 storage::FileSystemContext* GetFileSystemContextForRenderViewHost( |
75 Profile* profile, | 75 Profile* profile, |
76 content::RenderViewHost* render_view_host); | 76 content::RenderViewHost* render_view_host); |
77 | 77 |
78 // Converts DrivePath (e.g., "drive/root", which always starts with the fixed | 78 // Converts DrivePath (e.g., "drive/root", which always starts with the fixed |
79 // "drive" directory) to a RelativeFileSystemPathrelative (e.g., | 79 // "drive" directory) to a RelativeFileSystemPathrelative (e.g., |
80 // "drive-xxx/root/foo". which starts from the "mount point" in the FileSystem | 80 // "drive-xxx/root/foo". which starts from the "mount point" in the FileSystem |
81 // API that may be distinguished for each profile by the appended "xxx" part.) | 81 // API that may be distinguished for each profile by the appended "xxx" part.) |
82 base::FilePath ConvertDrivePathToRelativeFileSystemPath( | 82 base::FilePath ConvertDrivePathToRelativeFileSystemPath( |
83 Profile* profile, | 83 Profile* profile, |
84 const std::string& extension_id, | 84 const std::string& extension_id, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // copied internally. The output list has the same order of items and size as | 120 // copied internally. The output list has the same order of items and size as |
121 // the input vector. |profile| cannot be null. Must be called on UI thread. | 121 // the input vector. |profile| cannot be null. Must be called on UI thread. |
122 void ConvertFileDefinitionListToEntryDefinitionList( | 122 void ConvertFileDefinitionListToEntryDefinitionList( |
123 Profile* profile, | 123 Profile* profile, |
124 const std::string& extension_id, | 124 const std::string& extension_id, |
125 const FileDefinitionList& file_definition_list, | 125 const FileDefinitionList& file_definition_list, |
126 const EntryDefinitionListCallback& callback); | 126 const EntryDefinitionListCallback& callback); |
127 | 127 |
128 // Checks if a directory exists at |url|. | 128 // Checks if a directory exists at |url|. |
129 void CheckIfDirectoryExists( | 129 void CheckIfDirectoryExists( |
130 scoped_refptr<fileapi::FileSystemContext> file_system_context, | 130 scoped_refptr<storage::FileSystemContext> file_system_context, |
131 const GURL& url, | 131 const GURL& url, |
132 const fileapi::FileSystemOperationRunner::StatusCallback& callback); | 132 const storage::FileSystemOperationRunner::StatusCallback& callback); |
133 | 133 |
134 } // namespace util | 134 } // namespace util |
135 } // namespace file_manager | 135 } // namespace file_manager |
136 | 136 |
137 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILEAPI_UTIL_H_ | 137 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILEAPI_UTIL_H_ |
OLD | NEW |