Chromium Code Reviews| Index: chrome/browser/media_gallery/win/mtp_device_object_entry.h |
| diff --git a/chrome/browser/media_gallery/win/mtp_device_object_entry.h b/chrome/browser/media_gallery/win/mtp_device_object_entry.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d7f5dc26b88932864848be647179d3c9935346b7 |
| --- /dev/null |
| +++ b/chrome/browser/media_gallery/win/mtp_device_object_entry.h |
| @@ -0,0 +1,79 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| +// |
| +// This class manages all the information about the media transfer protocol |
| +// device object entry. To support media file system operations, this |
| +// class is created, destroyed and operated on the blocking thread. |
| +// |
| +// EXAMPLE: |
| +// class MTPDeviceObjectParser { |
| +// public: |
| +// MTPDeviceObjectParser() { } |
| +// |
| +// void GetObjectNameAndSize() { |
| +// MTPDeviceObjectEntry entry; |
| +// bool res = MediaDeviceOperationsUtil::GetMTPDeviceObjectEntry(device, |
| +// object_id_, |
| +// &entry); |
| +// string16 name = entry.file_name(); |
| +// int16 size = entry.size(); |
| +// } |
| +// |
| +// private: |
| +// base::win::scoped_comptr<IPortableDevice*> device_; |
| +// const string object_id_; |
| +// }; |
| + |
| +#ifndef CHROME_BROWSER_MEDIA_GALLERY_WIN_MTP_DEVICE_OBJECT_ENTRY_H_ |
| +#define CHROME_BROWSER_MEDIA_GALLERY_WIN_MTP_DEVICE_OBJECT_ENTRY_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/string16.h" |
| +#include "base/time.h" |
| + |
| +namespace chrome { |
| + |
| +class MTPDeviceObjectEntry; |
| +typedef std::vector<MTPDeviceObjectEntry> MTPDeviceObjectEntries; |
| + |
| +// See comment at top of file for a complete class description. |
| +class MTPDeviceObjectEntry { |
| + public: |
| + MTPDeviceObjectEntry(); |
| + MTPDeviceObjectEntry(const string16& object_id, |
| + const string16& object_name, |
| + bool is_directory, |
| + int64 size, |
| + const base::Time& last_modified_time); |
| + |
| + virtual ~MTPDeviceObjectEntry(); |
|
Lei Zhang
2012/11/01 02:34:57
Does not need to be virtual.
kmadhusu
2012/11/01 17:59:00
Done.
|
| + |
| + // Accessor functions to get object details. |
| + string16 object_id() const { return object_id_; } |
| + string16 file_name() const { return name_; } |
| + bool is_directory() const { return is_directory_; } |
| + int64 size() const { return size_; } |
| + base::Time last_modified_time() const { return last_modified_time_; } |
| + |
| + private: |
| + // The object identifier, e.g. "o299". |
| + string16 object_id_; |
| + |
| + // Friendly name of the object, e.g. "IMG_9911.jpeg". |
| + string16 name_; |
| + |
| + // True, if the current object is a directory/folder/album content type. |
| + bool is_directory_; |
| + |
| + // The object file size in bytes, e.g. "882992". |
| + int64 size_; |
| + |
| + // Last modified time of the object. |
| + base::Time last_modified_time_; |
| +}; |
| + |
| +} // namespace chrome |
| + |
| +#endif // CHROME_BROWSER_MEDIA_GALLERY_WIN_MTP_DEVICE_OBJECT_ENTRY_H_ |