| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef NET_URL_REQUEST_URL_FETCHER_RESPONSE_WRITER_H_ | 5 #ifndef NET_URL_REQUEST_URL_FETCHER_RESPONSE_WRITER_H_ |
| 6 #define NET_URL_REQUEST_URL_FETCHER_RESPONSE_WRITER_H_ | 6 #define NET_URL_REQUEST_URL_FETCHER_RESPONSE_WRITER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 // Closes the file if it is open and then delete it. | 107 // Closes the file if it is open and then delete it. |
| 108 void CloseAndDeleteFile(); | 108 void CloseAndDeleteFile(); |
| 109 | 109 |
| 110 // Callback which gets the result of a temporary file creation. | 110 // Callback which gets the result of a temporary file creation. |
| 111 void DidCreateTempFile(const CompletionCallback& callback, | 111 void DidCreateTempFile(const CompletionCallback& callback, |
| 112 base::FilePath* temp_file_path, | 112 base::FilePath* temp_file_path, |
| 113 bool success); | 113 bool success); |
| 114 | 114 |
| 115 // Callback which gets the result of FileStream::Open. | 115 // Callback which gets the result of FileStream::Open. |
| 116 void DidOpenFile(const CompletionCallback& callback, | 116 void DidOpenFile(const CompletionCallback& callback, int result); |
| 117 int result); | |
| 118 | 117 |
| 119 // Callback which gets the result of closing a file. | 118 // Callback which gets the result of closing a file. |
| 120 void CloseComplete(const CompletionCallback& callback, int result); | 119 void CloseComplete(const CompletionCallback& callback, int result); |
| 121 | 120 |
| 122 // Callbacks are created for use with base::FileUtilProxy. | 121 // Callbacks are created for use with base::FileUtilProxy. |
| 123 base::WeakPtrFactory<URLFetcherFileWriter> weak_factory_; | 122 base::WeakPtrFactory<URLFetcherFileWriter> weak_factory_; |
| 124 | 123 |
| 125 // Task runner on which file operations should happen. | 124 // Task runner on which file operations should happen. |
| 126 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; | 125 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; |
| 127 | 126 |
| 128 // Destination file path. | 127 // Destination file path. |
| 129 // Initialize() creates a temporary file if this variable is empty. | 128 // Initialize() creates a temporary file if this variable is empty. |
| 130 base::FilePath file_path_; | 129 base::FilePath file_path_; |
| 131 | 130 |
| 132 // True when this instance is responsible to delete the file at |file_path_|. | 131 // True when this instance is responsible to delete the file at |file_path_|. |
| 133 bool owns_file_; | 132 bool owns_file_; |
| 134 | 133 |
| 135 scoped_ptr<FileStream> file_stream_; | 134 scoped_ptr<FileStream> file_stream_; |
| 136 | 135 |
| 137 DISALLOW_COPY_AND_ASSIGN(URLFetcherFileWriter); | 136 DISALLOW_COPY_AND_ASSIGN(URLFetcherFileWriter); |
| 138 }; | 137 }; |
| 139 | 138 |
| 140 } // namespace net | 139 } // namespace net |
| 141 | 140 |
| 142 #endif // NET_URL_REQUEST_URL_FETCHER_RESPONSE_WRITER_H_ | 141 #endif // NET_URL_REQUEST_URL_FETCHER_RESPONSE_WRITER_H_ |
| OLD | NEW |