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