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 #include "chrome/browser/storage_monitor/storage_monitor_win.h" | 5 #include "chrome/browser/storage_monitor/storage_monitor_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <dbt.h> | 8 #include <dbt.h> |
9 #include <fileapi.h> | 9 #include <fileapi.h> |
10 | 10 |
11 #include "base/win/wrapped_window_proc.h" | 11 #include "base/win/wrapped_window_proc.h" |
12 #include "chrome/browser/storage_monitor/portable_device_watcher_win.h" | 12 #include "chrome/browser/storage_monitor/portable_device_watcher_win.h" |
13 #include "chrome/browser/storage_monitor/removable_device_constants.h" | 13 #include "chrome/browser/storage_monitor/removable_device_constants.h" |
14 #include "chrome/browser/storage_monitor/storage_info.h" | 14 #include "chrome/browser/storage_monitor/storage_info.h" |
15 #include "chrome/browser/storage_monitor/volume_mount_watcher_win.h" | 15 #include "chrome/browser/storage_monitor/volume_mount_watcher_win.h" |
16 | 16 |
17 namespace chrome { | 17 namespace chrome { |
18 | 18 |
19 // StorageMonitorWin ------------------------------------------------------- | 19 // StorageMonitorWin ------------------------------------------------------- |
20 | 20 |
21 // static | |
22 StorageMonitorWin* StorageMonitorWin::Create() { | |
23 return new StorageMonitorWin(new VolumeMountWatcherWin(), | |
24 new PortableDeviceWatcherWin()); | |
25 } | |
26 | |
27 StorageMonitorWin::StorageMonitorWin( | 21 StorageMonitorWin::StorageMonitorWin( |
28 VolumeMountWatcherWin* volume_mount_watcher, | 22 VolumeMountWatcherWin* volume_mount_watcher, |
29 PortableDeviceWatcherWin* portable_device_watcher) | 23 PortableDeviceWatcherWin* portable_device_watcher) |
30 : window_class_(0), | 24 : window_class_(0), |
31 instance_(NULL), | 25 instance_(NULL), |
32 window_(NULL), | 26 window_(NULL), |
33 volume_mount_watcher_(volume_mount_watcher), | 27 volume_mount_watcher_(volume_mount_watcher), |
34 portable_device_watcher_(portable_device_watcher) { | 28 portable_device_watcher_(portable_device_watcher) { |
35 DCHECK(volume_mount_watcher_); | 29 DCHECK(volume_mount_watcher_); |
36 DCHECK(portable_device_watcher_); | 30 DCHECK(portable_device_watcher_); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 // function when we have the functionality to add a sub directory of | 154 // function when we have the functionality to add a sub directory of |
161 // portable device as a media gallery. | 155 // portable device as a media gallery. |
162 return volume_mount_watcher_->GetDeviceInfo(device_path, info); | 156 return volume_mount_watcher_->GetDeviceInfo(device_path, info); |
163 } | 157 } |
164 | 158 |
165 void StorageMonitorWin::OnDeviceChange(UINT event_type, LPARAM data) { | 159 void StorageMonitorWin::OnDeviceChange(UINT event_type, LPARAM data) { |
166 volume_mount_watcher_->OnWindowMessage(event_type, data); | 160 volume_mount_watcher_->OnWindowMessage(event_type, data); |
167 portable_device_watcher_->OnWindowMessage(event_type, data); | 161 portable_device_watcher_->OnWindowMessage(event_type, data); |
168 } | 162 } |
169 | 163 |
| 164 StorageMonitor* StorageMonitor::Create() { |
| 165 return new StorageMonitorWin(new VolumeMountWatcherWin(), |
| 166 new PortableDeviceWatcherWin()); |
| 167 } |
| 168 |
170 } // namespace chrome | 169 } // namespace chrome |
OLD | NEW |