| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/media_galleries/fileapi/mtp_file_stream_reader.h" | 5 #include "chrome/browser/media_galleries/fileapi/mtp_file_stream_reader.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
| 10 #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h" | 10 #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h" |
| 11 #include "chrome/browser/media_galleries/fileapi/mtp_device_map_service.h" | 11 #include "chrome/browser/media_galleries/fileapi/mtp_device_map_service.h" |
| 12 #include "chrome/browser/media_galleries/fileapi/native_media_file_util.h" | 12 #include "chrome/browser/media_galleries/fileapi/native_media_file_util.h" |
| 13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 14 #include "net/base/io_buffer.h" | 14 #include "net/base/io_buffer.h" |
| 15 #include "net/base/mime_sniffer.h" | 15 #include "net/base/mime_sniffer.h" |
| 16 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
| 17 #include "webkit/browser/fileapi/file_system_context.h" | 17 #include "storage/browser/fileapi/file_system_context.h" |
| 18 | 18 |
| 19 using storage::FileStreamReader; | 19 using storage::FileStreamReader; |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 // Called on the IO thread. | 23 // Called on the IO thread. |
| 24 MTPDeviceAsyncDelegate* GetMTPDeviceDelegate( | 24 MTPDeviceAsyncDelegate* GetMTPDeviceDelegate( |
| 25 const storage::FileSystemURL& url) { | 25 const storage::FileSystemURL& url) { |
| 26 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 26 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 27 return MTPDeviceMapService::GetInstance()->GetMTPDeviceAsyncDelegate( | 27 return MTPDeviceMapService::GetInstance()->GetMTPDeviceAsyncDelegate( |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 const base::File::Info& file_info) { | 194 const base::File::Info& file_info) { |
| 195 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 195 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 196 | 196 |
| 197 if (!VerifySnapshotTime(expected_modification_time_, file_info)) { | 197 if (!VerifySnapshotTime(expected_modification_time_, file_info)) { |
| 198 callback.Run(net::ERR_UPLOAD_FILE_CHANGED); | 198 callback.Run(net::ERR_UPLOAD_FILE_CHANGED); |
| 199 return; | 199 return; |
| 200 } | 200 } |
| 201 | 201 |
| 202 callback.Run(file_info.size); | 202 callback.Run(file_info.size); |
| 203 } | 203 } |
| OLD | NEW |