| 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/files/file_util.h" | 5 #include "base/files/file_util.h" |
| 6 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" | 6 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" |
| 7 #include "chrome/browser/extensions/api/image_writer_private/operation_manager.h
" | 7 #include "chrome/browser/extensions/api/image_writer_private/operation_manager.h
" |
| 8 #include "chrome/browser/extensions/api/image_writer_private/write_from_url_oper
ation.h" | 8 #include "chrome/browser/extensions/api/image_writer_private/write_from_url_oper
ation.h" |
| 9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 10 #include "net/url_request/url_fetcher.h" | 10 #include "net/url_request/url_fetcher.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 void WriteFromUrlOperation::OnURLFetchUploadProgress( | 101 void WriteFromUrlOperation::OnURLFetchUploadProgress( |
| 102 const net::URLFetcher* source, | 102 const net::URLFetcher* source, |
| 103 int64_t current, | 103 int64_t current, |
| 104 int64_t total) { | 104 int64_t total) { |
| 105 // No-op | 105 // No-op |
| 106 } | 106 } |
| 107 | 107 |
| 108 void WriteFromUrlOperation::OnURLFetchDownloadProgress( | 108 void WriteFromUrlOperation::OnURLFetchDownloadProgress( |
| 109 const net::URLFetcher* source, | 109 const net::URLFetcher* source, |
| 110 int64_t current, | 110 int64_t current, |
| 111 int64_t total) { | 111 int64_t total, |
| 112 int64_t current_network_bytes) { |
| 112 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 113 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 113 | 114 |
| 114 if (IsCancelled()) { | 115 if (IsCancelled()) { |
| 115 url_fetcher_.reset(NULL); | 116 url_fetcher_.reset(NULL); |
| 116 } | 117 } |
| 117 | 118 |
| 118 int progress = (kProgressComplete * current) / total; | 119 int progress = (kProgressComplete * current) / total; |
| 119 | 120 |
| 120 SetProgress(progress); | 121 SetProgress(progress); |
| 121 } | 122 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 if (IsCancelled()) { | 182 if (IsCancelled()) { |
| 182 return; | 183 return; |
| 183 } | 184 } |
| 184 | 185 |
| 185 SetProgress(kProgressComplete); | 186 SetProgress(kProgressComplete); |
| 186 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, continuation); | 187 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, continuation); |
| 187 } | 188 } |
| 188 | 189 |
| 189 } // namespace image_writer | 190 } // namespace image_writer |
| 190 } // namespace extensions | 191 } // namespace extensions |
| OLD | NEW |