OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "aura/desktop_host_win.h" |
| 6 |
| 7 #include "aura/desktop.h" |
| 8 #include "base/message_loop.h" |
| 9 |
| 10 namespace aura { |
| 11 |
| 12 // static |
| 13 DesktopHost* DesktopHost::Create(const gfx::Rect& bounds) { |
| 14 return new DesktopHostWin(bounds); |
| 15 } |
| 16 |
| 17 DesktopHostWin::DesktopHostWin(const gfx::Rect& bounds) : desktop_(NULL) { |
| 18 Init(NULL, bounds); |
| 19 } |
| 20 |
| 21 DesktopHostWin::~DesktopHostWin() { |
| 22 DestroyWindow(hwnd()); |
| 23 } |
| 24 |
| 25 void DesktopHostWin::SetDesktop(Desktop* desktop) { |
| 26 desktop_ = desktop; |
| 27 } |
| 28 |
| 29 gfx::AcceleratedWidget DesktopHostWin::GetAcceleratedWidget() { |
| 30 return hwnd(); |
| 31 } |
| 32 |
| 33 void DesktopHostWin::Show() { |
| 34 ShowWindow(hwnd(), SW_SHOWNORMAL); |
| 35 } |
| 36 |
| 37 gfx::Size DesktopHostWin::GetSize() { |
| 38 RECT r; |
| 39 GetClientRect(hwnd(), &r); |
| 40 return gfx::Rect(r).size(); |
| 41 } |
| 42 |
| 43 void DesktopHostWin::OnClose() { |
| 44 // TODO: this obviously shouldn't be here. |
| 45 MessageLoopForUI::current()->Quit(); |
| 46 } |
| 47 |
| 48 void DesktopHostWin::OnPaint(HDC dc) { |
| 49 if (desktop_) |
| 50 desktop_->Draw(); |
| 51 ValidateRect(hwnd(), NULL); |
| 52 } |
| 53 |
| 54 } // namespace aura |
OLD | NEW |