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

Side by Side Diff: chrome/browser/media_galleries/linux/snapshot_file_details.cc

Issue 377383002: Media Galleries: Access MTP devices by file ids rather than file paths. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 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/linux/snapshot_file_details.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 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/media_galleries/linux/snapshot_file_details.h" 5 #include "chrome/browser/media_galleries/linux/snapshot_file_details.h"
6 6
7 #include "base/numerics/safe_conversions.h" 7 #include "base/numerics/safe_conversions.h"
8 8
9 //////////////////////////////////////////////////////////////////////////////// 9 ////////////////////////////////////////////////////////////////////////////////
10 // SnapshotRequestInfo // 10 // SnapshotRequestInfo //
11 //////////////////////////////////////////////////////////////////////////////// 11 ////////////////////////////////////////////////////////////////////////////////
12 12
13 SnapshotRequestInfo::SnapshotRequestInfo( 13 SnapshotRequestInfo::SnapshotRequestInfo(
14 const std::string& device_file_path, 14 uint32 file_id,
15 const base::FilePath& snapshot_file_path, 15 const base::FilePath& snapshot_file_path,
16 const MTPDeviceAsyncDelegate::CreateSnapshotFileSuccessCallback& 16 const MTPDeviceAsyncDelegate::CreateSnapshotFileSuccessCallback&
17 success_callback, 17 success_callback,
18 const MTPDeviceAsyncDelegate::ErrorCallback& error_callback) 18 const MTPDeviceAsyncDelegate::ErrorCallback& error_callback)
19 : device_file_path(device_file_path), 19 : file_id(file_id),
20 snapshot_file_path(snapshot_file_path), 20 snapshot_file_path(snapshot_file_path),
21 success_callback(success_callback), 21 success_callback(success_callback),
22 error_callback(error_callback) { 22 error_callback(error_callback) {
23 } 23 }
24 24
25 SnapshotRequestInfo::~SnapshotRequestInfo() { 25 SnapshotRequestInfo::~SnapshotRequestInfo() {
26 } 26 }
27 27
28 //////////////////////////////////////////////////////////////////////////////// 28 ////////////////////////////////////////////////////////////////////////////////
29 // SnapshotFileDetails // 29 // SnapshotFileDetails //
(...skipping 29 matching lines...) Expand all
59 return !error_occurred_ && (bytes_written_ == file_info_.size); 59 return !error_occurred_ && (bytes_written_ == file_info_.size);
60 } 60 }
61 61
62 uint32 SnapshotFileDetails::BytesToRead() const { 62 uint32 SnapshotFileDetails::BytesToRead() const {
63 // Read data in 1MB chunks. 63 // Read data in 1MB chunks.
64 static const uint32 kReadChunkSize = 1024 * 1024; 64 static const uint32 kReadChunkSize = 1024 * 1024;
65 return std::min( 65 return std::min(
66 kReadChunkSize, 66 kReadChunkSize,
67 base::checked_cast<uint32>(file_info_.size) - bytes_written_); 67 base::checked_cast<uint32>(file_info_.size) - bytes_written_);
68 } 68 }
OLDNEW
« no previous file with comments | « chrome/browser/media_galleries/linux/snapshot_file_details.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698