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/aura/desktop_host_win.h" | 5 #include "ui/aura/desktop_host_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 107 } |
108 | 108 |
109 // static | 109 // static |
110 gfx::Size DesktopHost::GetNativeDisplaySize() { | 110 gfx::Size DesktopHost::GetNativeDisplaySize() { |
111 return gfx::Size(GetSystemMetrics(SM_CXSCREEN), | 111 return gfx::Size(GetSystemMetrics(SM_CXSCREEN), |
112 GetSystemMetrics(SM_CYSCREEN)); | 112 GetSystemMetrics(SM_CYSCREEN)); |
113 } | 113 } |
114 | 114 |
115 DesktopHostWin::DesktopHostWin(const gfx::Rect& bounds) | 115 DesktopHostWin::DesktopHostWin(const gfx::Rect& bounds) |
116 : desktop_(NULL), | 116 : desktop_(NULL), |
| 117 ALLOW_THIS_IN_INITIALIZER_LIST(input_method_(this)), |
117 fullscreen_(false), | 118 fullscreen_(false), |
118 saved_window_style_(0), | 119 saved_window_style_(0), |
119 saved_window_ex_style_(0) { | 120 saved_window_ex_style_(0) { |
120 Init(NULL, bounds); | 121 Init(NULL, bounds); |
121 SetWindowText(hwnd(), L"aura::Desktop!"); | 122 SetWindowText(hwnd(), L"aura::Desktop!"); |
122 } | 123 } |
123 | 124 |
124 DesktopHostWin::~DesktopHostWin() { | 125 DesktopHostWin::~DesktopHostWin() { |
125 DestroyWindow(hwnd()); | 126 DestroyWindow(hwnd()); |
126 } | 127 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 227 } |
227 | 228 |
228 void DesktopHostWin::OnClose() { | 229 void DesktopHostWin::OnClose() { |
229 // TODO: this obviously shouldn't be here. | 230 // TODO: this obviously shouldn't be here. |
230 MessageLoopForUI::current()->Quit(); | 231 MessageLoopForUI::current()->Quit(); |
231 } | 232 } |
232 | 233 |
233 LRESULT DesktopHostWin::OnKeyEvent(UINT message, | 234 LRESULT DesktopHostWin::OnKeyEvent(UINT message, |
234 WPARAM w_param, | 235 WPARAM w_param, |
235 LPARAM l_param) { | 236 LPARAM l_param) { |
| 237 // TODO(yusukes): Support input method. |
236 MSG msg = { hwnd(), message, w_param, l_param }; | 238 MSG msg = { hwnd(), message, w_param, l_param }; |
237 KeyEvent keyev(msg, message == WM_CHAR); | 239 KeyEvent keyev(msg, message == WM_CHAR); |
238 SetMsgHandled(desktop_->DispatchKeyEvent(&keyev)); | 240 SetMsgHandled(desktop_->DispatchKeyEvent(&keyev)); |
239 return 0; | 241 return 0; |
240 } | 242 } |
241 | 243 |
242 LRESULT DesktopHostWin::OnMouseRange(UINT message, | 244 LRESULT DesktopHostWin::OnMouseRange(UINT message, |
243 WPARAM w_param, | 245 WPARAM w_param, |
244 LPARAM l_param) { | 246 LPARAM l_param) { |
245 MSG msg = { hwnd(), message, w_param, l_param, 0, | 247 MSG msg = { hwnd(), message, w_param, l_param, 0, |
(...skipping 11 matching lines...) Expand all Loading... |
257 ValidateRect(hwnd(), NULL); | 259 ValidateRect(hwnd(), NULL); |
258 } | 260 } |
259 | 261 |
260 void DesktopHostWin::OnSize(UINT param, const CSize& size) { | 262 void DesktopHostWin::OnSize(UINT param, const CSize& size) { |
261 // Minimizing resizes the window to 0x0 which causes our layout to go all | 263 // Minimizing resizes the window to 0x0 which causes our layout to go all |
262 // screwy, so we just ignore it. | 264 // screwy, so we just ignore it. |
263 if (param != SIZE_MINIMIZED) | 265 if (param != SIZE_MINIMIZED) |
264 desktop_->OnHostResized(gfx::Size(size.cx, size.cy)); | 266 desktop_->OnHostResized(gfx::Size(size.cx, size.cy)); |
265 } | 267 } |
266 | 268 |
| 269 ui::InputMethod* DesktopHostWin::GetInputMethod() { |
| 270 return &input_method_; |
| 271 } |
| 272 |
| 273 void DesktopHostWin::DispatchKeyEventPostIME(Event* event) { |
| 274 // TODO(yusukes): Support input method. |
| 275 NOTIMPLEMENTED(); |
| 276 } |
| 277 |
267 } // namespace aura | 278 } // namespace aura |
OLD | NEW |