| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/platform_window/win/win_window.h" | 5 #include "ui/platform_window/win/win_window.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 window_bounds.set_y(std::max(0, window_bounds.y())); | 35 window_bounds.set_y(std::max(0, window_bounds.y())); |
| 36 return window_bounds; | 36 return window_bounds; |
| 37 } | 37 } |
| 38 | 38 |
| 39 } // namespace | 39 } // namespace |
| 40 | 40 |
| 41 WinWindow::WinWindow(PlatformWindowDelegate* delegate, | 41 WinWindow::WinWindow(PlatformWindowDelegate* delegate, |
| 42 const gfx::Rect& bounds) | 42 const gfx::Rect& bounds) |
| 43 : delegate_(delegate) { | 43 : delegate_(delegate) { |
| 44 CHECK(delegate_); | 44 CHECK(delegate_); |
| 45 if (use_popup_as_root_window_for_test) | 45 DWORD window_style = WS_OVERLAPPEDWINDOW; |
| 46 if (use_popup_as_root_window_for_test) { |
| 46 set_window_style(WS_POPUP); | 47 set_window_style(WS_POPUP); |
| 47 gfx::Rect window_bounds = GetWindowBoundsForClientBounds( | 48 window_style = WS_POPUP; |
| 48 WS_OVERLAPPEDWINDOW, window_ex_style(), bounds); | 49 } |
| 50 gfx::Rect window_bounds = |
| 51 GetWindowBoundsForClientBounds(window_style, window_ex_style(), bounds); |
| 49 gfx::WindowImpl::Init(NULL, window_bounds); | 52 gfx::WindowImpl::Init(NULL, window_bounds); |
| 50 SetWindowText(hwnd(), L"WinWindow"); | 53 SetWindowText(hwnd(), L"WinWindow"); |
| 51 } | 54 } |
| 52 | 55 |
| 53 WinWindow::~WinWindow() { | 56 WinWindow::~WinWindow() { |
| 54 } | 57 } |
| 55 | 58 |
| 56 void WinWindow::Destroy() { | 59 void WinWindow::Destroy() { |
| 57 if (IsWindow(hwnd())) | 60 if (IsWindow(hwnd())) |
| 58 DestroyWindow(hwnd()); | 61 DestroyWindow(hwnd()); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 195 |
| 193 namespace test { | 196 namespace test { |
| 194 | 197 |
| 195 // static | 198 // static |
| 196 void SetUsePopupAsRootWindowForTest(bool use) { | 199 void SetUsePopupAsRootWindowForTest(bool use) { |
| 197 use_popup_as_root_window_for_test = use; | 200 use_popup_as_root_window_for_test = use; |
| 198 } | 201 } |
| 199 | 202 |
| 200 } // namespace test | 203 } // namespace test |
| 201 } // namespace ui | 204 } // namespace ui |
| OLD | NEW |