| 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_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_WIN_
H_ | 5 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_WIN_
H_ |
| 6 #define CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_WIN_
H_ | 6 #define CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_WIN_
H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 void InitForTest(GetDeviceInfoFunc getDeviceInfo, | 57 void InitForTest(GetDeviceInfoFunc getDeviceInfo, |
| 58 GetAttachedDevicesFunc getAttachedDevices); | 58 GetAttachedDevicesFunc getAttachedDevices); |
| 59 | 59 |
| 60 void OnDeviceChange(UINT event_type, LPARAM data); | 60 void OnDeviceChange(UINT event_type, LPARAM data); |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 friend class | 63 friend class |
| 64 base::RefCountedThreadSafe<RemovableDeviceNotificationsWindowWin>; | 64 base::RefCountedThreadSafe<RemovableDeviceNotificationsWindowWin>; |
| 65 friend class TestRemovableDeviceNotificationsWindowWin; | 65 friend class TestRemovableDeviceNotificationsWindowWin; |
| 66 | 66 |
| 67 typedef std::map<FilePath, std::string> MountPointDeviceIdMap; | 67 // Key: Mass storage device mount point. |
| 68 // Value: Mass storage device ID string. |
| 69 typedef std::map<string16, std::string> MountPointDeviceIdMap; |
| 68 | 70 |
| 71 // RemovableDeviceNotificationsWindowWin is ref-counted. |
| 69 virtual ~RemovableDeviceNotificationsWindowWin(); | 72 virtual ~RemovableDeviceNotificationsWindowWin(); |
| 70 | 73 |
| 71 static LRESULT CALLBACK WndProcThunk(HWND hwnd, UINT message, WPARAM wparam, | 74 static LRESULT CALLBACK WndProcThunk(HWND hwnd, UINT message, WPARAM wparam, |
| 72 LPARAM lparam); | 75 LPARAM lparam); |
| 73 | 76 |
| 74 LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wparam, | 77 LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wparam, |
| 75 LPARAM lparam); | 78 LPARAM lparam); |
| 76 | 79 |
| 77 void DoInit(GetAttachedDevicesFunc get_attached_devices_func); | 80 void DoInit(GetAttachedDevicesFunc get_attached_devices_func); |
| 78 | 81 |
| 79 void AddNewDevice(const FilePath& device_path); | 82 void AddNewDevice(const FilePath& device_path); |
| 80 | 83 |
| 81 void AddExistingDevicesOnFileThread( | 84 void AddExistingDevicesOnFileThread( |
| 82 GetAttachedDevicesFunc get_attached_devices_func); | 85 GetAttachedDevicesFunc get_attached_devices_func); |
| 83 | 86 |
| 84 void CheckDeviceTypeOnFileThread(const std::string& unique_id, | 87 void CheckDeviceTypeOnFileThread(const std::string& unique_id, |
| 85 const FilePath::StringType& device_name, | 88 const string16& device_name, |
| 86 const FilePath& device); | 89 const FilePath& device); |
| 87 | 90 |
| 88 void ProcessDeviceAttachedOnUIThread( | 91 // Handles removable mass storage device attach event on UI thread. |
| 92 void HandleMassStorageDeviceAttachEventOnUIThread( |
| 89 const std::string& device_id, | 93 const std::string& device_id, |
| 90 const FilePath::StringType& device_name, | 94 const string16& device_name, |
| 91 const FilePath& device); | 95 const string16& device_location); |
| 96 |
| 97 // Handles removable mass storage device detach event on UI thread. |
| 98 void HandleMassStorageDeviceDetachEventOnUIThread( |
| 99 const string16& device_location); |
| 100 |
| 101 // Handles media transfer protocol device event on UI thread. |
| 102 // |pnp_device_id| specifies the plug and play device ID string. |
| 103 void HandleMtpDeviceEventOnUIThread(bool is_attach, |
| 104 const string16& pnp_device_id); |
| 92 | 105 |
| 93 // The window class of |window_|. | 106 // The window class of |window_|. |
| 94 ATOM window_class_; | 107 ATOM window_class_; |
| 95 // The handle of the module that contains the window procedure of |window_|. | 108 // The handle of the module that contains the window procedure of |window_|. |
| 96 HMODULE instance_; | 109 HMODULE instance_; |
| 97 HWND window_; | 110 HWND window_; |
| 98 | 111 |
| 99 GetDeviceInfoFunc get_device_info_func_; | 112 GetDeviceInfoFunc get_device_info_func_; |
| 100 | 113 |
| 101 // A map from device mount point to device id. Only accessed on the UI Thread. | 114 // A map from device mount point to device id. Only accessed on the UI Thread. |
| 102 MountPointDeviceIdMap device_ids_; | 115 MountPointDeviceIdMap device_ids_; |
| 103 | 116 |
| 104 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsWindowWin); | 117 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsWindowWin); |
| 105 }; | 118 }; |
| 106 | 119 |
| 107 } // namespace chrome | 120 } // namespace chrome |
| 108 | 121 |
| 109 #endif // CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_W
IN_H_ | 122 #endif // CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_W
IN_H_ |
| OLD | NEW |