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 CONTENT_BROWSER_SYSTEM_MESSAGE_WINDOW_WIN_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_DEVICE_NOTIFICATION_WINDOW_WIN_H_ |
6 #define CONTENT_BROWSER_SYSTEM_MESSAGE_WINDOW_WIN_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_DEVICE_NOTIFICATION_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 #include "content/common/content_export.h" | |
13 | 12 |
14 typedef LRESULT (*VolumeNameFunc)(LPCWSTR drive, | 13 typedef LRESULT (*VolumeNameFunc)(LPCWSTR drive, |
15 LPWSTR volume_name, | 14 LPWSTR volume_name, |
16 unsigned int volume_name_len); | 15 unsigned int volume_name_len); |
| 16 namespace chrome { |
17 | 17 |
18 class CONTENT_EXPORT SystemMessageWindowWin { | 18 class MediaDeviceNotificationWindowWin { |
19 public: | 19 public: |
20 SystemMessageWindowWin(); | 20 MediaDeviceNotificationWindowWin(); |
21 // Only for use in unit tests. | 21 // Only for use in unit tests. |
22 explicit SystemMessageWindowWin::SystemMessageWindowWin( | 22 explicit MediaDeviceNotificationWindowWin::MediaDeviceNotificationWindowWin( |
23 VolumeNameFunc volumeNameFunc); | 23 VolumeNameFunc volumeNameFunc); |
24 | 24 |
25 virtual ~SystemMessageWindowWin(); | 25 virtual ~MediaDeviceNotificationWindowWin(); |
26 | 26 |
27 virtual LRESULT OnDeviceChange(UINT event_type, DWORD data); | 27 virtual LRESULT OnDeviceChange(UINT event_type, DWORD data); |
28 | 28 |
29 private: | 29 private: |
30 void Init(); | 30 void Init(); |
31 | 31 |
32 LRESULT CALLBACK WndProc(HWND hwnd, UINT message, | 32 LRESULT CALLBACK WndProc(HWND hwnd, UINT message, |
33 WPARAM wparam, LPARAM lparam); | 33 WPARAM wparam, LPARAM lparam); |
34 | 34 |
35 static LRESULT CALLBACK WndProcThunk(HWND hwnd, | 35 static LRESULT CALLBACK WndProcThunk(HWND hwnd, |
36 UINT message, | 36 UINT message, |
37 WPARAM wparam, | 37 WPARAM wparam, |
38 LPARAM lparam) { | 38 LPARAM lparam) { |
39 SystemMessageWindowWin* msg_wnd = reinterpret_cast<SystemMessageWindowWin*>( | 39 MediaDeviceNotificationWindowWin* msg_wnd = |
40 GetWindowLongPtr(hwnd, GWLP_USERDATA)); | 40 reinterpret_cast<MediaDeviceNotificationWindowWin*>( |
| 41 GetWindowLongPtr(hwnd, GWLP_USERDATA)); |
41 if (msg_wnd) | 42 if (msg_wnd) |
42 return msg_wnd->WndProc(hwnd, message, wparam, lparam); | 43 return msg_wnd->WndProc(hwnd, message, wparam, lparam); |
43 return ::DefWindowProc(hwnd, message, wparam, lparam); | 44 return ::DefWindowProc(hwnd, message, wparam, lparam); |
44 } | 45 } |
45 | 46 |
46 HWND window_; | 47 HWND window_; |
47 VolumeNameFunc volume_name_func_; | 48 VolumeNameFunc volume_name_func_; |
48 | 49 |
49 DISALLOW_COPY_AND_ASSIGN(SystemMessageWindowWin); | 50 DISALLOW_COPY_AND_ASSIGN(MediaDeviceNotificationWindowWin); |
50 }; | 51 }; |
51 | 52 |
52 #endif // CONTENT_BROWSER_SYSTEM_MESSAGE_WINDOW_WIN_H_ | 53 } // namespace chrome |
| 54 |
| 55 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_DEVICE_NOTIFICATION_WINDOW_WIN_H_ |
OLD | NEW |