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

Side by Side Diff: device/media_transfer_protocol/media_transfer_protocol_manager.h

Issue 947943002: Implement CopyFileFromLocal of MTPDeviceAsyncDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix failed test case. Created 5 years, 10 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_ 5 #ifndef DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_
6 #define DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_ 6 #define DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // The second argument is true if there was an error. 52 // The second argument is true if there was an error.
53 typedef base::Callback<void(const std::string& data, 53 typedef base::Callback<void(const std::string& data,
54 bool error)> ReadFileCallback; 54 bool error)> ReadFileCallback;
55 55
56 // A callback to handle the result of GetFileInfo. 56 // A callback to handle the result of GetFileInfo.
57 // The first argument is a file entry. 57 // The first argument is a file entry.
58 // The second argument is true if there was an error. 58 // The second argument is true if there was an error.
59 typedef base::Callback<void(const MtpFileEntry& file_entry, 59 typedef base::Callback<void(const MtpFileEntry& file_entry,
60 bool error)> GetFileInfoCallback; 60 bool error)> GetFileInfoCallback;
61 61
62 // A callback to handle the result of CopyFileFromLocal.
63 // The first argument is true if there was an error.
64 typedef base::Callback<void(bool error)> CopyFileFromLocalCallback;
65
62 // Implement this interface to be notified about MTP storage 66 // Implement this interface to be notified about MTP storage
63 // attachment / detachment events. 67 // attachment / detachment events.
64 class Observer { 68 class Observer {
65 public: 69 public:
66 virtual ~Observer() {} 70 virtual ~Observer() {}
67 71
68 // A function called after a MTP storage has been attached / detached. 72 // A function called after a MTP storage has been attached / detached.
69 virtual void StorageChanged(bool is_attached, 73 virtual void StorageChanged(bool is_attached,
70 const std::string& storage_name) = 0; 74 const std::string& storage_name) = 0;
71 }; 75 };
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 uint32 offset, 112 uint32 offset,
109 uint32 count, 113 uint32 count,
110 const ReadFileCallback& callback) = 0; 114 const ReadFileCallback& callback) = 0;
111 115
112 // Gets the file metadata for |file_id| on |storage_handle| and runs 116 // Gets the file metadata for |file_id| on |storage_handle| and runs
113 // |callback|. 117 // |callback|.
114 virtual void GetFileInfo(const std::string& storage_handle, 118 virtual void GetFileInfo(const std::string& storage_handle,
115 uint32 file_id, 119 uint32 file_id,
116 const GetFileInfoCallback& callback) = 0; 120 const GetFileInfoCallback& callback) = 0;
117 121
122 // Copies the file from |source_file_descriptor| to |file_name| on
123 // |parent_id|.
124 virtual void CopyFileFromLocal(const std::string& storage_handle,
125 const uint32 source_file_descriptor,
126 const uint32 parent_id,
127 const std::string& file_name,
128 const CopyFileFromLocalCallback& callback) = 0;
129
118 // Creates and returns the global MediaTransferProtocolManager instance. 130 // Creates and returns the global MediaTransferProtocolManager instance.
119 // On Linux, |task_runner| specifies the task runner to process asynchronous 131 // On Linux, |task_runner| specifies the task runner to process asynchronous
120 // operations. 132 // operations.
121 // On ChromeOS, |task_runner| should just be set to NULL because ChromeOS 133 // On ChromeOS, |task_runner| should just be set to NULL because ChromeOS
122 // already has a dedicated message loop proxy. 134 // already has a dedicated message loop proxy.
123 static MediaTransferProtocolManager* Initialize( 135 static MediaTransferProtocolManager* Initialize(
124 scoped_refptr<base::SequencedTaskRunner> task_runner); 136 scoped_refptr<base::SequencedTaskRunner> task_runner);
125 }; 137 };
126 138
127 } // namespace device 139 } // namespace device
128 140
129 #endif // DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_ 141 #endif // DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698