| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, |
| 117 int result); | 117 int result); |
| 118 | 118 |
| 119 // Callback which gets the result of closing a file. | 119 // Callback which gets the result of closing a file. |
| 120 void CloseComplete(const CompletionCallback& callback, int result); | 120 void CloseComplete(const CompletionCallback& callback, int result); |
| 121 | 121 |
| 122 // Callbacks are created for use with base::FileUtilProxy. | |
| 123 base::WeakPtrFactory<URLFetcherFileWriter> weak_factory_; | |
| 124 | |
| 125 // Task runner on which file operations should happen. | 122 // Task runner on which file operations should happen. |
| 126 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; | 123 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; |
| 127 | 124 |
| 128 // Destination file path. | 125 // Destination file path. |
| 129 // Initialize() creates a temporary file if this variable is empty. | 126 // Initialize() creates a temporary file if this variable is empty. |
| 130 base::FilePath file_path_; | 127 base::FilePath file_path_; |
| 131 | 128 |
| 132 // True when this instance is responsible to delete the file at |file_path_|. | 129 // True when this instance is responsible to delete the file at |file_path_|. |
| 133 bool owns_file_; | 130 bool owns_file_; |
| 134 | 131 |
| 135 scoped_ptr<FileStream> file_stream_; | 132 scoped_ptr<FileStream> file_stream_; |
| 136 | 133 |
| 134 // Callbacks are created for use with base::FileUtilProxy. |
| 135 base::WeakPtrFactory<URLFetcherFileWriter> weak_factory_; |
| 136 |
| 137 DISALLOW_COPY_AND_ASSIGN(URLFetcherFileWriter); | 137 DISALLOW_COPY_AND_ASSIGN(URLFetcherFileWriter); |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 } // namespace net | 140 } // namespace net |
| 141 | 141 |
| 142 #endif // NET_URL_REQUEST_URL_FETCHER_RESPONSE_WRITER_H_ | 142 #endif // NET_URL_REQUEST_URL_FETCHER_RESPONSE_WRITER_H_ |
| OLD | NEW |