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_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_WIN _H_ |
6 #define CHROME_BROWSER_STORAGE_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_WIN _H_ | 6 #define CHROME_BROWSER_STORAGE_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/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 TestRemovableDeviceNotificationsWindowWin; |
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 StorageMonitorWindowWin : public StorageMonitor { |
vandebo (ex-Chrome)
2013/02/28 20:02:40
The WindowWin part was unnecessary. This can be S
| |
27 public: | 27 public: |
28 // Creates an instance of RemovableDeviceNotificationsWindowWin. Should only | 28 // Creates an instance of RemovableDeviceNotificationsWindowWin. Should only |
29 // be called by browser start up code. Use GetInstance() instead. | 29 // be called by browser start up code. Use GetInstance() instead. |
30 static RemovableDeviceNotificationsWindowWin* Create(); | 30 static StorageMonitorWindowWin* Create(); |
31 | 31 |
32 virtual ~RemovableDeviceNotificationsWindowWin(); | 32 virtual ~StorageMonitorWindowWin(); |
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( |
39 const base::FilePath& path, | 39 const base::FilePath& path, |
40 StorageInfo* device_info) const OVERRIDE; | 40 StorageInfo* device_info) const OVERRIDE; |
41 virtual bool GetMTPStorageInfoFromDeviceId( | 41 virtual bool GetMTPStorageInfoFromDeviceId( |
42 const std::string& storage_device_id, | 42 const std::string& storage_device_id, |
43 string16* device_location, | 43 string16* device_location, |
44 string16* storage_object_id) const OVERRIDE; | 44 string16* storage_object_id) const OVERRIDE; |
45 | 45 |
46 virtual uint64 GetStorageSize( | 46 virtual uint64 GetStorageSize( |
47 const base::FilePath::StringType& location) const OVERRIDE; | 47 const base::FilePath::StringType& location) const OVERRIDE; |
48 | 48 |
49 private: | 49 private: |
50 class PortableDeviceNotifications; | 50 class PortableDeviceNotifications; |
51 friend class test::TestRemovableDeviceNotificationsWindowWin; | 51 friend class test::TestRemovableDeviceNotificationsWindowWin; |
52 | 52 |
53 // To support unit tests, this constructor takes |volume_mount_watcher| and | 53 // To support unit tests, this constructor takes |volume_mount_watcher| and |
54 // |portable_device_watcher| objects. These params are either constructed in | 54 // |portable_device_watcher| objects. These params are either constructed in |
55 // unit tests or in RemovableDeviceNotificationsWindowWin::Create() function. | 55 // unit tests or in RemovableDeviceNotificationsWindowWin::Create() function. |
56 RemovableDeviceNotificationsWindowWin( | 56 StorageMonitorWindowWin( |
57 VolumeMountWatcherWin* volume_mount_watcher, | 57 VolumeMountWatcherWin* volume_mount_watcher, |
58 PortableDeviceWatcherWin* portable_device_watcher); | 58 PortableDeviceWatcherWin* portable_device_watcher); |
59 | 59 |
60 // Gets the removable storage information given a |device_path|. On success, | 60 // Gets the removable storage information given a |device_path|. On success, |
61 // returns true and fills in |device_location|, |unique_id|, |name| and | 61 // returns true and fills in |device_location|, |unique_id|, |name| and |
62 // |removable|, and |total_size_in_bytes|. | 62 // |removable|, and |total_size_in_bytes|. |
63 bool GetDeviceInfo(const base::FilePath& device_path, | 63 bool GetDeviceInfo(const base::FilePath& device_path, |
64 string16* device_location, | 64 string16* device_location, |
65 std::string* unique_id, | 65 std::string* unique_id, |
66 string16* name, | 66 string16* name, |
(...skipping 15 matching lines...) Expand all Loading... | |
82 HMODULE instance_; | 82 HMODULE instance_; |
83 HWND window_; | 83 HWND window_; |
84 | 84 |
85 // The volume mount point watcher, used to manage the mounted devices. | 85 // The volume mount point watcher, used to manage the mounted devices. |
86 scoped_ptr<VolumeMountWatcherWin> volume_mount_watcher_; | 86 scoped_ptr<VolumeMountWatcherWin> volume_mount_watcher_; |
87 | 87 |
88 // The portable device watcher, used to manage media transfer protocol | 88 // The portable device watcher, used to manage media transfer protocol |
89 // devices. | 89 // devices. |
90 scoped_ptr<PortableDeviceWatcherWin> portable_device_watcher_; | 90 scoped_ptr<PortableDeviceWatcherWin> portable_device_watcher_; |
91 | 91 |
92 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsWindowWin); | 92 DISALLOW_COPY_AND_ASSIGN(StorageMonitorWindowWin); |
93 }; | 93 }; |
94 | 94 |
95 } // namespace chrome | 95 } // namespace chrome |
96 | 96 |
97 #endif // CHROME_BROWSER_STORAGE_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_ WIN_H_ | 97 #endif // CHROME_BROWSER_STORAGE_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_ WIN_H_ |
OLD | NEW |