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

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

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
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 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_LINUX_SNAPSHOT_FILE_DETAILS_H_ 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_LINUX_SNAPSHOT_FILE_DETAILS_H_
6 #define CHROME_BROWSER_MEDIA_GALLERIES_LINUX_SNAPSHOT_FILE_DETAILS_H_ 6 #define CHROME_BROWSER_MEDIA_GALLERIES_LINUX_SNAPSHOT_FILE_DETAILS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/files/file.h" 12 #include "base/files/file.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h" 14 #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h"
15 15
16 // Used to represent snapshot file request params. 16 // Used to represent snapshot file request params.
17 struct SnapshotRequestInfo { 17 struct SnapshotRequestInfo {
18 SnapshotRequestInfo( 18 SnapshotRequestInfo(
19 const std::string& device_file_path, 19 uint32 file_id,
20 const base::FilePath& snapshot_file_path, 20 const base::FilePath& snapshot_file_path,
21 const MTPDeviceAsyncDelegate::CreateSnapshotFileSuccessCallback& 21 const MTPDeviceAsyncDelegate::CreateSnapshotFileSuccessCallback&
22 success_callback, 22 success_callback,
23 const MTPDeviceAsyncDelegate::ErrorCallback& error_callback); 23 const MTPDeviceAsyncDelegate::ErrorCallback& error_callback);
24 ~SnapshotRequestInfo(); 24 ~SnapshotRequestInfo();
25 25
26 // MTP device file path. 26 // MTP device file id.
27 const std::string device_file_path; 27 const uint32 file_id;
28 28
29 // Local platform path of the snapshot file. 29 // Local platform path of the snapshot file.
30 const base::FilePath snapshot_file_path; 30 const base::FilePath snapshot_file_path;
31 31
32 // A callback to be called when CreateSnapshotFile() succeeds. 32 // A callback to be called when CreateSnapshotFile() succeeds.
33 const MTPDeviceAsyncDelegate::CreateSnapshotFileSuccessCallback 33 const MTPDeviceAsyncDelegate::CreateSnapshotFileSuccessCallback
34 success_callback; 34 success_callback;
35 35
36 // A callback to be called when CreateSnapshotFile() fails. 36 // A callback to be called when CreateSnapshotFile() fails.
37 const MTPDeviceAsyncDelegate::ErrorCallback error_callback; 37 const MTPDeviceAsyncDelegate::ErrorCallback error_callback;
38 }; 38 };
39 39
40 // SnapshotFileDetails tracks the current state of the snapshot file (e.g how 40 // SnapshotFileDetails tracks the current state of the snapshot file (e.g how
41 // many bytes written to the snapshot file, source file details, snapshot file 41 // many bytes written to the snapshot file, source file details, snapshot file
42 // metadata information, etc). 42 // metadata information, etc).
43 class SnapshotFileDetails { 43 class SnapshotFileDetails {
44 public: 44 public:
45 SnapshotFileDetails(const SnapshotRequestInfo& request_info, 45 SnapshotFileDetails(const SnapshotRequestInfo& request_info,
46 const base::File::Info& file_info); 46 const base::File::Info& file_info);
47 47
48 ~SnapshotFileDetails(); 48 ~SnapshotFileDetails();
49 49
50 std::string device_file_path() const { 50 uint32 file_id() const {
51 return request_info_.device_file_path; 51 return request_info_.file_id;
52 } 52 }
53 53
54 base::FilePath snapshot_file_path() const { 54 base::FilePath snapshot_file_path() const {
55 return request_info_.snapshot_file_path; 55 return request_info_.snapshot_file_path;
56 } 56 }
57 57
58 uint32 bytes_written() const { 58 uint32 bytes_written() const {
59 return bytes_written_; 59 return bytes_written_;
60 } 60 }
61 61
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // Number of bytes written into the snapshot file. 103 // Number of bytes written into the snapshot file.
104 uint32 bytes_written_; 104 uint32 bytes_written_;
105 105
106 // Whether an error occurred during file transfer. 106 // Whether an error occurred during file transfer.
107 bool error_occurred_; 107 bool error_occurred_;
108 108
109 DISALLOW_COPY_AND_ASSIGN(SnapshotFileDetails); 109 DISALLOW_COPY_AND_ASSIGN(SnapshotFileDetails);
110 }; 110 };
111 111
112 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_SNAPSHOT_FILE_DETAILS_H_ 112 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_SNAPSHOT_FILE_DETAILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698