| 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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
| 10 #include "ui/events/event_utils.h" | 10 #include "ui/events/event_utils.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 void WinWindow::Close() { | 68 void WinWindow::Close() { |
| 69 Destroy(); | 69 Destroy(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void WinWindow::SetBounds(const gfx::Rect& bounds) { | 72 void WinWindow::SetBounds(const gfx::Rect& bounds) { |
| 73 gfx::Rect window_bounds = GetWindowBoundsForClientBounds( | 73 gfx::Rect window_bounds = GetWindowBoundsForClientBounds( |
| 74 GetWindowLong(hwnd(), GWL_STYLE), | 74 GetWindowLong(hwnd(), GWL_STYLE), |
| 75 GetWindowLong(hwnd(), GWL_EXSTYLE), | 75 GetWindowLong(hwnd(), GWL_EXSTYLE), |
| 76 bounds); | 76 bounds); |
| 77 unsigned int flags = SWP_NOREPOSITION; |
| 78 if (!::IsWindowVisible(hwnd())) |
| 79 flags |= SWP_NOACTIVATE; |
| 77 SetWindowPos(hwnd(), NULL, window_bounds.x(), window_bounds.y(), | 80 SetWindowPos(hwnd(), NULL, window_bounds.x(), window_bounds.y(), |
| 78 window_bounds.width(), window_bounds.height(), | 81 window_bounds.width(), window_bounds.height(), flags); |
| 79 SWP_NOREPOSITION); | |
| 80 } | 82 } |
| 81 | 83 |
| 82 gfx::Rect WinWindow::GetBounds() { | 84 gfx::Rect WinWindow::GetBounds() { |
| 83 RECT cr; | 85 RECT cr; |
| 84 GetClientRect(hwnd(), &cr); | 86 GetClientRect(hwnd(), &cr); |
| 85 return gfx::Rect(cr); | 87 return gfx::Rect(cr); |
| 86 } | 88 } |
| 87 | 89 |
| 88 void WinWindow::SetTitle(const base::string16& title) { | 90 void WinWindow::SetTitle(const base::string16& title) { |
| 89 SetWindowText(hwnd(), title.c_str()); | 91 SetWindowText(hwnd(), title.c_str()); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 191 |
| 190 namespace test { | 192 namespace test { |
| 191 | 193 |
| 192 // static | 194 // static |
| 193 void SetUsePopupAsRootWindowForTest(bool use) { | 195 void SetUsePopupAsRootWindowForTest(bool use) { |
| 194 use_popup_as_root_window_for_test = use; | 196 use_popup_as_root_window_for_test = use; |
| 195 } | 197 } |
| 196 | 198 |
| 197 } // namespace test | 199 } // namespace test |
| 198 } // namespace ui | 200 } // namespace ui |
| OLD | NEW |