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

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

Issue 14247034: Move Media Galleries FileAPI code out of webkit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cr-14352004
Patch Set: Add android ifdef. Created 7 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
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_path.h" 12 #include "base/files/file_path.h"
13 #include "base/platform_file.h" 13 #include "base/platform_file.h"
14 #include "webkit/fileapi/media/mtp_device_async_delegate.h" 14 #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h"
15 15
16 namespace chrome { 16 namespace chrome {
17 17
18 // Used to represent snapshot file request params. 18 // Used to represent snapshot file request params.
19 struct SnapshotRequestInfo { 19 struct SnapshotRequestInfo {
20 SnapshotRequestInfo( 20 SnapshotRequestInfo(
21 const std::string& device_file_path, 21 const std::string& device_file_path,
22 const base::FilePath& snapshot_file_path, 22 const base::FilePath& snapshot_file_path,
23 const fileapi::MTPDeviceAsyncDelegate::CreateSnapshotFileSuccessCallback& 23 const MTPDeviceAsyncDelegate::CreateSnapshotFileSuccessCallback&
24 success_callback, 24 success_callback,
25 const fileapi::MTPDeviceAsyncDelegate::ErrorCallback& error_callback); 25 const MTPDeviceAsyncDelegate::ErrorCallback& error_callback);
26 ~SnapshotRequestInfo(); 26 ~SnapshotRequestInfo();
27 27
28 // MTP device file path. 28 // MTP device file path.
29 const std::string device_file_path; 29 const std::string device_file_path;
30 30
31 // Local platform path of the snapshot file. 31 // Local platform path of the snapshot file.
32 const base::FilePath snapshot_file_path; 32 const base::FilePath snapshot_file_path;
33 33
34 // A callback to be called when CreateSnapshotFile() succeeds. 34 // A callback to be called when CreateSnapshotFile() succeeds.
35 const fileapi::MTPDeviceAsyncDelegate::CreateSnapshotFileSuccessCallback 35 const MTPDeviceAsyncDelegate::CreateSnapshotFileSuccessCallback
36 success_callback; 36 success_callback;
37 37
38 // A callback to be called when CreateSnapshotFile() fails. 38 // A callback to be called when CreateSnapshotFile() fails.
39 const fileapi::MTPDeviceAsyncDelegate::ErrorCallback error_callback; 39 const MTPDeviceAsyncDelegate::ErrorCallback error_callback;
40 }; 40 };
41 41
42 // SnapshotFileDetails tracks the current state of the snapshot file (e.g how 42 // SnapshotFileDetails tracks the current state of the snapshot file (e.g how
43 // many bytes written to the snapshot file, source file details, snapshot file 43 // many bytes written to the snapshot file, source file details, snapshot file
44 // metadata information, etc). 44 // metadata information, etc).
45 class SnapshotFileDetails { 45 class SnapshotFileDetails {
46 public: 46 public:
47 SnapshotFileDetails(const SnapshotRequestInfo& request_info, 47 SnapshotFileDetails(const SnapshotRequestInfo& request_info,
48 const base::PlatformFileInfo& file_info); 48 const base::PlatformFileInfo& file_info);
49 49
50 ~SnapshotFileDetails(); 50 ~SnapshotFileDetails();
51 51
52 std::string device_file_path() const { 52 std::string device_file_path() const {
53 return request_info_.device_file_path; 53 return request_info_.device_file_path;
54 } 54 }
55 55
56 base::FilePath snapshot_file_path() const { 56 base::FilePath snapshot_file_path() const {
57 return request_info_.snapshot_file_path; 57 return request_info_.snapshot_file_path;
58 } 58 }
59 59
60 uint32 bytes_written() const { 60 uint32 bytes_written() const {
61 return bytes_written_; 61 return bytes_written_;
62 } 62 }
63 63
64 const base::PlatformFileInfo file_info() const { 64 const base::PlatformFileInfo file_info() const {
65 return file_info_; 65 return file_info_;
66 } 66 }
67 67
68 const fileapi::MTPDeviceAsyncDelegate::CreateSnapshotFileSuccessCallback 68 const MTPDeviceAsyncDelegate::CreateSnapshotFileSuccessCallback
69 success_callback() const { 69 success_callback() const {
70 return request_info_.success_callback; 70 return request_info_.success_callback;
71 } 71 }
72 72
73 const fileapi::MTPDeviceAsyncDelegate::ErrorCallback error_callback() const { 73 const MTPDeviceAsyncDelegate::ErrorCallback error_callback() const {
74 return request_info_.error_callback; 74 return request_info_.error_callback;
75 } 75 }
76 76
77 bool error_occurred() const { 77 bool error_occurred() const {
78 return error_occurred_; 78 return error_occurred_;
79 } 79 }
80 80
81 void set_error_occurred(bool error); 81 void set_error_occurred(bool error);
82 82
83 // Adds |bytes_written| to |bytes_written_|. 83 // Adds |bytes_written| to |bytes_written_|.
(...skipping 23 matching lines...) Expand all
107 107
108 // Whether an error occurred during file transfer. 108 // Whether an error occurred during file transfer.
109 bool error_occurred_; 109 bool error_occurred_;
110 110
111 DISALLOW_COPY_AND_ASSIGN(SnapshotFileDetails); 111 DISALLOW_COPY_AND_ASSIGN(SnapshotFileDetails);
112 }; 112 };
113 113
114 } // namespace chrome 114 } // namespace chrome
115 115
116 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_SNAPSHOT_FILE_DETAILS_H_ 116 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_SNAPSHOT_FILE_DETAILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698