| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 // Crash isn't one of the ones we commonly see. | 64 // Crash isn't one of the ones we commonly see. |
| 65 void CrashOther() { | 65 void CrashOther() { |
| 66 LOG_GETLASTERROR(FATAL); | 66 LOG_GETLASTERROR(FATAL); |
| 67 } | 67 } |
| 68 | 68 |
| 69 MSVC_ENABLE_OPTIMIZE(); | 69 MSVC_ENABLE_OPTIMIZE(); |
| 70 | 70 |
| 71 } // namespace | 71 } // namespace |
| 72 | 72 |
| 73 string16 GetClassName(HWND window) { | 73 base::string16 GetClassName(HWND window) { |
| 74 // GetClassNameW will return a truncated result (properly null terminated) if | 74 // GetClassNameW will return a truncated result (properly null terminated) if |
| 75 // the given buffer is not large enough. So, it is not possible to determine | 75 // the given buffer is not large enough. So, it is not possible to determine |
| 76 // that we got the entire class name if the result is exactly equal to the | 76 // that we got the entire class name if the result is exactly equal to the |
| 77 // size of the buffer minus one. | 77 // size of the buffer minus one. |
| 78 DWORD buffer_size = MAX_PATH; | 78 DWORD buffer_size = MAX_PATH; |
| 79 while (true) { | 79 while (true) { |
| 80 std::wstring output; | 80 std::wstring output; |
| 81 DWORD size_ret = | 81 DWORD size_ret = |
| 82 GetClassNameW(window, WriteInto(&output, buffer_size), buffer_size); | 82 GetClassNameW(window, WriteInto(&output, buffer_size), buffer_size); |
| 83 if (size_ret == 0) | 83 if (size_ret == 0) |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 HMODULE metro = base::win::GetMetroModule(); | 235 HMODULE metro = base::win::GetMetroModule(); |
| 236 if (!metro) | 236 if (!metro) |
| 237 return get_real_hwnd ? ::GetDesktopWindow() : HWND_DESKTOP; | 237 return get_real_hwnd ? ::GetDesktopWindow() : HWND_DESKTOP; |
| 238 // In windows 8 metro-mode the root window is not the desktop. | 238 // In windows 8 metro-mode the root window is not the desktop. |
| 239 RootWindow root_window = | 239 RootWindow root_window = |
| 240 reinterpret_cast<RootWindow>(::GetProcAddress(metro, "GetRootWindow")); | 240 reinterpret_cast<RootWindow>(::GetProcAddress(metro, "GetRootWindow")); |
| 241 return root_window(); | 241 return root_window(); |
| 242 } | 242 } |
| 243 | 243 |
| 244 } // namespace gfx | 244 } // namespace gfx |
| OLD | NEW |