1 // Copyright (c) 2012 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 WEBKIT_FILEAPI_WEBFILEWRITER_BASE_H_
6 #define WEBKIT_FILEAPI_WEBFILEWRITER_BASE_H_
8 #include "base/platform_file.h"
9 #include "googleurl/src/gurl.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileWriter.h"
11 #include "webkit/fileapi/fileapi_export.h"
14 class WebFileWriterClient
;
20 class FILEAPI_EXPORT WebFileWriterBase
21 : public NON_EXPORTED_BASE(WebKit::WebFileWriter
) {
24 const GURL
& path
, WebKit::WebFileWriterClient
* client
);
25 virtual ~WebFileWriterBase();
27 // WebFileWriter implementation
28 virtual void truncate(long long length
);
29 virtual void write(long long position
, const WebKit::WebURL
& blobURL
);
30 virtual void cancel();
33 // Derived classes must provide these methods to asynchronously perform
34 // the requested operation, and they must call the appropiate DidSomething
35 // method upon completion and as progress is made in the Write case.
36 virtual void DoTruncate(const GURL
& path
, int64 offset
) = 0;
37 virtual void DoWrite(const GURL
& path
, const GURL
& blob_url
,
39 virtual void DoCancel() = 0;
42 void DidFail(base::PlatformFileError error_code
);
43 void DidWrite(int64 bytes
, bool complete
);
55 kCancelReceivedWriteResponse
,
61 WebKit::WebFileWriterClient
* client_
;
62 OperationType operation_
;
63 CancelState cancel_state_
;
66 } // namespace fileapi
68 #endif // WEBKIT_FILEAPI_WEBFILEWRITER_BASE_H_