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 "aura/desktop_host_win.h" | 5 #include "aura/desktop_host_win.h" |
6 | 6 |
7 #include "aura/desktop.h" | 7 #include "aura/desktop.h" |
8 #include "aura/event.h" | 8 #include "aura/event.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 void DesktopHostWin::Show() { | 40 void DesktopHostWin::Show() { |
41 ShowWindow(hwnd(), SW_SHOWNORMAL); | 41 ShowWindow(hwnd(), SW_SHOWNORMAL); |
42 } | 42 } |
43 | 43 |
44 gfx::Size DesktopHostWin::GetSize() { | 44 gfx::Size DesktopHostWin::GetSize() { |
45 RECT r; | 45 RECT r; |
46 GetClientRect(hwnd(), &r); | 46 GetClientRect(hwnd(), &r); |
47 return gfx::Rect(r).size(); | 47 return gfx::Rect(r).size(); |
48 } | 48 } |
49 | 49 |
| 50 void DesktopHostWin::SetSize(const gfx::Size& size) { |
| 51 SetWindowPos( |
| 52 hwnd(), |
| 53 NULL, |
| 54 0, |
| 55 0, |
| 56 size.width(), |
| 57 size.height(), |
| 58 SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOREDRAW | SWP_NOREPOSITION); |
| 59 } |
| 60 |
50 void DesktopHostWin::OnClose() { | 61 void DesktopHostWin::OnClose() { |
51 // TODO: this obviously shouldn't be here. | 62 // TODO: this obviously shouldn't be here. |
52 MessageLoopForUI::current()->Quit(); | 63 MessageLoopForUI::current()->Quit(); |
53 } | 64 } |
54 | 65 |
55 LRESULT DesktopHostWin::OnMouseRange(UINT message, | 66 LRESULT DesktopHostWin::OnMouseRange(UINT message, |
56 WPARAM w_param, | 67 WPARAM w_param, |
57 LPARAM l_param) { | 68 LPARAM l_param) { |
58 MSG msg = { hwnd(), message, w_param, l_param, 0, | 69 MSG msg = { hwnd(), message, w_param, l_param, 0, |
59 { GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param) } }; | 70 { GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param) } }; |
60 MouseEvent event(msg); | 71 MouseEvent event(msg); |
61 bool handled = false; | 72 bool handled = false; |
62 if (!(event.flags() & ui::EF_IS_NON_CLIENT)) | 73 if (!(event.flags() & ui::EF_IS_NON_CLIENT)) |
63 handled = desktop_->OnMouseEvent(event); | 74 handled = desktop_->OnMouseEvent(event); |
64 SetMsgHandled(handled); | 75 SetMsgHandled(handled); |
65 return 0; | 76 return 0; |
66 } | 77 } |
67 | 78 |
68 void DesktopHostWin::OnPaint(HDC dc) { | 79 void DesktopHostWin::OnPaint(HDC dc) { |
69 if (desktop_) | 80 if (desktop_) |
70 desktop_->Draw(); | 81 desktop_->Draw(); |
71 ValidateRect(hwnd(), NULL); | 82 ValidateRect(hwnd(), NULL); |
72 } | 83 } |
73 | 84 |
74 } // namespace aura | 85 } // namespace aura |
OLD | NEW |