| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base/win/hwnd_util.h" | 5 #include "ui/base/win/hwnd_util.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "ui/gfx/rect.h" | 8 #include "ui/gfx/rect.h" |
| 9 #include "ui/gfx/size.h" | 9 #include "ui/gfx/size.h" |
| 10 | 10 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 window_bounds.right - window_bounds.left, | 163 window_bounds.right - window_bounds.left, |
| 164 window_bounds.bottom - window_bounds.top, | 164 window_bounds.bottom - window_bounds.top, |
| 165 SWP_NOACTIVATE | SWP_NOZORDER); | 165 SWP_NOACTIVATE | SWP_NOZORDER); |
| 166 } // else case, AdjustWindowToFit set the bounds for us. | 166 } // else case, AdjustWindowToFit set the bounds for us. |
| 167 } else { | 167 } else { |
| 168 NOTREACHED() << "Unable to adjust window to fit"; | 168 NOTREACHED() << "Unable to adjust window to fit"; |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 | 171 |
| 172 void CheckWindowCreated(HWND hwnd) { | 172 void CheckWindowCreated(HWND hwnd) { |
| 173 if (hwnd) | 173 if (!hwnd) |
| 174 return; | 174 LOG_GETLASTERROR(FATAL); |
| 175 | |
| 176 LPWSTR error_string = NULL; | |
| 177 DWORD last_error = GetLastError(); | |
| 178 FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | | |
| 179 FORMAT_MESSAGE_FROM_SYSTEM, | |
| 180 0, // Use the internal message table. | |
| 181 last_error, | |
| 182 0, // Use default language. | |
| 183 reinterpret_cast<LPWSTR>(&error_string), | |
| 184 0, // Buffer size. | |
| 185 0); // Arguments (unused). | |
| 186 // Typical reason for failure is ERROR_NOT_ENOUGH_MEMORY (8). | |
| 187 CHECK(false) << "Create failed error=" << last_error << | |
| 188 " message=" << error_string; | |
| 189 } | 175 } |
| 190 | 176 |
| 191 } // namespace ui | 177 } // namespace ui |
| OLD | NEW |