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_STORAGE_MONITOR_WIN_H_ | 5 #ifndef CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_WIN_H_ |
6 #define CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_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 class PortableDeviceWatcherWin; |
18 | |
19 namespace test { | |
20 class TestStorageMonitorWin; | 18 class TestStorageMonitorWin; |
21 } | |
22 | |
23 class PortableDeviceWatcherWin; | |
24 class VolumeMountWatcherWin; | 19 class VolumeMountWatcherWin; |
25 | 20 |
26 class StorageMonitorWin : public StorageMonitor { | 21 class StorageMonitorWin : public StorageMonitor { |
27 public: | 22 public: |
28 virtual ~StorageMonitorWin(); | 23 virtual ~StorageMonitorWin(); |
29 | 24 |
30 // Must be called after the file thread is created. | 25 // Must be called after the file thread is created. |
31 virtual void Init() OVERRIDE; | 26 virtual void Init() OVERRIDE; |
32 | 27 |
33 // StorageMonitor: | 28 // StorageMonitor: |
34 virtual bool GetStorageInfoForPath(const base::FilePath& path, | 29 virtual bool GetStorageInfoForPath(const base::FilePath& path, |
35 StorageInfo* device_info) const OVERRIDE; | 30 StorageInfo* device_info) const OVERRIDE; |
36 virtual bool GetMTPStorageInfoFromDeviceId( | 31 virtual bool GetMTPStorageInfoFromDeviceId( |
37 const std::string& storage_device_id, | 32 const std::string& storage_device_id, |
38 base::string16* device_location, | 33 base::string16* device_location, |
39 base::string16* storage_object_id) const OVERRIDE; | 34 base::string16* storage_object_id) const OVERRIDE; |
40 | 35 |
41 virtual void EjectDevice( | 36 virtual void EjectDevice( |
42 const std::string& device_id, | 37 const std::string& device_id, |
43 base::Callback<void(EjectStatus)> callback) OVERRIDE; | 38 base::Callback<void(EjectStatus)> callback) OVERRIDE; |
44 | 39 |
45 private: | 40 private: |
46 class PortableDeviceNotifications; | 41 class PortableDeviceNotifications; |
47 friend class test::TestStorageMonitorWin; | 42 friend class TestStorageMonitorWin; |
48 friend StorageMonitor* StorageMonitor::Create(); | 43 friend StorageMonitor* StorageMonitor::Create(); |
49 | 44 |
50 // To support unit tests, this constructor takes |volume_mount_watcher| and | 45 // To support unit tests, this constructor takes |volume_mount_watcher| and |
51 // |portable_device_watcher| objects. These params are either constructed in | 46 // |portable_device_watcher| objects. These params are either constructed in |
52 // unit tests or in StorageMonitorWin Create() function. | 47 // unit tests or in StorageMonitorWin Create() function. |
53 StorageMonitorWin(VolumeMountWatcherWin* volume_mount_watcher, | 48 StorageMonitorWin(VolumeMountWatcherWin* volume_mount_watcher, |
54 PortableDeviceWatcherWin* portable_device_watcher); | 49 PortableDeviceWatcherWin* portable_device_watcher); |
55 | 50 |
56 // Gets the removable storage information given a |device_path|. On success, | 51 // Gets the removable storage information given a |device_path|. On success, |
57 // returns true and fills in |info|. | 52 // returns true and fills in |info|. |
(...skipping 18 matching lines...) Expand all Loading... |
76 // The volume mount point watcher, used to manage the mounted devices. | 71 // The volume mount point watcher, used to manage the mounted devices. |
77 scoped_ptr<VolumeMountWatcherWin> volume_mount_watcher_; | 72 scoped_ptr<VolumeMountWatcherWin> volume_mount_watcher_; |
78 | 73 |
79 // The portable device watcher, used to manage media transfer protocol | 74 // The portable device watcher, used to manage media transfer protocol |
80 // devices. | 75 // devices. |
81 scoped_ptr<PortableDeviceWatcherWin> portable_device_watcher_; | 76 scoped_ptr<PortableDeviceWatcherWin> portable_device_watcher_; |
82 | 77 |
83 DISALLOW_COPY_AND_ASSIGN(StorageMonitorWin); | 78 DISALLOW_COPY_AND_ASSIGN(StorageMonitorWin); |
84 }; | 79 }; |
85 | 80 |
86 } // namespace chrome | |
87 | |
88 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_WIN_H_ | 81 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_WIN_H_ |
OLD | NEW |