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 CONTENT_BROWSER_SYSTEM_MESSAGE_WINDOW_WIN_H_ 6 #define CONTENT_BROWSER_SYSTEM_MESSAGE_WINDOW_WIN_H_ 7 8 #include <windows.h> 9 10 #include "base/basictypes.h" 11 #include "base/memory/scoped_ptr.h" 12 #include "content/common/content_export.h" 13 14 namespace content { 15 16 class CONTENT_EXPORT SystemMessageWindowWin { 17 public: 18 SystemMessageWindowWin(); 19 20 virtual ~SystemMessageWindowWin(); 21 22 virtual LRESULT OnDeviceChange(UINT event_type, LPARAM data); 23 24 private: 25 void Init(); 26 27 LRESULT CALLBACK WndProc(HWND hwnd, UINT message, 28 WPARAM wparam, LPARAM lparam); 29 WndProcThunk(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam)30 static LRESULT CALLBACK WndProcThunk(HWND hwnd, 31 UINT message, 32 WPARAM wparam, 33 LPARAM lparam) { 34 SystemMessageWindowWin* msg_wnd = reinterpret_cast<SystemMessageWindowWin*>( 35 GetWindowLongPtr(hwnd, GWLP_USERDATA)); 36 if (msg_wnd) 37 return msg_wnd->WndProc(hwnd, message, wparam, lparam); 38 return ::DefWindowProc(hwnd, message, wparam, lparam); 39 } 40 41 HMODULE instance_; 42 HWND window_; 43 class DeviceNotifications; 44 scoped_ptr<DeviceNotifications> device_notifications_; 45 46 DISALLOW_COPY_AND_ASSIGN(SystemMessageWindowWin); 47 }; 48 49 } // namespace content 50 51 #endif // CONTENT_BROWSER_SYSTEM_MESSAGE_WINDOW_WIN_H_ 52