OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/gfx/win/hwnd_util.h" | 5 #include "ui/gfx/win/hwnd_util.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/win/metro.h" | 9 #include "base/win/metro.h" |
10 #include "base/win/win_util.h" | 10 #include "base/win/win_util.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 105 } |
106 | 106 |
107 void* SetWindowUserData(HWND hwnd, void* user_data) { | 107 void* SetWindowUserData(HWND hwnd, void* user_data) { |
108 return | 108 return |
109 reinterpret_cast<void*>(SetWindowLongPtr(hwnd, GWLP_USERDATA, | 109 reinterpret_cast<void*>(SetWindowLongPtr(hwnd, GWLP_USERDATA, |
110 reinterpret_cast<LONG_PTR>(user_data))); | 110 reinterpret_cast<LONG_PTR>(user_data))); |
111 } | 111 } |
112 | 112 |
113 void* GetWindowUserData(HWND hwnd) { | 113 void* GetWindowUserData(HWND hwnd) { |
114 DWORD process_id = 0; | 114 DWORD process_id = 0; |
115 DWORD thread_id = GetWindowThreadProcessId(hwnd, &process_id); | 115 GetWindowThreadProcessId(hwnd, &process_id); |
116 // A window outside the current process needs to be ignored. | 116 // A window outside the current process needs to be ignored. |
117 if (process_id != ::GetCurrentProcessId()) | 117 if (process_id != ::GetCurrentProcessId()) |
118 return NULL; | 118 return NULL; |
119 return reinterpret_cast<void*>(GetWindowLongPtr(hwnd, GWLP_USERDATA)); | 119 return reinterpret_cast<void*>(GetWindowLongPtr(hwnd, GWLP_USERDATA)); |
120 } | 120 } |
121 | 121 |
122 #pragma warning(pop) | 122 #pragma warning(pop) |
123 | 123 |
124 bool DoesWindowBelongToActiveWindow(HWND window) { | 124 bool DoesWindowBelongToActiveWindow(HWND window) { |
125 DCHECK(window); | 125 DCHECK(window); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 HMODULE metro = base::win::GetMetroModule(); | 236 HMODULE metro = base::win::GetMetroModule(); |
237 if (!metro) | 237 if (!metro) |
238 return get_real_hwnd ? ::GetDesktopWindow() : HWND_DESKTOP; | 238 return get_real_hwnd ? ::GetDesktopWindow() : HWND_DESKTOP; |
239 // In windows 8 metro-mode the root window is not the desktop. | 239 // In windows 8 metro-mode the root window is not the desktop. |
240 RootWindow root_window = | 240 RootWindow root_window = |
241 reinterpret_cast<RootWindow>(::GetProcAddress(metro, "GetRootWindow")); | 241 reinterpret_cast<RootWindow>(::GetProcAddress(metro, "GetRootWindow")); |
242 return root_window(); | 242 return root_window(); |
243 } | 243 } |
244 | 244 |
245 } // namespace gfx | 245 } // namespace gfx |
OLD | NEW |