OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef COMPONENTS_BROWSER_WATCHER_ENDSESSION_WATCHER_WINDOW_WIN_H_ |
| 6 #define COMPONENTS_BROWSER_WATCHER_ENDSESSION_WATCHER_WINDOW_WIN_H_ |
| 7 |
| 8 #include <windows.h> |
| 9 |
| 10 #include "base/callback.h" |
| 11 #include "base/macros.h" |
| 12 |
| 13 namespace browser_watcher { |
| 14 |
| 15 class EndSessionWatcherWindow { |
| 16 public: |
| 17 typedef base::Callback<void(LPARAM)> EndSessionCallback; |
| 18 |
| 19 explicit EndSessionWatcherWindow(const EndSessionCallback& on_end_session); |
| 20 virtual ~EndSessionWatcherWindow(); |
| 21 |
| 22 // Exposed for testing. |
| 23 HWND window() const { return window_; } |
| 24 |
| 25 private: |
| 26 LRESULT OnEndSession(WPARAM wparam, LPARAM lparam); |
| 27 |
| 28 LRESULT WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); |
| 29 |
| 30 static LRESULT CALLBACK WndProcThunk(HWND hwnd, |
| 31 UINT message, |
| 32 WPARAM wparam, |
| 33 LPARAM lparam); |
| 34 |
| 35 HMODULE instance_; |
| 36 HWND window_; |
| 37 |
| 38 EndSessionCallback on_end_session_; |
| 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(EndSessionWatcherWindow); |
| 41 }; |
| 42 |
| 43 } // namespace browser_watcher |
| 44 |
| 45 #endif // COMPONENTS_BROWSER_WATCHER_ENDSESSION_WATCHER_WINDOW_WIN_H_ |
OLD | NEW |