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

Unified Diff: chrome/browser/media_gallery/mtp_device_delegate_impl_win.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: diff against codereview.chromium.org/11088012 Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media_gallery/mtp_device_delegate_impl_win.h
diff --git a/chrome/browser/media_gallery/mtp_device_delegate_impl_linux.h b/chrome/browser/media_gallery/mtp_device_delegate_impl_win.h
similarity index 70%
copy from chrome/browser/media_gallery/mtp_device_delegate_impl_linux.h
copy to chrome/browser/media_gallery/mtp_device_delegate_impl_win.h
index eb21b306e830edcbc95c287f91752c516224f953..a743447e560c870fcb62da4131a707522fa503b2 100644
--- a/chrome/browser/media_gallery/mtp_device_delegate_impl_linux.h
+++ b/chrome/browser/media_gallery/mtp_device_delegate_impl_win.h
@@ -2,12 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_MEDIA_GALLERY_MTP_DEVICE_DELEGATE_IMPL_LINUX_H_
-#define CHROME_BROWSER_MEDIA_GALLERY_MTP_DEVICE_DELEGATE_IMPL_LINUX_H_
+#ifndef CHROME_BROWSER_MEDIA_GALLERY_MTP_DEVICE_DELEGATE_IMPL_WIN_H_
+#define CHROME_BROWSER_MEDIA_GALLERY_MTP_DEVICE_DELEGATE_IMPL_WIN_H_
+
+#include <PortableDeviceApi.h>
#include "base/memory/ref_counted.h"
#include "base/platform_file.h"
+#include "base/string16.h"
#include "base/synchronization/waitable_event.h"
+#include "base/win/scoped_comptr.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "webkit/fileapi/file_system_file_util.h"
@@ -25,12 +29,12 @@ namespace chrome {
// operations. This class contains platform specific code to communicate with
// the attached MTP storage. Instantiate this class per MTP storage.
// This class is ref-counted, because MtpDeviceDelegate is ref-counted.
-class MtpDeviceDelegateImplLinux : public fileapi::MtpDeviceDelegate,
- public content::NotificationObserver {
+class MtpDeviceDelegateImplWin : public fileapi::MtpDeviceDelegate,
+ public content::NotificationObserver {
public:
// Constructed on UI thread. Defer the device initializations until the first
// file operation request. Do all the initializations in LazyInit() function.
- explicit MtpDeviceDelegateImplLinux(const std::string& device_location);
+ explicit MtpDeviceDelegateImplWin(const string16& pnp_device_id);
// Overridden from MtpDeviceDelegate. All the functions are called on
// |media_task_runner_|.
@@ -48,10 +52,10 @@ class MtpDeviceDelegateImplLinux : public fileapi::MtpDeviceDelegate,
private:
friend struct fileapi::MtpDeviceDelegateDeleter;
- friend class base::DeleteHelper<MtpDeviceDelegateImplLinux>;
+ friend class base::DeleteHelper<MtpDeviceDelegateImplWin>;
// Private because this class is ref-counted.
- virtual ~MtpDeviceDelegateImplLinux();
+ virtual ~MtpDeviceDelegateImplWin();
// content::NotificationObserver implementation.
virtual void Observe(int type,
@@ -63,21 +67,25 @@ class MtpDeviceDelegateImplLinux : public fileapi::MtpDeviceDelegate,
// communication, else false.
bool LazyInit();
- // Stores the registered file system device path value. This path does not
- // correspond to a real device path (E.g.: "/usb:2,2:81282").
- const std::string device_path_;
+ // Stores the plug and play device ID string. This is used to open the device
Peter Kasting 2012/10/24 22:51:41 Nit: Member variables should not say "stores a" or
kmadhusu 2012/10/25 19:12:48 Done.
+ // for communication.
+ // (E.g.:\\?\usb#vid_04a9&pid_3073#12#{6ac27878-a6fa-4155-ba85-f98f491d4f33})
Peter Kasting 2012/10/24 22:51:41 Nit: For clarity, remove the parens, add quotes, a
kmadhusu 2012/10/25 19:12:48 Done.
+ string16 pnp_device_id_;
+
+ // Stores the registered media file system path.
+ // E.g.: \\mtp:StorageSerial:SID-{10001,E,9823}:237483
+ const string16 registered_dev_path_;
Peter Kasting 2012/10/24 22:51:41 Nit: Do not abbreviate "device" to "dev"
kmadhusu 2012/10/25 19:12:48 Done.
- // Stores the device handle returned by
- // MediaTransferProtocolManager::OpenStorage().
- std::string device_handle_;
+ // Stores the removable storage root object identifier.
+ string16 storage_object_id_;
// Stores a reference to worker pool thread. All requests and response of file
// operations are posted on |media_task_runner_|.
scoped_refptr<base::SequencedTaskRunner> media_task_runner_;
- // |media_task_runner_| can wait on this event until the requested task is
- // complete.
- base::WaitableEvent on_task_completed_event_;
+ // Stores a pointer to IPortableDevice interface that provides access to a
+ // portable device.
Peter Kasting 2012/10/24 22:51:41 Nit: This comment mostly restates the code. If th
kmadhusu 2012/10/25 19:12:48 Done.
+ base::win::ScopedComPtr<IPortableDevice> device_;
// Used to notify |media_task_runner_| pending tasks about the shutdown
// sequence.
@@ -87,9 +95,9 @@ class MtpDeviceDelegateImplLinux : public fileapi::MtpDeviceDelegate,
// Used to listen for application termination message.
content::NotificationRegistrar registrar_;
- DISALLOW_COPY_AND_ASSIGN(MtpDeviceDelegateImplLinux);
+ DISALLOW_COPY_AND_ASSIGN(MtpDeviceDelegateImplWin);
};
} // namespace chrome
-#endif // CHROME_BROWSER_MEDIA_GALLERY_MTP_DEVICE_DELEGATE_IMPL_LINUX_H_
+#endif // CHROME_BROWSER_MEDIA_GALLERY_MTP_DEVICE_DELEGATE_IMPL_WIN_H_
« no previous file with comments | « chrome/browser/media_gallery/mtp_device_delegate_impl.h ('k') | chrome/browser/media_gallery/mtp_device_delegate_impl_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698