Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/platform_file.h" | 8 #include "base/platform_file.h" |
| 9 #include "googleurl/src/gurl.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" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 public: | 22 public: |
| 23 WebFileWriterBase( | 23 WebFileWriterBase( |
| 24 const GURL& path, WebKit::WebFileWriterClient* client); | 24 const GURL& path, WebKit::WebFileWriterClient* client); |
| 25 virtual ~WebFileWriterBase(); | 25 virtual ~WebFileWriterBase(); |
| 26 | 26 |
| 27 // WebFileWriter implementation | 27 // WebFileWriter implementation |
| 28 virtual void truncate(long long length); | 28 virtual void truncate(long long length); |
| 29 virtual void write(long long position, const WebKit::WebURL& blobURL); | 29 virtual void write(long long position, const WebKit::WebURL& blobURL); |
| 30 virtual void cancel(); | 30 virtual void cancel(); |
| 31 | 31 |
| 32 void DidFinish(base::PlatformFileError error_code); | |
| 33 void DidWrite(int64 bytes, bool complete); | |
|
michaeln
2013/05/15 20:18:26
do these need to be public now?
kinuko
2013/05/16 09:29:38
Made them protected.
| |
| 34 | |
| 32 protected: | 35 protected: |
| 36 void DidSucceed(); | |
| 37 void DidFail(base::PlatformFileError error_code); | |
| 38 | |
| 33 // Derived classes must provide these methods to asynchronously perform | 39 // Derived classes must provide these methods to asynchronously perform |
| 34 // the requested operation, and they must call the appropiate DidSomething | 40 // the requested operation, and they must call the appropiate DidSomething |
| 35 // method upon completion and as progress is made in the Write case. | 41 // method upon completion and as progress is made in the Write case. |
| 36 virtual void DoTruncate(const GURL& path, int64 offset) = 0; | 42 virtual void DoTruncate(const GURL& path, int64 offset) = 0; |
| 37 virtual void DoWrite(const GURL& path, const GURL& blob_url, | 43 virtual void DoWrite(const GURL& path, const GURL& blob_url, |
| 38 int64 offset) = 0; | 44 int64 offset) = 0; |
| 39 virtual void DoCancel() = 0; | 45 virtual void DoCancel() = 0; |
| 40 | 46 |
| 41 void DidSucceed(); | |
| 42 void DidFail(base::PlatformFileError error_code); | |
| 43 void DidWrite(int64 bytes, bool complete); | |
| 44 | |
| 45 private: | 47 private: |
| 46 enum OperationType { | 48 enum OperationType { |
| 47 kOperationNone, | 49 kOperationNone, |
| 48 kOperationWrite, | 50 kOperationWrite, |
| 49 kOperationTruncate | 51 kOperationTruncate |
| 50 }; | 52 }; |
| 51 | 53 |
| 52 enum CancelState { | 54 enum CancelState { |
| 53 kCancelNotInProgress, | 55 kCancelNotInProgress, |
| 54 kCancelSent, | 56 kCancelSent, |
| 55 kCancelReceivedWriteResponse, | 57 kCancelReceivedWriteResponse, |
| 56 }; | 58 }; |
| 57 | 59 |
| 58 void FinishCancel(); | 60 void FinishCancel(); |
| 59 | 61 |
| 60 GURL path_; | 62 GURL path_; |
| 61 WebKit::WebFileWriterClient* client_; | 63 WebKit::WebFileWriterClient* client_; |
| 62 OperationType operation_; | 64 OperationType operation_; |
| 63 CancelState cancel_state_; | 65 CancelState cancel_state_; |
| 64 }; | 66 }; |
| 65 | 67 |
| 66 } // namespace fileapi | 68 } // namespace fileapi |
| 67 | 69 |
| 68 #endif // WEBKIT_FILEAPI_WEBFILEWRITER_BASE_H_ | 70 #endif // WEBKIT_FILEAPI_WEBFILEWRITER_BASE_H_ |
| OLD | NEW |