• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
2 // reserved. Use of this source code is governed by a BSD-style license that
3 // can be found in the LICENSE file.
4 
5 #ifndef CEF_TESTS_SHARED_BROWSER_UTIL_WIN_H_
6 #define CEF_TESTS_SHARED_BROWSER_UTIL_WIN_H_
7 #pragma once
8 
9 #include <windows.h>
10 #include <string>
11 
12 #include "include/internal/cef_types_wrappers.h"
13 
14 namespace client {
15 
16 // Returns the current time in microseconds.
17 uint64_t GetTimeNow();
18 
19 // Set the window's user data pointer.
20 void SetUserDataPtr(HWND hWnd, void* ptr);
21 
22 // Return the window's user data pointer.
23 template <typename T>
GetUserDataPtr(HWND hWnd)24 T GetUserDataPtr(HWND hWnd) {
25   return reinterpret_cast<T>(GetWindowLongPtr(hWnd, GWLP_USERDATA));
26 }
27 
28 // Set the window's window procedure pointer and return the old value.
29 WNDPROC SetWndProcPtr(HWND hWnd, WNDPROC wndProc);
30 
31 // Return the resource string with the specified id.
32 std::wstring GetResourceString(UINT id);
33 
34 int GetCefMouseModifiers(WPARAM wparam);
35 int GetCefKeyboardModifiers(WPARAM wparam, LPARAM lparam);
36 bool IsKeyDown(WPARAM wparam);
37 
38 // Returns the device scale factor. For example, 200% display scaling will
39 // return 2.0.
40 float GetDeviceScaleFactor();
41 
42 }  // namespace client
43 
44 #endif  // CEF_TESTS_SHARED_BROWSER_UTIL_WIN_H_
45