OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 #include "modules/filesystem/FileSystemType.h" | 34 #include "modules/filesystem/FileSystemType.h" |
35 #include "public/platform/WebFileSystem.h" | 35 #include "public/platform/WebFileSystem.h" |
36 #include "public/platform/WebFileSystemCallbacks.h" | 36 #include "public/platform/WebFileSystemCallbacks.h" |
37 #include "public/platform/WebVector.h" | 37 #include "public/platform/WebVector.h" |
38 #include "wtf/OwnPtr.h" | 38 #include "wtf/OwnPtr.h" |
39 #include "wtf/PassOwnPtr.h" | 39 #include "wtf/PassOwnPtr.h" |
40 | 40 |
41 namespace WebCore { | 41 namespace WebCore { |
42 class AsyncFileSystemCallbacks; | 42 class AsyncFileSystemCallbacks; |
| 43 class AsyncFileWriterChromium; |
43 class BlobDataHandle; | 44 class BlobDataHandle; |
44 class ScriptExecutionContext; | 45 class ScriptExecutionContext; |
45 } | 46 } |
46 | 47 |
47 namespace WebKit { | 48 namespace WebKit { |
48 | 49 |
49 struct WebFileInfo; | 50 struct WebFileInfo; |
50 struct WebFileSystemEntry; | 51 struct WebFileSystemEntry; |
51 class WebString; | 52 class WebString; |
52 class WebURL; | 53 class WebURL; |
53 | 54 |
54 class WebFileSystemCallbacksImpl : public WebFileSystemCallbacks { | 55 class WebFileSystemCallbacksImpl : public WebFileSystemCallbacks { |
55 public: | 56 public: |
56 WebFileSystemCallbacksImpl(PassOwnPtr<WebCore::AsyncFileSystemCallbacks>, We
bCore::ScriptExecutionContext* = 0, WebCore::FileSystemSynchronousType = WebCore
::AsynchronousFileSystem); | 57 WebFileSystemCallbacksImpl(PassOwnPtr<WebCore::AsyncFileSystemCallbacks>, We
bCore::ScriptExecutionContext* = 0, WebCore::FileSystemSynchronousType = WebCore
::AsynchronousFileSystem); |
| 58 WebFileSystemCallbacksImpl(PassOwnPtr<WebCore::AsyncFileSystemCallbacks>, Pa
ssOwnPtr<WebCore::AsyncFileWriterChromium>); |
57 virtual ~WebFileSystemCallbacksImpl(); | 59 virtual ~WebFileSystemCallbacksImpl(); |
58 | 60 |
59 virtual void didSucceed(); | 61 virtual void didSucceed(); |
60 virtual void didReadMetadata(const WebFileInfo&); | 62 virtual void didReadMetadata(const WebFileInfo&); |
61 virtual void didCreateSnapshotFile(const WebFileInfo&); | 63 virtual void didCreateSnapshotFile(const WebFileInfo&); |
62 virtual void didReadDirectory(const WebVector<WebFileSystemEntry>& entries,
bool hasMore); | 64 virtual void didReadDirectory(const WebVector<WebFileSystemEntry>& entries,
bool hasMore); |
63 virtual void didOpenFileSystem(const WebString& name, const WebURL& rootURL)
; | 65 virtual void didOpenFileSystem(const WebString& name, const WebURL& rootURL)
; |
| 66 virtual void didCreateFileWriter(WebFileWriter*, long long length); |
64 virtual void didFail(WebFileError error); | 67 virtual void didFail(WebFileError error); |
65 virtual bool shouldBlockUntilCompletion() const; | 68 virtual bool shouldBlockUntilCompletion() const; |
66 | 69 |
67 // This internal overload is used by WorkerFileSystemCallbacksBridge to deli
ver a blob data handle | 70 // This internal overload is used by WorkerFileSystemCallbacksBridge to deli
ver a blob data handle |
68 // created on the main thread to an AsyncFileSystemCallback on a background
worker thread. The other | 71 // created on the main thread to an AsyncFileSystemCallback on a background
worker thread. The other |
69 // virtual method is invoked by the embedder. | 72 // virtual method is invoked by the embedder. |
70 void didCreateSnapshotFile(const WebFileInfo&, PassRefPtr<WebCore::BlobDataH
andle> snapshot); | 73 void didCreateSnapshotFile(const WebFileInfo&, PassRefPtr<WebCore::BlobDataH
andle> snapshot); |
71 | 74 |
72 private: | 75 private: |
73 OwnPtr<WebCore::AsyncFileSystemCallbacks> m_callbacks; | 76 OwnPtr<WebCore::AsyncFileSystemCallbacks> m_callbacks; |
74 | 77 |
75 // Used for worker's openFileSystem callbacks. | 78 // Used for worker's openFileSystem callbacks. |
76 WebCore::ScriptExecutionContext* m_context; | 79 WebCore::ScriptExecutionContext* m_context; |
77 WebCore::FileSystemSynchronousType m_synchronousType; | 80 WebCore::FileSystemSynchronousType m_synchronousType; |
| 81 |
| 82 // Used for createFileWriter callbacks. |
| 83 OwnPtr<WebCore::AsyncFileWriterChromium> m_writer; |
78 }; | 84 }; |
79 | 85 |
80 } // namespace WebKit | 86 } // namespace WebKit |
81 | 87 |
82 #endif // WebFileSystemCallbacksImpl_h | 88 #endif // WebFileSystemCallbacksImpl_h |
OLD | NEW |