| Index: chrome/browser/media_gallery/media_device_notifications_window_win.cc
|
| diff --git a/chrome/browser/media_gallery/media_device_notifications_window_win.cc b/chrome/browser/media_gallery/media_device_notifications_window_win.cc
|
| index 498ade957134f899e9452a05ecb47ea7698303a5..e25e01358c9c5398143372ae63b424e99917c91e 100644
|
| --- a/chrome/browser/media_gallery/media_device_notifications_window_win.cc
|
| +++ b/chrome/browser/media_gallery/media_device_notifications_window_win.cc
|
| @@ -42,36 +42,45 @@ DWORD GetVolumeBitMaskFromBroadcastHeader(DWORD data) {
|
| namespace chrome {
|
|
|
| MediaDeviceNotificationsWindowWin::MediaDeviceNotificationsWindowWin()
|
| - : volume_name_func_(&GetVolumeName) {
|
| + : atom_(0),
|
| + instance_(NULL),
|
| + window_(NULL),
|
| + volume_name_func_(&GetVolumeName) {
|
| Init();
|
| }
|
|
|
| MediaDeviceNotificationsWindowWin::MediaDeviceNotificationsWindowWin(
|
| - VolumeNameFunc volume_name_func) : volume_name_func_(volume_name_func) {
|
| + VolumeNameFunc volume_name_func)
|
| + : atom_(0),
|
| + instance_(NULL),
|
| + window_(NULL),
|
| + volume_name_func_(volume_name_func) {
|
| Init();
|
| }
|
|
|
| void MediaDeviceNotificationsWindowWin::Init() {
|
| - HINSTANCE hinst = GetModuleHandle(NULL);
|
| -
|
| - WNDCLASSEX wc = {0};
|
| - wc.cbSize = sizeof(wc);
|
| - wc.lpfnWndProc = base::win::WrappedWindowProc<
|
| - &MediaDeviceNotificationsWindowWin::WndProcThunk>;
|
| - wc.hInstance = hinst;
|
| - wc.lpszClassName = WindowClassName;
|
| - ATOM clazz = RegisterClassEx(&wc);
|
| - DCHECK(clazz);
|
| -
|
| - window_ = CreateWindow(WindowClassName, 0, 0, 0, 0, 0, 0, 0, 0, hinst, 0);
|
| + WNDCLASSEX window_class;
|
| + base::win::InitializeWindowClass(
|
| + WindowClassName,
|
| + &base::win::WrappedWindowProc<
|
| + MediaDeviceNotificationsWindowWin::WndProcThunk>,
|
| + 0, 0, 0, NULL, NULL, NULL, NULL, NULL,
|
| + &window_class);
|
| + instance_ = window_class.hInstance;
|
| + atom_ = RegisterClassEx(&window_class);
|
| + DCHECK(atom_);
|
| +
|
| + window_ = CreateWindow(MAKEINTATOM(atom_), 0, 0, 0, 0, 0, 0, 0, 0, instance_,
|
| + 0);
|
| SetWindowLongPtr(window_, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
|
| }
|
|
|
| MediaDeviceNotificationsWindowWin::~MediaDeviceNotificationsWindowWin() {
|
| - if (window_) {
|
| + if (window_)
|
| DestroyWindow(window_);
|
| - UnregisterClass(WindowClassName, GetModuleHandle(NULL));
|
| - }
|
| +
|
| + if (atom_)
|
| + UnregisterClass(MAKEINTATOM(atom_), instance_);
|
| }
|
|
|
| LRESULT MediaDeviceNotificationsWindowWin::OnDeviceChange(UINT event_type,
|
|
|