| 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 "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/files/file_enumerator.h" | 6 #include "base/files/file_enumerator.h" |
| 7 #include "base/threading/worker_pool.h" | 7 #include "base/threading/worker_pool.h" |
| 8 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" | 8 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" |
| 9 #include "chrome/browser/extensions/api/image_writer_private/operation.h" | 9 #include "chrome/browser/extensions/api/image_writer_private/operation.h" |
| 10 #include "chrome/browser/extensions/api/image_writer_private/operation_manager.h
" | 10 #include "chrome/browser/extensions/api/image_writer_private/operation_manager.h
" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 success = false; | 131 success = false; |
| 132 } | 132 } |
| 133 return success; | 133 return success; |
| 134 } | 134 } |
| 135 | 135 |
| 136 void Operation::WriteComplete() { | 136 void Operation::WriteComplete() { |
| 137 | 137 |
| 138 DVLOG(2) << "Completed write of " << image_path_.value(); | 138 DVLOG(2) << "Completed write of " << image_path_.value(); |
| 139 SetProgress(kProgressComplete); | 139 SetProgress(kProgressComplete); |
| 140 | 140 |
| 141 if (verify_write_) { | 141 BrowserThread::PostTask( |
| 142 BrowserThread::PostTask(BrowserThread::FILE, | 142 BrowserThread::FILE, |
| 143 FROM_HERE, | 143 FROM_HERE, |
| 144 base::Bind(&Operation::VerifyWriteStart, this)); | 144 base::Bind(&Operation::VerifyWriteStart, |
| 145 } else { | 145 this)); |
| 146 BrowserThread::PostTask(BrowserThread::FILE, | |
| 147 FROM_HERE, | |
| 148 base::Bind(&Operation::Finish, this)); | |
| 149 } | |
| 150 } | 146 } |
| 151 | 147 |
| 152 void Operation::VerifyWriteStart() { | 148 void Operation::VerifyWriteStart() { |
| 153 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 149 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 154 if (IsCancelled()) { | 150 if (IsCancelled()) { |
| 155 return; | 151 return; |
| 156 } | 152 } |
| 157 | 153 |
| 158 DVLOG(1) << "Starting verification stage."; | 154 DVLOG(1) << "Starting verification stage."; |
| 159 | 155 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 200 |
| 205 DVLOG(2) << "Completed write verification of " << image_path_.value(); | 201 DVLOG(2) << "Completed write verification of " << image_path_.value(); |
| 206 | 202 |
| 207 SetProgress(kProgressComplete); | 203 SetProgress(kProgressComplete); |
| 208 | 204 |
| 209 Finish(); | 205 Finish(); |
| 210 } | 206 } |
| 211 | 207 |
| 212 } // namespace image_writer | 208 } // namespace image_writer |
| 213 } // namespace extensions | 209 } // namespace extensions |
| OLD | NEW |