Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // This file contains util functions to support media filesystem operations. | |
| 6 // It has several utility functions to open a media transfer protocol (MTP) | |
| 7 // device for communication, to enumerate the device contents, to read the | |
| 8 // device file object, etc. All these tasks may take an arbitary long time | |
| 9 // to complete. This file segregates those functionalities and runs them | |
| 10 // in the blocking pool thread rather than in the UI thread. | |
| 11 | |
| 12 #ifndef CHROME_BROWSER_MEDIA_GALLERY_WIN_MTP_DEVICE_OPERATIONS_UTIL_H_ | |
| 13 #define CHROME_BROWSER_MEDIA_GALLERY_WIN_MTP_DEVICE_OPERATIONS_UTIL_H_ | |
| 14 | |
| 15 #include <portabledeviceapi.h> | |
| 16 #include <string> | |
| 17 | |
| 18 #include "base/platform_file.h" | |
| 19 #include "base/string16.h" | |
| 20 #include "base/win/scoped_comptr.h" | |
| 21 #include "chrome/browser/media_gallery/win/mtp_device_object_entry.h" | |
| 22 | |
| 23 namespace chrome { | |
| 24 | |
|
Ryan Sleevi
2013/01/09 20:22:25
namespace media_transfer_protocol { }?
namespace m
kmadhusu
2013/01/10 04:59:19
"media_transfer_protocol" is too generic. I prefer
Ryan Sleevi
2013/01/10 05:07:18
media_transfer_protocol is not too generic for a n
kmadhusu
2013/01/10 23:37:56
Used media_transfer_protocol instead of media_tran
| |
| 25 // Opens the device for communication. |pnp_device_id| specifies the plug and | |
| 26 // play device ID string. On success, returns true and updates |device| with | |
| 27 // the portable device interface. | |
| 28 bool OpenDevice(const string16& pnp_device_id, | |
| 29 base::win::ScopedComPtr<IPortableDevice>* device); | |
| 30 | |
| 31 // Gets the details of the object specified by |object_id| from the given MTP | |
| 32 // |device|. On success, fills in |file_entry_info|. On failure, returns the | |
|
Ryan Sleevi
2013/01/09 20:22:25
nit: What does it return on success?
kmadhusu
2013/01/10 04:59:19
No error (base::PLATFORM_FILE_OK). Fixed the comme
| |
| 33 // corresponding platform file error and |file_entry_info| is not set. | |
| 34 base::PlatformFileError GetFileEntryInfo( | |
| 35 IPortableDevice* device, | |
| 36 const string16& object_id, | |
| 37 base::PlatformFileInfo* file_entry_info); | |
| 38 | |
| 39 // Gets the entries of the directory specified by |directory_object_id| from | |
| 40 // the given MTP |device|. On success, returns true and fills in | |
| 41 // |object_entries|. On failure, returns false and |object_entries| are not | |
|
Ryan Sleevi
2013/01/09 20:22:25
grammar: s/are not set/is not set/
While "entries
kmadhusu
2013/01/10 04:59:19
Done.
| |
| 42 // set. | |
| 43 bool GetDirectoryEntries(IPortableDevice* device, | |
| 44 const string16& directory_object_id, | |
| 45 MTPDeviceObjectEntries* object_entries); | |
| 46 | |
| 47 // Writes the data of the object specified by |file_object_id| from the given | |
| 48 // MTP |device| to the file specified by |local_path|. On success, returns | |
| 49 // true and writes the object data in |local_path|. On failure, returns false. | |
| 50 bool WriteFileObjectData(IPortableDevice* device, | |
| 51 const string16& file_object_id, | |
| 52 const FilePath& local_path); | |
| 53 | |
| 54 // Returns the identifier of the object specified by the |object_name|. | |
| 55 // |parent_id| specifies the object's parent identifier. | |
| 56 string16 GetObjectIdFromName(IPortableDevice* device, | |
| 57 const string16& parent_id, | |
| 58 const string16& object_name); | |
| 59 | |
| 60 } // namespace chrome | |
| 61 | |
| 62 #endif // CHROME_BROWSER_MEDIA_GALLERY_WIN_MTP_DEVICE_OPERATIONS_UTIL_H_ | |
| OLD | NEW |