Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / browser / system_message_window_win.h
bloba067e253b6327a8559216d7bc765df916e59fd5c
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.
5 #ifndef CONTENT_BROWSER_SYSTEM_MESSAGE_WINDOW_WIN_H_
6 #define CONTENT_BROWSER_SYSTEM_MESSAGE_WINDOW_WIN_H_
8 #include <windows.h>
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/profiler/scoped_tracker.h"
13 #include "content/common/content_export.h"
15 namespace content {
17 class CONTENT_EXPORT SystemMessageWindowWin {
18 public:
19 SystemMessageWindowWin();
21 virtual ~SystemMessageWindowWin();
23 virtual LRESULT OnDeviceChange(UINT event_type, LPARAM data);
25 private:
26 void Init();
28 LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
29 WPARAM wparam, LPARAM lparam);
31 static LRESULT CALLBACK WndProcThunk(HWND hwnd,
32 UINT message,
33 WPARAM wparam,
34 LPARAM lparam) {
35 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
36 tracked_objects::ScopedTracker tracking_profile(
37 FROM_HERE_WITH_EXPLICIT_FUNCTION(
38 "440919 SystemMessageWindowWin::WndProcThunk"));
40 SystemMessageWindowWin* msg_wnd = reinterpret_cast<SystemMessageWindowWin*>(
41 GetWindowLongPtr(hwnd, GWLP_USERDATA));
42 if (msg_wnd)
43 return msg_wnd->WndProc(hwnd, message, wparam, lparam);
44 return ::DefWindowProc(hwnd, message, wparam, lparam);
47 HMODULE instance_;
48 HWND window_;
49 class DeviceNotifications;
50 scoped_ptr<DeviceNotifications> device_notifications_;
52 DISALLOW_COPY_AND_ASSIGN(SystemMessageWindowWin);
55 } // namespace content
57 #endif // CONTENT_BROWSER_SYSTEM_MESSAGE_WINDOW_WIN_H_