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 #include "webkit/browser/fileapi/file_writer_delegate.h" | 5 #include "webkit/browser/fileapi/file_writer_delegate.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/files/file_util_proxy.h" | 9 #include "base/files/file_util_proxy.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 base::Bind(&FileWriterDelegate::OnWriteCancelled, | 54 base::Bind(&FileWriterDelegate::OnWriteCancelled, |
55 weak_factory_.GetWeakPtr())); | 55 weak_factory_.GetWeakPtr())); |
56 // Return true to finish immediately if we have no pending writes. | 56 // Return true to finish immediately if we have no pending writes. |
57 // Otherwise we'll do the final cleanup in the Cancel callback. | 57 // Otherwise we'll do the final cleanup in the Cancel callback. |
58 if (status != net::ERR_IO_PENDING) { | 58 if (status != net::ERR_IO_PENDING) { |
59 write_callback_.Run(base::File::FILE_ERROR_ABORT, 0, | 59 write_callback_.Run(base::File::FILE_ERROR_ABORT, 0, |
60 GetCompletionStatusOnError()); | 60 GetCompletionStatusOnError()); |
61 } | 61 } |
62 } | 62 } |
63 | 63 |
64 void FileWriterDelegate::OnReceivedRedirect(net::URLRequest* request, | 64 void FileWriterDelegate::OnReceivedRedirect( |
65 const GURL& new_url, | 65 net::URLRequest* request, |
66 bool* defer_redirect) { | 66 const net::RedirectInfo& redirect_info, |
| 67 bool* defer_redirect) { |
67 NOTREACHED(); | 68 NOTREACHED(); |
68 OnError(base::File::FILE_ERROR_SECURITY); | 69 OnError(base::File::FILE_ERROR_SECURITY); |
69 } | 70 } |
70 | 71 |
71 void FileWriterDelegate::OnAuthRequired(net::URLRequest* request, | 72 void FileWriterDelegate::OnAuthRequired(net::URLRequest* request, |
72 net::AuthChallengeInfo* auth_info) { | 73 net::AuthChallengeInfo* auth_info) { |
73 NOTREACHED(); | 74 NOTREACHED(); |
74 OnError(base::File::FILE_ERROR_SECURITY); | 75 OnError(base::File::FILE_ERROR_SECURITY); |
75 } | 76 } |
76 | 77 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 if (error == base::File::FILE_OK && flush_error != net::OK) { | 235 if (error == base::File::FILE_OK && flush_error != net::OK) { |
235 // If the Flush introduced an error, overwrite the status. | 236 // If the Flush introduced an error, overwrite the status. |
236 // Otherwise, keep the original error status. | 237 // Otherwise, keep the original error status. |
237 error = NetErrorToFileError(flush_error); | 238 error = NetErrorToFileError(flush_error); |
238 progress_status = GetCompletionStatusOnError(); | 239 progress_status = GetCompletionStatusOnError(); |
239 } | 240 } |
240 write_callback_.Run(error, bytes_written, progress_status); | 241 write_callback_.Run(error, bytes_written, progress_status); |
241 } | 242 } |
242 | 243 |
243 } // namespace fileapi | 244 } // namespace fileapi |
OLD | NEW |