| 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/system_monitor/removable_device_notifications_window_wi
n.h" | 5 #include "chrome/browser/system_monitor/removable_device_notifications_window_wi
n.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 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 RemovableDeviceNotificationsWindowWin( | 36 RemovableDeviceNotificationsWindowWin( |
| 37 VolumeMountWatcherWin* volume_mount_watcher, | 37 VolumeMountWatcherWin* volume_mount_watcher, |
| 38 PortableDeviceWatcherWin* portable_device_watcher) | 38 PortableDeviceWatcherWin* portable_device_watcher) |
| 39 : window_class_(0), | 39 : window_class_(0), |
| 40 instance_(NULL), | 40 instance_(NULL), |
| 41 window_(NULL), | 41 window_(NULL), |
| 42 volume_mount_watcher_(volume_mount_watcher), | 42 volume_mount_watcher_(volume_mount_watcher), |
| 43 portable_device_watcher_(portable_device_watcher) { | 43 portable_device_watcher_(portable_device_watcher) { |
| 44 DCHECK(volume_mount_watcher_); | 44 DCHECK(volume_mount_watcher_); |
| 45 DCHECK(portable_device_watcher_); | 45 DCHECK(portable_device_watcher_); |
| 46 volume_mount_watcher_->SetNotifications(receiver()); |
| 47 portable_device_watcher_->SetNotifications(receiver()); |
| 46 } | 48 } |
| 47 | 49 |
| 48 RemovableDeviceNotificationsWindowWin:: | 50 RemovableDeviceNotificationsWindowWin:: |
| 49 ~RemovableDeviceNotificationsWindowWin() { | 51 ~RemovableDeviceNotificationsWindowWin() { |
| 52 volume_mount_watcher_->SetNotifications(NULL); |
| 53 portable_device_watcher_->SetNotifications(NULL); |
| 54 |
| 50 if (window_) | 55 if (window_) |
| 51 DestroyWindow(window_); | 56 DestroyWindow(window_); |
| 52 | 57 |
| 53 if (window_class_) | 58 if (window_class_) |
| 54 UnregisterClass(MAKEINTATOM(window_class_), instance_); | 59 UnregisterClass(MAKEINTATOM(window_class_), instance_); |
| 55 } | 60 } |
| 56 | 61 |
| 57 void RemovableDeviceNotificationsWindowWin::Init() { | 62 void RemovableDeviceNotificationsWindowWin::Init() { |
| 58 WNDCLASSEX window_class; | 63 WNDCLASSEX window_class; |
| 59 base::win::InitializeWindowClass( | 64 base::win::InitializeWindowClass( |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 unique_id, name, removable); | 173 unique_id, name, removable); |
| 169 } | 174 } |
| 170 | 175 |
| 171 void RemovableDeviceNotificationsWindowWin::OnDeviceChange(UINT event_type, | 176 void RemovableDeviceNotificationsWindowWin::OnDeviceChange(UINT event_type, |
| 172 LPARAM data) { | 177 LPARAM data) { |
| 173 volume_mount_watcher_->OnWindowMessage(event_type, data); | 178 volume_mount_watcher_->OnWindowMessage(event_type, data); |
| 174 portable_device_watcher_->OnWindowMessage(event_type, data); | 179 portable_device_watcher_->OnWindowMessage(event_type, data); |
| 175 } | 180 } |
| 176 | 181 |
| 177 } // namespace chrome | 182 } // namespace chrome |
| OLD | NEW |