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

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

Issue 6767010: More filesystem cleanup: convert URL-encoded-as-FilePath to actual URL, where (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef WEBKIT_FILEAPI_WEBFILEWRITER_BASE_H_ 5 #ifndef WEBKIT_FILEAPI_WEBFILEWRITER_BASE_H_
6 #define WEBKIT_FILEAPI_WEBFILEWRITER_BASE_H_ 6 #define WEBKIT_FILEAPI_WEBFILEWRITER_BASE_H_
7 7
8 #include "base/file_path.h"
9 #include "base/platform_file.h" 8 #include "base/platform_file.h"
9 #include "googleurl/src/gurl.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileWriter.h" 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileWriter.h"
11 11
12 class GURL;
13
14 namespace WebKit { 12 namespace WebKit {
15 class WebFileWriterClient; 13 class WebFileWriterClient;
16 class WebString; 14 class WebString;
17 class WebURL; 15 class WebURL;
18 } 16 }
19 17
20 namespace fileapi { 18 namespace fileapi {
21 19
22 class WebFileWriterBase : public WebKit::WebFileWriter { 20 class WebFileWriterBase : public WebKit::WebFileWriter {
23 public: 21 public:
24 WebFileWriterBase( 22 WebFileWriterBase(
25 const WebKit::WebString& path, WebKit::WebFileWriterClient* client); 23 const GURL& path, WebKit::WebFileWriterClient* client);
26 virtual ~WebFileWriterBase(); 24 virtual ~WebFileWriterBase();
27 25
28 // WebFileWriter implementation 26 // WebFileWriter implementation
29 virtual void truncate(long long length); 27 virtual void truncate(long long length);
30 virtual void write(long long position, const WebKit::WebURL& blobURL); 28 virtual void write(long long position, const WebKit::WebURL& blobURL);
31 virtual void cancel(); 29 virtual void cancel();
32 30
33 protected: 31 protected:
34 // Derived classes must provide these methods to asynchronously perform 32 // Derived classes must provide these methods to asynchronously perform
35 // the requested operation, and they must call the appropiate DidSomething 33 // the requested operation, and they must call the appropiate DidSomething
36 // method upon completion and as progress is made in the Write case. 34 // method upon completion and as progress is made in the Write case.
37 virtual void DoTruncate(const FilePath& path, int64 offset) = 0; 35 virtual void DoTruncate(const GURL& path, int64 offset) = 0;
38 virtual void DoWrite(const FilePath& path, const GURL& blob_url, 36 virtual void DoWrite(const GURL& path, const GURL& blob_url,
39 int64 offset) = 0; 37 int64 offset) = 0;
40 virtual void DoCancel() = 0; 38 virtual void DoCancel() = 0;
41 39
42 void DidSucceed(); 40 void DidSucceed();
43 void DidFail(base::PlatformFileError error_code); 41 void DidFail(base::PlatformFileError error_code);
44 void DidWrite(int64 bytes, bool complete); 42 void DidWrite(int64 bytes, bool complete);
45 43
46 private: 44 private:
47 enum OperationType { 45 enum OperationType {
48 kOperationNone, 46 kOperationNone,
49 kOperationWrite, 47 kOperationWrite,
50 kOperationTruncate 48 kOperationTruncate
51 }; 49 };
52 50
53 enum CancelState { 51 enum CancelState {
54 kCancelNotInProgress, 52 kCancelNotInProgress,
55 kCancelSent, 53 kCancelSent,
56 kCancelReceivedWriteResponse, 54 kCancelReceivedWriteResponse,
57 }; 55 };
58 56
59 void FinishCancel(); 57 void FinishCancel();
60 58
61 FilePath path_; 59 GURL path_;
62 WebKit::WebFileWriterClient* client_; 60 WebKit::WebFileWriterClient* client_;
63 OperationType operation_; 61 OperationType operation_;
64 CancelState cancel_state_; 62 CancelState cancel_state_;
65 }; 63 };
66 64
67 } // namespace fileapi 65 } // namespace fileapi
68 66
69 #endif // WEBKIT_FILEAPI_WEBFILEWRITER_BASE_H_ 67 #endif // WEBKIT_FILEAPI_WEBFILEWRITER_BASE_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_path_manager_unittest.cc ('k') | webkit/fileapi/webfilewriter_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698