diff options
author | kmadhusu@chromium.org <kmadhusu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-29 20:00:48 +0000 |
---|---|---|
committer | kmadhusu@chromium.org <kmadhusu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-29 20:00:48 +0000 |
commit | 9220de4adfbd72d4e9d1c6ef1ceb691f88c16459 (patch) | |
tree | 0a6b097af55fe8b8ca8336187ca19b94126b3b7f | |
parent | 8d2eefab02278e889c72b389f8c52ba1f97cb6d5 (diff) | |
download | chromium_src-9220de4adfbd72d4e9d1c6ef1ceb691f88c16459.zip chromium_src-9220de4adfbd72d4e9d1c6ef1ceb691f88c16459.tar.gz chromium_src-9220de4adfbd72d4e9d1c6ef1ceb691f88c16459.tar.bz2 |
Reuse PortableDeviceWatcherWin::GetStoragePathFromStorageId().
Follow up of codereview.chromium.org/11855012
BUG=151679
TEST=none
Review URL: https://chromiumcodereview.appspot.com/12093026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179392 0039d316-1c4b-4281-b951-d872f2087c98
5 files changed, 14 insertions, 21 deletions
diff --git a/chrome/browser/media_gallery/media_file_system_registry_unittest.cc b/chrome/browser/media_gallery/media_file_system_registry_unittest.cc index de69159..0c7cfbd 100644 --- a/chrome/browser/media_gallery/media_file_system_registry_unittest.cc +++ b/chrome/browser/media_gallery/media_file_system_registry_unittest.cc @@ -852,7 +852,7 @@ TEST_F(MediaFileSystemRegistryTest, GalleryNameMTP) { #if defined(OS_WIN) FilePath location( - test::TestPortableDeviceWatcherWin::GetStoragePathFromStorageId( + PortableDeviceWatcherWin::GetStoragePathFromStorageId( test::TestPortableDeviceWatcherWin::kStorageUniqueIdA)); #else FilePath location(FILE_PATH_LITERAL("/mtp_bogus")); diff --git a/chrome/browser/system_monitor/portable_device_watcher_win.cc b/chrome/browser/system_monitor/portable_device_watcher_win.cc index d9f68a2..188ee90 100644 --- a/chrome/browser/system_monitor/portable_device_watcher_win.cc +++ b/chrome/browser/system_monitor/portable_device_watcher_win.cc @@ -449,14 +449,6 @@ bool HandleDeviceAttachedEventOnBlockingThread( device_details); } -// Constructs and returns a storage path from storage unique identifier. -string16 GetStoragePathFromStorageId(const std::string& storage_unique_id) { - // Construct a dummy device path using the storage name. This is only used - // for registering the device media file system. - DCHECK(!storage_unique_id.empty()); - return UTF8ToUTF16("\\\\" + storage_unique_id); -} - // Registers |hwnd| to receive portable device notification details. On success, // returns the device notifications handle else returns NULL. HDEVNOTIFY RegisterPortableDeviceNotification(HWND hwnd) { @@ -545,6 +537,15 @@ bool PortableDeviceWatcherWin::GetMTPStorageInfoFromDeviceId( return false; } +// static +string16 PortableDeviceWatcherWin::GetStoragePathFromStorageId( + const std::string& storage_unique_id) { + // Construct a dummy device path using the storage name. This is only used + // for registering the device media file system. + DCHECK(!storage_unique_id.empty()); + return UTF8ToUTF16("\\\\" + storage_unique_id); +} + void PortableDeviceWatcherWin::EnumerateAttachedDevices() { DCHECK(media_task_runner_.get()); DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); diff --git a/chrome/browser/system_monitor/portable_device_watcher_win.h b/chrome/browser/system_monitor/portable_device_watcher_win.h index bf884b3..8c4a449 100644 --- a/chrome/browser/system_monitor/portable_device_watcher_win.h +++ b/chrome/browser/system_monitor/portable_device_watcher_win.h @@ -87,6 +87,10 @@ class PortableDeviceWatcherWin { string16* device_location, string16* storage_object_id) const; + // Constructs and returns a storage path from storage unique identifier. + static string16 GetStoragePathFromStorageId( + const std::string& storage_unique_id); + private: friend class test::TestPortableDeviceWatcherWin; diff --git a/chrome/browser/system_monitor/test_portable_device_watcher_win.cc b/chrome/browser/system_monitor/test_portable_device_watcher_win.cc index 22d3758..2911373 100644 --- a/chrome/browser/system_monitor/test_portable_device_watcher_win.cc +++ b/chrome/browser/system_monitor/test_portable_device_watcher_win.cc @@ -114,14 +114,6 @@ TestPortableDeviceWatcherWin::GetDeviceStorageObjects( return storage_objects; } -// static -string16 TestPortableDeviceWatcherWin::GetStoragePathFromStorageId( - const std::string& storage_id) { - if (storage_id.empty()) - return string16(); - return ASCIIToUTF16("\\\\") + ASCIIToUTF16(storage_id); -} - void TestPortableDeviceWatcherWin::EnumerateAttachedDevices() { } diff --git a/chrome/browser/system_monitor/test_portable_device_watcher_win.h b/chrome/browser/system_monitor/test_portable_device_watcher_win.h index e67de5d..f13b601 100644 --- a/chrome/browser/system_monitor/test_portable_device_watcher_win.h +++ b/chrome/browser/system_monitor/test_portable_device_watcher_win.h @@ -53,10 +53,6 @@ class TestPortableDeviceWatcherWin : public PortableDeviceWatcherWin { static PortableDeviceWatcherWin::StorageObjects GetDeviceStorageObjects( const string16& pnp_device_id); - // Returns the path of the requested storage specified by the |storage_id|. - // Returns an empty string if |storage_id| is empty. - static string16 GetStoragePathFromStorageId(const std::string& storage_id); - // Used by MediaFileSystemRegistry unit test. void set_use_dummy_mtp_storage_info(bool use_dummy_info) { use_dummy_mtp_storage_info_ = use_dummy_info; |