| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "content/child/fileapi/webfilewriter_base.h" | 5 #include "content/child/fileapi/webfilewriter_base.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "storage/common/fileapi/file_system_util.h" | 8 #include "storage/common/fileapi/file_system_util.h" |
| 9 #include "third_party/WebKit/public/platform/WebFileError.h" | 9 #include "third_party/WebKit/public/platform/WebFileError.h" |
| 10 #include "third_party/WebKit/public/platform/WebFileWriterClient.h" | 10 #include "third_party/WebKit/public/platform/WebFileWriterClient.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 DoCancel(); | 63 DoCancel(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void WebFileWriterBase::DidFinish(base::File::Error error_code) { | 66 void WebFileWriterBase::DidFinish(base::File::Error error_code) { |
| 67 if (error_code == base::File::FILE_OK) | 67 if (error_code == base::File::FILE_OK) |
| 68 DidSucceed(); | 68 DidSucceed(); |
| 69 else | 69 else |
| 70 DidFail(error_code); | 70 DidFail(error_code); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void WebFileWriterBase::DidWrite(int64 bytes, bool complete) { | 73 void WebFileWriterBase::DidWrite(int64_t bytes, bool complete) { |
| 74 DCHECK(kOperationWrite == operation_); | 74 DCHECK(kOperationWrite == operation_); |
| 75 switch (cancel_state_) { | 75 switch (cancel_state_) { |
| 76 case kCancelNotInProgress: | 76 case kCancelNotInProgress: |
| 77 if (complete) | 77 if (complete) |
| 78 operation_ = kOperationNone; | 78 operation_ = kOperationNone; |
| 79 client_->didWrite(bytes, complete); | 79 client_->didWrite(bytes, complete); |
| 80 break; | 80 break; |
| 81 case kCancelSent: | 81 case kCancelSent: |
| 82 // This is the success call of the write, which we'll eat, even though | 82 // This is the success call of the write, which we'll eat, even though |
| 83 // it succeeded before the cancel got there. We accepted the cancel call, | 83 // it succeeded before the cancel got there. We accepted the cancel call, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 144 |
| 145 void WebFileWriterBase::FinishCancel() { | 145 void WebFileWriterBase::FinishCancel() { |
| 146 DCHECK(kCancelReceivedWriteResponse == cancel_state_); | 146 DCHECK(kCancelReceivedWriteResponse == cancel_state_); |
| 147 DCHECK(kOperationNone != operation_); | 147 DCHECK(kOperationNone != operation_); |
| 148 cancel_state_ = kCancelNotInProgress; | 148 cancel_state_ = kCancelNotInProgress; |
| 149 operation_ = kOperationNone; | 149 operation_ = kOperationNone; |
| 150 client_->didFail(blink::WebFileErrorAbort); | 150 client_->didFail(blink::WebFileErrorAbort); |
| 151 } | 151 } |
| 152 | 152 |
| 153 } // namespace content | 153 } // namespace content |
| OLD | NEW |