| 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_VOLUME_MOUNT_WATCHER_WIN_H_ | 5 #ifndef CHROME_BROWSER_STORAGE_MONITOR_VOLUME_MOUNT_WATCHER_WIN_H_ |
| 6 #define CHROME_BROWSER_STORAGE_MONITOR_VOLUME_MOUNT_WATCHER_WIN_H_ | 6 #define CHROME_BROWSER_STORAGE_MONITOR_VOLUME_MOUNT_WATCHER_WIN_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/sequenced_task_runner.h" |
| 17 #include "base/string16.h" | 18 #include "base/string16.h" |
| 18 #include "base/threading/sequenced_worker_pool.h" | 19 #include "base/threading/sequenced_worker_pool.h" |
| 19 #include "chrome/browser/storage_monitor/storage_monitor.h" | 20 #include "chrome/browser/storage_monitor/storage_monitor.h" |
| 20 | 21 |
| 21 namespace chrome { | 22 namespace chrome { |
| 22 | 23 |
| 23 // This class watches the volume mount points and sends notifications to | 24 // This class watches the volume mount points and sends notifications to |
| 24 // StorageMonitor about the device attach/detach events. | 25 // StorageMonitor about the device attach/detach events. |
| 25 // This is a singleton class instantiated by StorageMonitorWin. | 26 // This is a singleton class instantiated by StorageMonitorWin. |
| 26 class VolumeMountWatcherWin { | 27 class VolumeMountWatcherWin { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 bool*, uint64*)> get_device_details_callback, | 91 bool*, uint64*)> get_device_details_callback, |
| 91 base::WeakPtr<chrome::VolumeMountWatcherWin> volume_watcher); | 92 base::WeakPtr<chrome::VolumeMountWatcherWin> volume_watcher); |
| 92 | 93 |
| 93 // Mark that a device we started a metadata check for has completed. | 94 // Mark that a device we started a metadata check for has completed. |
| 94 virtual void DeviceCheckComplete(const base::FilePath& device_path); | 95 virtual void DeviceCheckComplete(const base::FilePath& device_path); |
| 95 | 96 |
| 96 // Worker pool used to collect device information. Used because some | 97 // Worker pool used to collect device information. Used because some |
| 97 // devices freeze workers trying to get device info, resulting in | 98 // devices freeze workers trying to get device info, resulting in |
| 98 // shutdown hangs. | 99 // shutdown hangs. |
| 99 scoped_refptr<base::SequencedWorkerPool> device_info_worker_pool_; | 100 scoped_refptr<base::SequencedWorkerPool> device_info_worker_pool_; |
| 101 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 100 | 102 |
| 101 // These closures can be overridden for testing to remove calling Windows API | 103 // These closures can be overridden for testing to remove calling Windows API |
| 102 // functions. | 104 // functions. |
| 103 base::Callback<std::vector<base::FilePath>(void)> | 105 base::Callback<std::vector<base::FilePath>(void)> |
| 104 get_attached_devices_callback_; | 106 get_attached_devices_callback_; |
| 105 base::Callback< | 107 base::Callback< |
| 106 bool(const base::FilePath&, string16*, | 108 bool(const base::FilePath&, string16*, |
| 107 std::string*, string16*, bool*, uint64*)> | 109 std::string*, string16*, bool*, uint64*)> |
| 108 get_device_details_callback_; | 110 get_device_details_callback_; |
| 109 | 111 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 126 // The notifications object to use to signal newly attached volumes. Only | 128 // The notifications object to use to signal newly attached volumes. Only |
| 127 // removable devices will be notified. | 129 // removable devices will be notified. |
| 128 StorageMonitor::Receiver* notifications_; | 130 StorageMonitor::Receiver* notifications_; |
| 129 | 131 |
| 130 DISALLOW_COPY_AND_ASSIGN(VolumeMountWatcherWin); | 132 DISALLOW_COPY_AND_ASSIGN(VolumeMountWatcherWin); |
| 131 }; | 133 }; |
| 132 | 134 |
| 133 } // namespace chrome | 135 } // namespace chrome |
| 134 | 136 |
| 135 #endif // CHROME_BROWSER_STORAGE_MONITOR_VOLUME_MOUNT_WATCHER_WIN_H_ | 137 #endif // CHROME_BROWSER_STORAGE_MONITOR_VOLUME_MOUNT_WATCHER_WIN_H_ |
| OLD | NEW |