| 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_PROVIDED_FILE_SYSTEM_INTERF
ACE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INTERF
ACE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INTERF
ACE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INTERF
ACE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> |
| 11 #include <string> | 12 #include <string> |
| 12 #include <vector> | 13 #include <vector> |
| 13 | 14 |
| 14 #include "base/callback.h" | 15 #include "base/callback.h" |
| 15 #include "base/files/file.h" | 16 #include "base/files/file.h" |
| 16 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
| 17 #include "base/macros.h" | 18 #include "base/macros.h" |
| 18 #include "base/memory/scoped_ptr.h" | |
| 19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 20 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
| 21 #include "chrome/browser/chromeos/file_system_provider/abort_callback.h" | 21 #include "chrome/browser/chromeos/file_system_provider/abort_callback.h" |
| 22 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_obse
rver.h" | 22 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_obse
rver.h" |
| 23 #include "chrome/browser/chromeos/file_system_provider/watcher.h" | 23 #include "chrome/browser/chromeos/file_system_provider/watcher.h" |
| 24 #include "storage/browser/fileapi/async_file_util.h" | 24 #include "storage/browser/fileapi/async_file_util.h" |
| 25 #include "storage/browser/fileapi/watcher_manager.h" | 25 #include "storage/browser/fileapi/watcher_manager.h" |
| 26 #include "url/gurl.h" | 26 #include "url/gurl.h" |
| 27 | 27 |
| 28 namespace base { | 28 namespace base { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 39 class ProvidedFileSystemInfo; | 39 class ProvidedFileSystemInfo; |
| 40 class RequestManager; | 40 class RequestManager; |
| 41 | 41 |
| 42 // Represents metadata for either a file or a directory. | 42 // Represents metadata for either a file or a directory. |
| 43 struct EntryMetadata { | 43 struct EntryMetadata { |
| 44 EntryMetadata(); | 44 EntryMetadata(); |
| 45 ~EntryMetadata(); | 45 ~EntryMetadata(); |
| 46 | 46 |
| 47 // All of the metadata fields are optional. All strings which are set, are | 47 // All of the metadata fields are optional. All strings which are set, are |
| 48 // non-empty. | 48 // non-empty. |
| 49 scoped_ptr<bool> is_directory; | 49 std::unique_ptr<bool> is_directory; |
| 50 scoped_ptr<std::string> name; | 50 std::unique_ptr<std::string> name; |
| 51 scoped_ptr<int64_t> size; | 51 std::unique_ptr<int64_t> size; |
| 52 scoped_ptr<base::Time> modification_time; | 52 std::unique_ptr<base::Time> modification_time; |
| 53 scoped_ptr<std::string> mime_type; | 53 std::unique_ptr<std::string> mime_type; |
| 54 scoped_ptr<std::string> thumbnail; | 54 std::unique_ptr<std::string> thumbnail; |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 DISALLOW_COPY_AND_ASSIGN(EntryMetadata); | 57 DISALLOW_COPY_AND_ASSIGN(EntryMetadata); |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 // Represents actions for either a file or a directory. | 60 // Represents actions for either a file or a directory. |
| 61 struct Action { | 61 struct Action { |
| 62 std::string id; | 62 std::string id; |
| 63 std::string title; | 63 std::string title; |
| 64 }; | 64 }; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 // Callback for OpenFile(). In case of an error, file_handle is equal to 0 | 103 // Callback for OpenFile(). In case of an error, file_handle is equal to 0 |
| 104 // and result is set to an error code. | 104 // and result is set to an error code. |
| 105 typedef base::Callback<void(int file_handle, base::File::Error result)> | 105 typedef base::Callback<void(int file_handle, base::File::Error result)> |
| 106 OpenFileCallback; | 106 OpenFileCallback; |
| 107 | 107 |
| 108 typedef base::Callback< | 108 typedef base::Callback< |
| 109 void(int chunk_length, bool has_more, base::File::Error result)> | 109 void(int chunk_length, bool has_more, base::File::Error result)> |
| 110 ReadChunkReceivedCallback; | 110 ReadChunkReceivedCallback; |
| 111 | 111 |
| 112 typedef base::Callback<void(scoped_ptr<EntryMetadata> entry_metadata, | 112 typedef base::Callback<void(std::unique_ptr<EntryMetadata> entry_metadata, |
| 113 base::File::Error result)> GetMetadataCallback; | 113 base::File::Error result)> |
| 114 GetMetadataCallback; |
| 114 | 115 |
| 115 typedef base::Callback<void(const Actions& actions, base::File::Error result)> | 116 typedef base::Callback<void(const Actions& actions, base::File::Error result)> |
| 116 GetActionsCallback; | 117 GetActionsCallback; |
| 117 | 118 |
| 118 // Mask of fields requested from the GetMetadata() call. | 119 // Mask of fields requested from the GetMetadata() call. |
| 119 typedef int MetadataFieldMask; | 120 typedef int MetadataFieldMask; |
| 120 | 121 |
| 121 virtual ~ProvidedFileSystemInterface() {} | 122 virtual ~ProvidedFileSystemInterface() {} |
| 122 | 123 |
| 123 // Requests unmounting of the file system. The callback is called when the | 124 // Requests unmounting of the file system. The callback is called when the |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 244 |
| 244 // Notifies about changes related to the watcher within the file system. | 245 // Notifies about changes related to the watcher within the file system. |
| 245 // Invoked by the file system implementation. Returns an error code via the | 246 // Invoked by the file system implementation. Returns an error code via the |
| 246 // callback if the notification arguments are malformed or the entry is not | 247 // callback if the notification arguments are malformed or the entry is not |
| 247 // watched anymore. On success, returns base::File::FILE_OK. | 248 // watched anymore. On success, returns base::File::FILE_OK. |
| 248 // TODO(mtomasz): Replace [entry_path, recursive] with a watcher id. | 249 // TODO(mtomasz): Replace [entry_path, recursive] with a watcher id. |
| 249 virtual void Notify( | 250 virtual void Notify( |
| 250 const base::FilePath& entry_path, | 251 const base::FilePath& entry_path, |
| 251 bool recursive, | 252 bool recursive, |
| 252 storage::WatcherManager::ChangeType change_type, | 253 storage::WatcherManager::ChangeType change_type, |
| 253 scoped_ptr<ProvidedFileSystemObserver::Changes> changes, | 254 std::unique_ptr<ProvidedFileSystemObserver::Changes> changes, |
| 254 const std::string& tag, | 255 const std::string& tag, |
| 255 const storage::AsyncFileUtil::StatusCallback& callback) = 0; | 256 const storage::AsyncFileUtil::StatusCallback& callback) = 0; |
| 256 | 257 |
| 257 // Requests showing UI for configuring the file system by user. Once the | 258 // Requests showing UI for configuring the file system by user. Once the |
| 258 // configuration process is completed, base::File::FILE_OK or an error code is | 259 // configuration process is completed, base::File::FILE_OK or an error code is |
| 259 // returned via the |callback|. | 260 // returned via the |callback|. |
| 260 virtual void Configure( | 261 virtual void Configure( |
| 261 const storage::AsyncFileUtil::StatusCallback& callback) = 0; | 262 const storage::AsyncFileUtil::StatusCallback& callback) = 0; |
| 262 | 263 |
| 263 // Returns a provided file system info for this file system. | 264 // Returns a provided file system info for this file system. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 279 virtual void RemoveObserver(ProvidedFileSystemObserver* observer) = 0; | 280 virtual void RemoveObserver(ProvidedFileSystemObserver* observer) = 0; |
| 280 | 281 |
| 281 // Returns a weak pointer to this object. | 282 // Returns a weak pointer to this object. |
| 282 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() = 0; | 283 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() = 0; |
| 283 }; | 284 }; |
| 284 | 285 |
| 285 } // namespace file_system_provider | 286 } // namespace file_system_provider |
| 286 } // namespace chromeos | 287 } // namespace chromeos |
| 287 | 288 |
| 288 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INT
ERFACE_H_ | 289 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INT
ERFACE_H_ |
| OLD | NEW |