| 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 "chrome/browser/extensions/api/image_writer_private/write_from_url_oper
ation.h" | 5 #include "chrome/browser/extensions/api/image_writer_private/write_from_url_oper
ation.h" |
| 6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
| 7 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" | 7 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" |
| 8 #include "chrome/browser/extensions/api/image_writer_private/operation_manager.h
" | 8 #include "chrome/browser/extensions/api/image_writer_private/operation_manager.h
" |
| 9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 10 #include "net/traffic_annotation/network_traffic_annotation.h" | 10 #include "net/traffic_annotation/network_traffic_annotation.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 void WriteFromUrlOperation::VerifyDownloadCompare( | 193 void WriteFromUrlOperation::VerifyDownloadCompare( |
| 194 const base::Closure& continuation, | 194 const base::Closure& continuation, |
| 195 const std::string& download_hash) { | 195 const std::string& download_hash) { |
| 196 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 196 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 197 if (download_hash != hash_) { | 197 if (download_hash != hash_) { |
| 198 Error(error::kDownloadHashError); | 198 Error(error::kDownloadHashError); |
| 199 return; | 199 return; |
| 200 } | 200 } |
| 201 | 201 |
| 202 BrowserThread::PostTask( | 202 BrowserThread::PostTask( |
| 203 BrowserThread::FILE, | 203 BrowserThread::FILE, FROM_HERE, |
| 204 FROM_HERE, | 204 base::BindOnce(&WriteFromUrlOperation::VerifyDownloadComplete, this, |
| 205 base::Bind( | 205 continuation)); |
| 206 &WriteFromUrlOperation::VerifyDownloadComplete, this, continuation)); | |
| 207 } | 206 } |
| 208 | 207 |
| 209 void WriteFromUrlOperation::VerifyDownloadComplete( | 208 void WriteFromUrlOperation::VerifyDownloadComplete( |
| 210 const base::Closure& continuation) { | 209 const base::Closure& continuation) { |
| 211 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 210 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 212 if (IsCancelled()) { | 211 if (IsCancelled()) { |
| 213 return; | 212 return; |
| 214 } | 213 } |
| 215 | 214 |
| 216 SetProgress(kProgressComplete); | 215 SetProgress(kProgressComplete); |
| 217 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, continuation); | 216 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, continuation); |
| 218 } | 217 } |
| 219 | 218 |
| 220 } // namespace image_writer | 219 } // namespace image_writer |
| 221 } // namespace extensions | 220 } // namespace extensions |
| OLD | NEW |