Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / chromeos / fileapi / file_system_backend_delegate.h
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.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_DELEGATE_H_
6 #define CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_DELEGATE_H_
7
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"
13
14 class GURL;
15
16 namespace base {
17 class Time;
18 }  // namespace base
19
20 namespace storage {
21 class AsyncFileUtil;
22 class FileSystemContext;
23 class FileStreamReader;
24 class FileSystemURL;
25 class FileStreamWriter;
26 class WatcherManager;
27 }  // namespace storage
28
29 namespace chromeos {
30
31 // This is delegate interface to inject the implementation of the some methods
32 // of FileSystemBackend.
33 class FileSystemBackendDelegate {
34  public:
35   virtual ~FileSystemBackendDelegate() {}
36
37   // Called from FileSystemBackend::GetAsyncFileUtil().
38   virtual storage::AsyncFileUtil* GetAsyncFileUtil(
39       storage::FileSystemType type) = 0;
40
41   // Called from FileSystemBackend::CreateFileStreamReader().
42   virtual scoped_ptr<storage::FileStreamReader> CreateFileStreamReader(
43       const storage::FileSystemURL& url,
44       int64 offset,
45       int64 max_bytes_to_read,
46       const base::Time& expected_modification_time,
47       storage::FileSystemContext* context) = 0;
48
49   // Called from FileSystemBackend::CreateFileStreamWriter().
50   virtual scoped_ptr<storage::FileStreamWriter> CreateFileStreamWriter(
51       const storage::FileSystemURL& url,
52       int64 offset,
53       storage::FileSystemContext* context) = 0;
54
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;
59
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;
66 };
67
68 }  // namespace chromeos
69
70 #endif  // CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_DELEGATE_H_