Roll src/third_party/WebKit 9f7fb92:f103b33 (svn 202621:202622)
[chromium-blink-merge.git] / components / browser_watcher / endsession_watcher_window_win.h
blob82b95af77c5dcb1d2b85d226b4a65cec35e3f803
1 // Copyright (c) 2015 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 COMPONENTS_BROWSER_WATCHER_ENDSESSION_WATCHER_WINDOW_WIN_H_
6 #define COMPONENTS_BROWSER_WATCHER_ENDSESSION_WATCHER_WINDOW_WIN_H_
8 #include <windows.h>
10 #include "base/callback.h"
11 #include "base/macros.h"
13 namespace browser_watcher {
15 class EndSessionWatcherWindow {
16 public:
17 typedef base::Callback<void(UINT, LPARAM)> EndSessionMessageCallback;
19 explicit EndSessionWatcherWindow(
20 const EndSessionMessageCallback& on_end_session_message);
21 virtual ~EndSessionWatcherWindow();
23 // Exposed for testing.
24 HWND window() const { return window_; }
26 private:
27 LRESULT OnEndSessionMessage(UINT message, WPARAM wparam, LPARAM lparam);
29 LRESULT WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
31 static LRESULT CALLBACK WndProcThunk(HWND hwnd,
32 UINT message,
33 WPARAM wparam,
34 LPARAM lparam);
36 HMODULE instance_;
37 HWND window_;
39 EndSessionMessageCallback on_end_session_message_;
41 DISALLOW_COPY_AND_ASSIGN(EndSessionWatcherWindow);
44 } // namespace browser_watcher
46 #endif // COMPONENTS_BROWSER_WATCHER_ENDSESSION_WATCHER_WINDOW_WIN_H_