| 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 <string> |
| 9 |
| 8 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
| 9 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileWriter.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileWriter.h" |
| 11 #include "webkit/storage/webkit_storage_export.h" | 13 #include "webkit/storage/webkit_storage_export.h" |
| 12 | 14 |
| 13 namespace WebKit { | 15 namespace WebKit { |
| 14 class WebFileWriterClient; | 16 class WebFileWriterClient; |
| 15 class WebURL; | 17 class WebURL; |
| 16 } | 18 } |
| 17 | 19 |
| 18 namespace fileapi { | 20 namespace fileapi { |
| 19 | 21 |
| 20 class WEBKIT_STORAGE_EXPORT WebFileWriterBase | 22 class WEBKIT_STORAGE_EXPORT WebFileWriterBase |
| 21 : public NON_EXPORTED_BASE(WebKit::WebFileWriter) { | 23 : public NON_EXPORTED_BASE(WebKit::WebFileWriter) { |
| 22 public: | 24 public: |
| 23 WebFileWriterBase( | 25 WebFileWriterBase( |
| 24 const GURL& path, WebKit::WebFileWriterClient* client); | 26 const GURL& path, WebKit::WebFileWriterClient* client); |
| 25 virtual ~WebFileWriterBase(); | 27 virtual ~WebFileWriterBase(); |
| 26 | 28 |
| 27 // WebFileWriter implementation | 29 // WebFileWriter implementation |
| 28 virtual void truncate(long long length); | 30 virtual void truncate(long long length); |
| 29 virtual void write(long long position, const WebKit::WebURL& blobURL); | 31 virtual void write(long long position, const WebKit::WebString& blobUUID); |
| 30 virtual void cancel(); | 32 virtual void cancel(); |
| 31 | 33 |
| 32 protected: | 34 protected: |
| 33 // Derived classes must provide these methods to asynchronously perform | 35 // Derived classes must provide these methods to asynchronously perform |
| 34 // the requested operation, and they must call the appropiate DidSomething | 36 // the requested operation, and they must call the appropiate DidSomething |
| 35 // method upon completion and as progress is made in the Write case. | 37 // method upon completion and as progress is made in the Write case. |
| 36 virtual void DoTruncate(const GURL& path, int64 offset) = 0; | 38 virtual void DoTruncate(const GURL& path, int64 offset) = 0; |
| 37 virtual void DoWrite(const GURL& path, const GURL& blob_url, | 39 virtual void DoWrite(const GURL& path, const std::string& blob_uuid, |
| 38 int64 offset) = 0; | 40 int64 offset) = 0; |
| 39 virtual void DoCancel() = 0; | 41 virtual void DoCancel() = 0; |
| 40 | 42 |
| 41 void DidSucceed(); | 43 void DidSucceed(); |
| 42 void DidFail(base::PlatformFileError error_code); | 44 void DidFail(base::PlatformFileError error_code); |
| 43 void DidWrite(int64 bytes, bool complete); | 45 void DidWrite(int64 bytes, bool complete); |
| 44 | 46 |
| 45 private: | 47 private: |
| 46 enum OperationType { | 48 enum OperationType { |
| 47 kOperationNone, | 49 kOperationNone, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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 |