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" |
(...skipping 21 matching lines...) Expand all Loading... |
32 virtual ~StorageMonitorWin(); | 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 virtual void Init() OVERRIDE; | 35 virtual void Init() OVERRIDE; |
36 | 36 |
37 // StorageMonitor: | 37 // StorageMonitor: |
38 virtual bool GetStorageInfoForPath(const base::FilePath& path, | 38 virtual bool GetStorageInfoForPath(const base::FilePath& path, |
39 StorageInfo* device_info) const OVERRIDE; | 39 StorageInfo* device_info) const OVERRIDE; |
40 virtual bool GetMTPStorageInfoFromDeviceId( | 40 virtual bool GetMTPStorageInfoFromDeviceId( |
41 const std::string& storage_device_id, | 41 const std::string& storage_device_id, |
42 string16* device_location, | 42 base::string16* device_location, |
43 string16* storage_object_id) const OVERRIDE; | 43 base::string16* storage_object_id) const OVERRIDE; |
44 | 44 |
45 virtual void EjectDevice( | 45 virtual void EjectDevice( |
46 const std::string& device_id, | 46 const std::string& device_id, |
47 base::Callback<void(EjectStatus)> callback) OVERRIDE; | 47 base::Callback<void(EjectStatus)> callback) OVERRIDE; |
48 | 48 |
49 private: | 49 private: |
50 class PortableDeviceNotifications; | 50 class PortableDeviceNotifications; |
51 friend class test::TestStorageMonitorWin; | 51 friend class test::TestStorageMonitorWin; |
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 StorageMonitorWin::Create() function. | 55 // unit tests or in StorageMonitorWin::Create() function. |
56 StorageMonitorWin(VolumeMountWatcherWin* volume_mount_watcher, | 56 StorageMonitorWin(VolumeMountWatcherWin* volume_mount_watcher, |
57 PortableDeviceWatcherWin* portable_device_watcher); | 57 PortableDeviceWatcherWin* portable_device_watcher); |
58 | 58 |
59 // Gets the removable storage information given a |device_path|. On success, | 59 // Gets the removable storage information given a |device_path|. On success, |
60 // returns true and fills in |device_location|, |unique_id|, |name| and | 60 // returns true and fills in |info|. |
61 // |removable|, and |total_size_in_bytes|. | |
62 bool GetDeviceInfo(const base::FilePath& device_path, | 61 bool GetDeviceInfo(const base::FilePath& device_path, |
63 StorageInfo* info) const; | 62 StorageInfo* info) const; |
64 | 63 |
65 static LRESULT CALLBACK WndProcThunk(HWND hwnd, UINT message, WPARAM wparam, | 64 static LRESULT CALLBACK WndProcThunk(HWND hwnd, UINT message, WPARAM wparam, |
66 LPARAM lparam); | 65 LPARAM lparam); |
67 | 66 |
68 LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wparam, | 67 LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wparam, |
69 LPARAM lparam); | 68 LPARAM lparam); |
70 | 69 |
71 void OnDeviceChange(UINT event_type, LPARAM data); | 70 void OnDeviceChange(UINT event_type, LPARAM data); |
(...skipping 11 matching lines...) Expand all Loading... |
83 // The portable device watcher, used to manage media transfer protocol | 82 // The portable device watcher, used to manage media transfer protocol |
84 // devices. | 83 // devices. |
85 scoped_ptr<PortableDeviceWatcherWin> portable_device_watcher_; | 84 scoped_ptr<PortableDeviceWatcherWin> portable_device_watcher_; |
86 | 85 |
87 DISALLOW_COPY_AND_ASSIGN(StorageMonitorWin); | 86 DISALLOW_COPY_AND_ASSIGN(StorageMonitorWin); |
88 }; | 87 }; |
89 | 88 |
90 } // namespace chrome | 89 } // namespace chrome |
91 | 90 |
92 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_WIN_H_ | 91 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_WIN_H_ |
OLD | NEW |