| 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 BrowserThread::PostTask( | 141 if (verify_write_) { |
| 142 BrowserThread::FILE, | 142 BrowserThread::PostTask(BrowserThread::FILE, |
| 143 FROM_HERE, | 143 FROM_HERE, |
| 144 base::Bind(&Operation::VerifyWriteStart, | 144 base::Bind(&Operation::VerifyWriteStart, this)); |
| 145 this)); | 145 } else { |
| 146 BrowserThread::PostTask(BrowserThread::FILE, |
| 147 FROM_HERE, |
| 148 base::Bind(&Operation::Finish, this)); |
| 149 } |
| 146 } | 150 } |
| 147 | 151 |
| 148 void Operation::VerifyWriteStart() { | 152 void Operation::VerifyWriteStart() { |
| 149 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 153 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 150 if (IsCancelled()) { | 154 if (IsCancelled()) { |
| 151 return; | 155 return; |
| 152 } | 156 } |
| 153 | 157 |
| 154 DVLOG(1) << "Starting verification stage."; | 158 DVLOG(1) << "Starting verification stage."; |
| 155 | 159 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 204 |
| 201 DVLOG(2) << "Completed write verification of " << image_path_.value(); | 205 DVLOG(2) << "Completed write verification of " << image_path_.value(); |
| 202 | 206 |
| 203 SetProgress(kProgressComplete); | 207 SetProgress(kProgressComplete); |
| 204 | 208 |
| 205 Finish(); | 209 Finish(); |
| 206 } | 210 } |
| 207 | 211 |
| 208 } // namespace image_writer | 212 } // namespace image_writer |
| 209 } // namespace extensions | 213 } // namespace extensions |
| OLD | NEW |