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_MEDIA_GALLERY_MEDIA_DEVICE_NOTIFICATIONS_WINDOW_WIN_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_DEVICE_NOTIFICATIONS_WINDOW_WIN_H_ |
6 #define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_DEVICE_NOTIFICATIONS_WINDOW_WIN_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_DEVICE_NOTIFICATIONS_WINDOW_WIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <windows.h> | 9 #include <windows.h> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 | 12 |
13 typedef LRESULT (*VolumeNameFunc)(LPCWSTR drive, | 13 typedef LRESULT (*VolumeNameFunc)(LPCWSTR drive, |
14 LPWSTR volume_name, | 14 LPWSTR volume_name, |
15 unsigned int volume_name_len); | 15 unsigned int volume_name_len); |
16 namespace chrome { | 16 namespace chrome { |
17 | 17 |
18 class MediaDeviceNotificationsWindowWin { | 18 class MediaDeviceNotificationsWindowWin { |
19 public: | 19 public: |
20 MediaDeviceNotificationsWindowWin(); | 20 MediaDeviceNotificationsWindowWin(); |
21 // Only for use in unit tests. | 21 // Only for use in unit tests. |
22 explicit MediaDeviceNotificationsWindowWin(VolumeNameFunc volumeNameFunc); | 22 explicit MediaDeviceNotificationsWindowWin(VolumeNameFunc volumeNameFunc); |
23 | 23 |
24 virtual ~MediaDeviceNotificationsWindowWin(); | 24 ~MediaDeviceNotificationsWindowWin(); |
25 | 25 |
26 virtual LRESULT OnDeviceChange(UINT event_type, DWORD data); | 26 LRESULT OnDeviceChange(UINT event_type, DWORD data); |
27 | 27 |
28 private: | 28 private: |
29 void Init(); | 29 void Init(); |
30 | 30 |
31 LRESULT CALLBACK WndProc(HWND hwnd, | 31 LRESULT CALLBACK WndProc(HWND hwnd, |
32 UINT message, | 32 UINT message, |
33 WPARAM wparam, | 33 WPARAM wparam, |
34 LPARAM lparam); | 34 LPARAM lparam); |
35 | 35 |
36 static LRESULT CALLBACK WndProcThunk(HWND hwnd, | 36 static LRESULT CALLBACK WndProcThunk(HWND hwnd, |
37 UINT message, | 37 UINT message, |
38 WPARAM wparam, | 38 WPARAM wparam, |
39 LPARAM lparam); | 39 LPARAM lparam); |
40 | 40 |
41 // The window class of |window_|. | 41 // The window class of |window_|. |
42 ATOM atom_; | 42 ATOM atom_; |
43 | 43 |
44 // The handle of the module that contains the window procedure of |window_|. | 44 // The handle of the module that contains the window procedure of |window_|. |
45 HMODULE instance_; | 45 HMODULE instance_; |
46 | 46 |
47 HWND window_; | 47 HWND window_; |
48 VolumeNameFunc volume_name_func_; | 48 VolumeNameFunc volume_name_func_; |
49 | 49 |
50 DISALLOW_COPY_AND_ASSIGN(MediaDeviceNotificationsWindowWin); | 50 DISALLOW_COPY_AND_ASSIGN(MediaDeviceNotificationsWindowWin); |
51 }; | 51 }; |
52 | 52 |
53 } // namespace chrome | 53 } // namespace chrome |
54 | 54 |
55 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_DEVICE_NOTIFICATIONS_WINDOW_WIN_H_ | 55 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_DEVICE_NOTIFICATIONS_WINDOW_WIN_H_ |
OLD | NEW |