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 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_CHROMEOS_FILEAPI_MTP_FILE_SYSTEM_BACKEND_DELEGATE_H_ 6 #define CHROME_BROWSER_CHROMEOS_FILEAPI_MTP_FILE_SYSTEM_BACKEND_DELEGATE_H_ 7 8 #include "base/memory/scoped_ptr.h" 9 #include "chrome/browser/chromeos/fileapi/file_system_backend_delegate.h" 10 11 namespace base { 12 class FilePath; 13 } // namespace base 14 15 namespace storage { 16 class AsyncFileUtil; 17 class FileSystemContext; 18 class FileStreamReader; 19 class FileSystemURL; 20 class FileStreamWriter; 21 class WatcherManager; 22 } // namespace storage 23 24 class DeviceMediaAsyncFileUtil; 25 26 namespace chromeos { 27 28 // This is delegate interface to inject the MTP device file system in Chrome OS 29 // file API backend. 30 class MTPFileSystemBackendDelegate : public FileSystemBackendDelegate { 31 public: 32 explicit MTPFileSystemBackendDelegate( 33 const base::FilePath& storage_partition_path); 34 virtual ~MTPFileSystemBackendDelegate(); 35 36 // FileSystemBackendDelegate overrides. 37 virtual storage::AsyncFileUtil* GetAsyncFileUtil( 38 storage::FileSystemType type) OVERRIDE; 39 virtual scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( 40 const storage::FileSystemURL& url, 41 int64 offset, 42 int64 max_bytes_to_read, 43 const base::Time& expected_modification_time, 44 storage::FileSystemContext* context) OVERRIDE; 45 virtual scoped_ptr<storage::FileStreamWriter> CreateFileStreamWriter( 46 const storage::FileSystemURL& url, 47 int64 offset, 48 storage::FileSystemContext* context) OVERRIDE; 49 virtual storage::WatcherManager* GetWatcherManager( 50 const storage::FileSystemURL& url) OVERRIDE; 51 virtual void GetRedirectURLForContents( 52 const storage::FileSystemURL& url, 53 const storage::URLCallback& callback) OVERRIDE; 54 55 private: 56 scoped_ptr<DeviceMediaAsyncFileUtil> device_media_async_file_util_; 57 58 DISALLOW_COPY_AND_ASSIGN(MTPFileSystemBackendDelegate); 59 }; 60 61 } // namespace chromeos 62 63 #endif // CHROME_BROWSER_CHROMEOS_FILEAPI_MTP_FILE_SYSTEM_BACKEND_DELEGATE_H_ 64