| 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_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_WIN_
H_ | 5 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_WIN_
H_ |
| 6 #define CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_WIN_
H_ | 6 #define CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_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/system_monitor/removable_storage_notifications.h" | 11 #include "chrome/browser/system_monitor/removable_storage_notifications.h" |
| 12 | 12 |
| 13 namespace base { |
| 13 class FilePath; | 14 class FilePath; |
| 15 } |
| 14 | 16 |
| 15 namespace chrome { | 17 namespace chrome { |
| 16 | 18 |
| 17 namespace test { | 19 namespace test { |
| 18 class TestRemovableDeviceNotificationsWindowWin; | 20 class TestRemovableDeviceNotificationsWindowWin; |
| 19 } | 21 } |
| 20 | 22 |
| 21 class PortableDeviceWatcherWin; | 23 class PortableDeviceWatcherWin; |
| 22 class VolumeMountWatcherWin; | 24 class VolumeMountWatcherWin; |
| 23 | 25 |
| 24 class RemovableDeviceNotificationsWindowWin | 26 class RemovableDeviceNotificationsWindowWin |
| 25 : public RemovableStorageNotifications { | 27 : public RemovableStorageNotifications { |
| 26 public: | 28 public: |
| 27 // Creates an instance of RemovableDeviceNotificationsWindowWin. Should only | 29 // Creates an instance of RemovableDeviceNotificationsWindowWin. Should only |
| 28 // be called by browser start up code. Use GetInstance() instead. | 30 // be called by browser start up code. Use GetInstance() instead. |
| 29 static RemovableDeviceNotificationsWindowWin* Create(); | 31 static RemovableDeviceNotificationsWindowWin* Create(); |
| 30 | 32 |
| 31 virtual ~RemovableDeviceNotificationsWindowWin(); | 33 virtual ~RemovableDeviceNotificationsWindowWin(); |
| 32 | 34 |
| 33 // Must be called after the file thread is created. | 35 // Must be called after the file thread is created. |
| 34 void Init(); | 36 void Init(); |
| 35 | 37 |
| 36 // RemovableStorageNotifications: | 38 // RemovableStorageNotifications: |
| 37 virtual bool GetDeviceInfoForPath( | 39 virtual bool GetDeviceInfoForPath( |
| 38 const FilePath& path, | 40 const base::FilePath& path, |
| 39 StorageInfo* device_info) const OVERRIDE; | 41 StorageInfo* device_info) const OVERRIDE; |
| 40 virtual uint64 GetStorageSize(const std::string& location) const OVERRIDE; | 42 virtual uint64 GetStorageSize(const std::string& location) const OVERRIDE; |
| 41 virtual bool GetMTPStorageInfoFromDeviceId( | 43 virtual bool GetMTPStorageInfoFromDeviceId( |
| 42 const std::string& storage_device_id, | 44 const std::string& storage_device_id, |
| 43 string16* device_location, | 45 string16* device_location, |
| 44 string16* storage_object_id) const OVERRIDE; | 46 string16* storage_object_id) const OVERRIDE; |
| 45 | 47 |
| 46 private: | 48 private: |
| 47 class PortableDeviceNotifications; | 49 class PortableDeviceNotifications; |
| 48 friend class test::TestRemovableDeviceNotificationsWindowWin; | 50 friend class test::TestRemovableDeviceNotificationsWindowWin; |
| 49 | 51 |
| 50 // To support unit tests, this constructor takes |volume_mount_watcher| and | 52 // To support unit tests, this constructor takes |volume_mount_watcher| and |
| 51 // |portable_device_watcher| objects. These params are either constructed in | 53 // |portable_device_watcher| objects. These params are either constructed in |
| 52 // unit tests or in RemovableDeviceNotificationsWindowWin::Create() function. | 54 // unit tests or in RemovableDeviceNotificationsWindowWin::Create() function. |
| 53 RemovableDeviceNotificationsWindowWin( | 55 RemovableDeviceNotificationsWindowWin( |
| 54 VolumeMountWatcherWin* volume_mount_watcher, | 56 VolumeMountWatcherWin* volume_mount_watcher, |
| 55 PortableDeviceWatcherWin* portable_device_watcher); | 57 PortableDeviceWatcherWin* portable_device_watcher); |
| 56 | 58 |
| 57 // Gets the removable storage information given a |device_path|. On success, | 59 // Gets the removable storage information given a |device_path|. On success, |
| 58 // returns true and fills in |device_location|, |unique_id|, |name| and | 60 // returns true and fills in |device_location|, |unique_id|, |name| and |
| 59 // |removable|. | 61 // |removable|. |
| 60 bool GetDeviceInfo(const FilePath& device_path, | 62 bool GetDeviceInfo(const base::FilePath& device_path, |
| 61 string16* device_location, | 63 string16* device_location, |
| 62 std::string* unique_id, | 64 std::string* unique_id, |
| 63 string16* name, | 65 string16* name, |
| 64 bool* removable) const; | 66 bool* removable) const; |
| 65 | 67 |
| 66 static LRESULT CALLBACK WndProcThunk(HWND hwnd, UINT message, WPARAM wparam, | 68 static LRESULT CALLBACK WndProcThunk(HWND hwnd, UINT message, WPARAM wparam, |
| 67 LPARAM lparam); | 69 LPARAM lparam); |
| 68 | 70 |
| 69 LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wparam, | 71 LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wparam, |
| 70 LPARAM lparam); | 72 LPARAM lparam); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 84 // The portable device watcher, used to manage media transfer protocol | 86 // The portable device watcher, used to manage media transfer protocol |
| 85 // devices. | 87 // devices. |
| 86 scoped_ptr<PortableDeviceWatcherWin> portable_device_watcher_; | 88 scoped_ptr<PortableDeviceWatcherWin> portable_device_watcher_; |
| 87 | 89 |
| 88 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsWindowWin); | 90 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsWindowWin); |
| 89 }; | 91 }; |
| 90 | 92 |
| 91 } // namespace chrome | 93 } // namespace chrome |
| 92 | 94 |
| 93 #endif // CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_W
IN_H_ | 95 #endif // CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_W
IN_H_ |
| OLD | NEW |