| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_STORAGE_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_WIN
_H_ | 5 #ifndef CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_WIN_H_ |
| 6 #define CHROME_BROWSER_STORAGE_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_WIN
_H_ | 6 #define CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_WIN_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/storage_monitor/storage_monitor.h" | 11 #include "chrome/browser/storage_monitor/storage_monitor.h" |
| 12 | 12 |
| 13 namespace base { | 13 namespace base { |
| 14 class FilePath; | 14 class FilePath; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace chrome { | 17 namespace chrome { |
| 18 | 18 |
| 19 namespace test { | 19 namespace test { |
| 20 class TestRemovableDeviceNotificationsWindowWin; | 20 class TestStorageMonitorWin; |
| 21 } | 21 } |
| 22 | 22 |
| 23 class PortableDeviceWatcherWin; | 23 class PortableDeviceWatcherWin; |
| 24 class VolumeMountWatcherWin; | 24 class VolumeMountWatcherWin; |
| 25 | 25 |
| 26 class RemovableDeviceNotificationsWindowWin : public StorageMonitor { | 26 class StorageMonitorWin : public StorageMonitor { |
| 27 public: | 27 public: |
| 28 // Creates an instance of RemovableDeviceNotificationsWindowWin. Should only | 28 // Creates an instance of StorageMonitorWin. Should only be called by browser |
| 29 // be called by browser start up code. Use GetInstance() instead. | 29 // start up code. Use GetInstance() instead. |
| 30 static RemovableDeviceNotificationsWindowWin* Create(); | 30 static StorageMonitorWin* Create(); |
| 31 | 31 |
| 32 virtual ~RemovableDeviceNotificationsWindowWin(); | 32 virtual ~StorageMonitorWin(); |
| 33 | 33 |
| 34 // Must be called after the file thread is created. | 34 // Must be called after the file thread is created. |
| 35 void Init(); | 35 void Init(); |
| 36 | 36 |
| 37 // StorageMonitor: | 37 // StorageMonitor: |
| 38 virtual bool GetStorageInfoForPath( | 38 virtual bool GetStorageInfoForPath(const base::FilePath& path, |
| 39 const base::FilePath& path, | 39 StorageInfo* device_info) const OVERRIDE; |
| 40 StorageInfo* device_info) const OVERRIDE; | |
| 41 virtual bool GetMTPStorageInfoFromDeviceId( | 40 virtual bool GetMTPStorageInfoFromDeviceId( |
| 42 const std::string& storage_device_id, | 41 const std::string& storage_device_id, |
| 43 string16* device_location, | 42 string16* device_location, |
| 44 string16* storage_object_id) const OVERRIDE; | 43 string16* storage_object_id) const OVERRIDE; |
| 45 | 44 |
| 46 virtual uint64 GetStorageSize( | 45 virtual uint64 GetStorageSize( |
| 47 const base::FilePath::StringType& location) const OVERRIDE; | 46 const base::FilePath::StringType& location) const OVERRIDE; |
| 48 | 47 |
| 49 private: | 48 private: |
| 50 class PortableDeviceNotifications; | 49 class PortableDeviceNotifications; |
| 51 friend class test::TestRemovableDeviceNotificationsWindowWin; | 50 friend class test::TestStorageMonitorWin; |
| 52 | 51 |
| 53 // To support unit tests, this constructor takes |volume_mount_watcher| and | 52 // To support unit tests, this constructor takes |volume_mount_watcher| and |
| 54 // |portable_device_watcher| objects. These params are either constructed in | 53 // |portable_device_watcher| objects. These params are either constructed in |
| 55 // unit tests or in RemovableDeviceNotificationsWindowWin::Create() function. | 54 // unit tests or in StorageMonitorWin::Create() function. |
| 56 RemovableDeviceNotificationsWindowWin( | 55 StorageMonitorWin(VolumeMountWatcherWin* volume_mount_watcher, |
| 57 VolumeMountWatcherWin* volume_mount_watcher, | 56 PortableDeviceWatcherWin* portable_device_watcher); |
| 58 PortableDeviceWatcherWin* portable_device_watcher); | |
| 59 | 57 |
| 60 // Gets the removable storage information given a |device_path|. On success, | 58 // Gets the removable storage information given a |device_path|. On success, |
| 61 // returns true and fills in |device_location|, |unique_id|, |name| and | 59 // returns true and fills in |device_location|, |unique_id|, |name| and |
| 62 // |removable|, and |total_size_in_bytes|. | 60 // |removable|, and |total_size_in_bytes|. |
| 63 bool GetDeviceInfo(const base::FilePath& device_path, | 61 bool GetDeviceInfo(const base::FilePath& device_path, |
| 64 string16* device_location, | 62 string16* device_location, |
| 65 std::string* unique_id, | 63 std::string* unique_id, |
| 66 string16* name, | 64 string16* name, |
| 67 bool* removable, | 65 bool* removable, |
| 68 uint64* total_size_in_bytes) const; | 66 uint64* total_size_in_bytes) const; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 82 HMODULE instance_; | 80 HMODULE instance_; |
| 83 HWND window_; | 81 HWND window_; |
| 84 | 82 |
| 85 // The volume mount point watcher, used to manage the mounted devices. | 83 // The volume mount point watcher, used to manage the mounted devices. |
| 86 scoped_ptr<VolumeMountWatcherWin> volume_mount_watcher_; | 84 scoped_ptr<VolumeMountWatcherWin> volume_mount_watcher_; |
| 87 | 85 |
| 88 // The portable device watcher, used to manage media transfer protocol | 86 // The portable device watcher, used to manage media transfer protocol |
| 89 // devices. | 87 // devices. |
| 90 scoped_ptr<PortableDeviceWatcherWin> portable_device_watcher_; | 88 scoped_ptr<PortableDeviceWatcherWin> portable_device_watcher_; |
| 91 | 89 |
| 92 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsWindowWin); | 90 DISALLOW_COPY_AND_ASSIGN(StorageMonitorWin); |
| 93 }; | 91 }; |
| 94 | 92 |
| 95 } // namespace chrome | 93 } // namespace chrome |
| 96 | 94 |
| 97 #endif // CHROME_BROWSER_STORAGE_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_
WIN_H_ | 95 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_WIN_H_ |
| OLD | NEW |