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

Side by Side Diff: chrome/browser/media_gallery/win/mtp_device_operations_util.h

Issue 11297002: [Media Gallery] Added code to support mtp device media file system on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Modified LazyInit() to handle GetDeviceStorageInfo failure Created 7 years, 11 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
(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 // MTPDeviceOperationsUtil provides support to 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 class 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
25 // See the top of the file for complete class description.
26 class MTPDeviceOperationsUtil {
27 public:
28 // Opens the device for communication. |pnp_device_id| specifies the plug and
29 // play device ID string. On success, returns true and updates |device| with
30 // the portable device interface.
31 static bool OpenDevice(const string16& pnp_device_id,
32 base::win::ScopedComPtr<IPortableDevice>* device);
33
34 // Gets the details of the object specified by |object_id| from the given MTP
35 // |device|. On success, fills in |file_entry_info|. On failure, returns the
36 // corresponding platform file error and |file_entry_info| is not set.
37 static base::PlatformFileError GetFileEntryInfo(
38 IPortableDevice* device,
39 const string16& object_id,
40 base::PlatformFileInfo* file_entry_info);
41
42 // Gets the entries of the directory specified by |directory_object_id| from
43 // the given MTP |device|. On success, returns true and fills in
44 // |object_entries|. On failure, returns false and |object_entries| are not
45 // set.
46 static bool GetDirectoryEntries(IPortableDevice* device,
47 const string16& directory_object_id,
48 MTPDeviceObjectEntries* object_entries);
49
50 // Writes the data of the object specified by |file_object_id| from the given
51 // MTP |device| to the file specified by |local_path|. On success, returns
52 // true and writes the object data in |local_path|. On failure, returns false.
53 static bool WriteFileObjectData(IPortableDevice* device,
54 const string16& file_object_id,
55 const FilePath& local_path);
56
57 // Returns the identifier of the object specified by the |object_name|.
58 // |parent_id| specifies the object's parent identifier.
59 static string16 GetObjectIdFromName(IPortableDevice* device,
60 const string16& parent_id,
61 const string16& object_name);
Ryan Sleevi 2013/01/05 03:00:58 DESIGN: Given that you take an |IPortableDevice*|
kmadhusu 2013/01/07 19:17:26 I thought an util class with a bunch of static met
Ryan Sleevi 2013/01/07 19:29:29 Classes that are static-method-holders are discour
kmadhusu 2013/01/07 19:36:43 Fair enough. Will fix it in the next patch.
kmadhusu 2013/01/08 03:19:40 Fixed. Created free functions in the chrome namesp
Peter Kasting 2013/01/08 04:34:01 If you're going to use namespaces, consider puttin
kmadhusu 2013/01/08 20:55:18 brettw@ is OOO today. I have sent an email to him
kmadhusu 2013/01/09 19:25:46 rsleevi@: brettw@ replied that he is a bit overloa
62 private:
63 DISALLOW_IMPLICIT_CONSTRUCTORS(MTPDeviceOperationsUtil);
64 };
65
66 } // namespace chrome
67
68 #endif // CHROME_BROWSER_MEDIA_GALLERY_WIN_MTP_DEVICE_OPERATIONS_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698