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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_DELEGATE_H_
6 #define CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_DELEGATE_H_
8 #include "base/basictypes.h"
9 #include "base/callback_forward.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "storage/browser/fileapi/file_system_backend.h"
12 #include "storage/common/fileapi/file_system_types.h"
22 class FileSystemContext;
23 class FileStreamReader;
25 class FileStreamWriter;
27 } // namespace storage
31 // This is delegate interface to inject the implementation of the some methods
32 // of FileSystemBackend.
33 class FileSystemBackendDelegate {
35 virtual ~FileSystemBackendDelegate() {}
37 // Called from FileSystemBackend::GetAsyncFileUtil().
38 virtual storage::AsyncFileUtil* GetAsyncFileUtil(
39 storage::FileSystemType type) = 0;
41 // Called from FileSystemBackend::CreateFileStreamReader().
42 virtual scoped_ptr<storage::FileStreamReader> CreateFileStreamReader(
43 const storage::FileSystemURL& url,
45 int64 max_bytes_to_read,
46 const base::Time& expected_modification_time,
47 storage::FileSystemContext* context) = 0;
49 // Called from FileSystemBackend::CreateFileStreamWriter().
50 virtual scoped_ptr<storage::FileStreamWriter> CreateFileStreamWriter(
51 const storage::FileSystemURL& url,
53 storage::FileSystemContext* context) = 0;
55 // Called from the FileSystemWatcherService class. The returned pointer must
56 // stay valid until shutdown.
57 virtual storage::WatcherManager* GetWatcherManager(
58 const storage::FileSystemURL& url) = 0;
60 // Called from FileSystemBackend::GetRedirectURLForContents. Please ensure
61 // that the returned URL is secure to be opened in a browser tab, or referred
62 // from <img>, <video>, XMLHttpRequest, etc...
63 virtual void GetRedirectURLForContents(
64 const storage::FileSystemURL& url,
65 const storage::URLCallback& callback) = 0;
68 } // namespace chromeos
70 #endif // CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_DELEGATE_H_