| 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_MEDIA_DEVICE_NOTIFICATIONS_WINDOW_WIN_H_ | 5 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_WIN_
H_ |
| 6 #define CHROME_BROWSER_SYSTEM_MONITOR_MEDIA_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 <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 | 15 |
| 16 typedef LRESULT (*VolumeNameFunc)(LPCWSTR drive, | 16 typedef LRESULT (*VolumeNameFunc)(LPCWSTR drive, |
| 17 LPWSTR volume_name, | 17 LPWSTR volume_name, |
| 18 unsigned int volume_name_len); | 18 unsigned int volume_name_len); |
| 19 namespace chrome { | 19 namespace chrome { |
| 20 | 20 |
| 21 class MediaDeviceNotificationsWindowWin | 21 class RemovableDeviceNotificationsWindowWin |
| 22 : public base::RefCountedThreadSafe<MediaDeviceNotificationsWindowWin> { | 22 : public base::RefCountedThreadSafe<RemovableDeviceNotificationsWindowWin> { |
| 23 public: | 23 public: |
| 24 MediaDeviceNotificationsWindowWin(); | 24 RemovableDeviceNotificationsWindowWin(); |
| 25 // Only for use in unit tests. | 25 // Only for use in unit tests. |
| 26 explicit MediaDeviceNotificationsWindowWin(VolumeNameFunc volumeNameFunc); | 26 explicit RemovableDeviceNotificationsWindowWin(VolumeNameFunc volumeNameFunc); |
| 27 | 27 |
| 28 LRESULT OnDeviceChange(UINT event_type, DWORD data); | 28 LRESULT OnDeviceChange(UINT event_type, DWORD data); |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 friend class base::RefCountedThreadSafe<MediaDeviceNotificationsWindowWin>; | 31 friend class |
| 32 base::RefCountedThreadSafe<RemovableDeviceNotificationsWindowWin>; |
| 32 | 33 |
| 33 virtual ~MediaDeviceNotificationsWindowWin(); | 34 virtual ~RemovableDeviceNotificationsWindowWin(); |
| 34 | 35 |
| 35 void Init(); | 36 void Init(); |
| 36 | 37 |
| 37 LRESULT CALLBACK WndProc(HWND hwnd, | 38 LRESULT CALLBACK WndProc(HWND hwnd, |
| 38 UINT message, | 39 UINT message, |
| 39 WPARAM wparam, | 40 WPARAM wparam, |
| 40 LPARAM lparam); | 41 LPARAM lparam); |
| 41 | 42 |
| 42 static LRESULT CALLBACK WndProcThunk(HWND hwnd, | 43 static LRESULT CALLBACK WndProcThunk(HWND hwnd, |
| 43 UINT message, | 44 UINT message, |
| 44 WPARAM wparam, | 45 WPARAM wparam, |
| 45 LPARAM lparam); | 46 LPARAM lparam); |
| 46 | 47 |
| 47 void CheckDeviceTypeOnFileThread(const std::string& id, | 48 void CheckDeviceTypeOnFileThread(const std::string& id, |
| 48 const FilePath::StringType& device_name, | 49 const FilePath::StringType& device_name, |
| 49 const FilePath& path); | 50 const FilePath& path); |
| 50 | 51 |
| 51 void ProcessMediaDeviceAttachedOnUIThread( | 52 void ProcessRemovableDeviceAttachedOnUIThread( |
| 52 const std::string& id, | 53 const std::string& id, |
| 53 const FilePath::StringType& device_name, | 54 const FilePath::StringType& device_name, |
| 54 const FilePath& path); | 55 const FilePath& path); |
| 55 | 56 |
| 56 // The window class of |window_|. | 57 // The window class of |window_|. |
| 57 ATOM atom_; | 58 ATOM atom_; |
| 58 | 59 |
| 59 // The handle of the module that contains the window procedure of |window_|. | 60 // The handle of the module that contains the window procedure of |window_|. |
| 60 HMODULE instance_; | 61 HMODULE instance_; |
| 61 | 62 |
| 62 HWND window_; | 63 HWND window_; |
| 63 VolumeNameFunc volume_name_func_; | 64 VolumeNameFunc volume_name_func_; |
| 64 | 65 |
| 65 DISALLOW_COPY_AND_ASSIGN(MediaDeviceNotificationsWindowWin); | 66 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsWindowWin); |
| 66 }; | 67 }; |
| 67 | 68 |
| 68 } // namespace chrome | 69 } // namespace chrome |
| 69 | 70 |
| 70 #endif // CHROME_BROWSER_SYSTEM_MONITOR_MEDIA_DEVICE_NOTIFICATIONS_WINDOW_WIN_H
_ | 71 #endif // CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_W
IN_H_ |
| OLD | NEW |