Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1108)

Side by Side Diff: chrome/browser/media_galleries/fileapi/mtp_file_stream_reader.cc

Issue 251723004: No media-file validation mode for DeviceMediaAsyncUtil. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review #2 Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/media_galleries/fileapi/mtp_file_stream_reader.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/platform_file.h" 10 #include "base/platform_file.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 success_callback, 60 success_callback,
61 base::Bind(&CallCompletionCallbackWithPlatformFileError, error_callback)); 61 base::Bind(&CallCompletionCallbackWithPlatformFileError, error_callback));
62 } 62 }
63 63
64 } // namespace 64 } // namespace
65 65
66 MTPFileStreamReader::MTPFileStreamReader( 66 MTPFileStreamReader::MTPFileStreamReader(
67 fileapi::FileSystemContext* file_system_context, 67 fileapi::FileSystemContext* file_system_context,
68 const fileapi::FileSystemURL& url, 68 const fileapi::FileSystemURL& url,
69 int64 initial_offset, 69 int64 initial_offset,
70 const base::Time& expected_modification_time) 70 const base::Time& expected_modification_time,
71 bool do_media_header_validation)
71 : file_system_context_(file_system_context), 72 : file_system_context_(file_system_context),
72 url_(url), 73 url_(url),
73 current_offset_(initial_offset), 74 current_offset_(initial_offset),
74 expected_modification_time_(expected_modification_time), 75 expected_modification_time_(expected_modification_time),
75 media_header_validated_(false), 76 media_header_validated_(!do_media_header_validation),
76 weak_factory_(this) { 77 weak_factory_(this) {
77 } 78 }
78 79
79 MTPFileStreamReader::~MTPFileStreamReader() { 80 MTPFileStreamReader::~MTPFileStreamReader() {
80 } 81 }
81 82
82 int MTPFileStreamReader::Read(net::IOBuffer* buf, int buf_len, 83 int MTPFileStreamReader::Read(net::IOBuffer* buf, int buf_len,
83 const net::CompletionCallback& callback) { 84 const net::CompletionCallback& callback) {
84 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 85 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
85 86
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 const base::File::Info& file_info) { 187 const base::File::Info& file_info) {
187 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 188 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
188 189
189 if (!VerifySnapshotTime(expected_modification_time_, file_info)) { 190 if (!VerifySnapshotTime(expected_modification_time_, file_info)) {
190 callback.Run(net::ERR_UPLOAD_FILE_CHANGED); 191 callback.Run(net::ERR_UPLOAD_FILE_CHANGED);
191 return; 192 return;
192 } 193 }
193 194
194 callback.Run(file_info.size); 195 callback.Run(file_info.size);
195 } 196 }
OLDNEW
« no previous file with comments | « chrome/browser/media_galleries/fileapi/mtp_file_stream_reader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698