Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(582)

Side by Side Diff: webkit/fileapi/webfilewriter_base.h

Issue 15658004: Split FileAPI code for common|common_child|renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef WEBKIT_FILEAPI_WEBFILEWRITER_BASE_H_
6 #define WEBKIT_FILEAPI_WEBFILEWRITER_BASE_H_
7
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/storage/webkit_storage_export.h"
12
13 namespace WebKit {
14 class WebFileWriterClient;
15 class WebURL;
16 }
17
18 namespace fileapi {
19
20 class WEBKIT_STORAGE_EXPORT WebFileWriterBase
21 : public NON_EXPORTED_BASE(WebKit::WebFileWriter) {
22 public:
23 WebFileWriterBase(
24 const GURL& path, WebKit::WebFileWriterClient* client);
25 virtual ~WebFileWriterBase();
26
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();
31
32 protected:
33 // This calls DidSucceed() or DidFail() based on the value of |error_code|.
34 void DidFinish(base::PlatformFileError error_code);
35
36 void DidWrite(int64 bytes, bool complete);
37 void DidSucceed();
38 void DidFail(base::PlatformFileError error_code);
39
40 // Derived classes must provide these methods to asynchronously perform
41 // the requested operation, and they must call the appropiate DidSomething
42 // method upon completion and as progress is made in the Write case.
43 virtual void DoTruncate(const GURL& path, int64 offset) = 0;
44 virtual void DoWrite(const GURL& path, const GURL& blob_url,
45 int64 offset) = 0;
46 virtual void DoCancel() = 0;
47
48 private:
49 enum OperationType {
50 kOperationNone,
51 kOperationWrite,
52 kOperationTruncate
53 };
54
55 enum CancelState {
56 kCancelNotInProgress,
57 kCancelSent,
58 kCancelReceivedWriteResponse,
59 };
60
61 void FinishCancel();
62
63 GURL path_;
64 WebKit::WebFileWriterClient* client_;
65 OperationType operation_;
66 CancelState cancel_state_;
67 };
68
69 } // namespace fileapi
70
71 #endif // WEBKIT_FILEAPI_WEBFILEWRITER_BASE_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/syncable/syncable_file_system_util_unittest.cc ('k') | webkit/fileapi/webfilewriter_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698