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!"); |
| 123 input_method_.Init(hwnd()); |
122 } | 124 } |
123 | 125 |
124 DesktopHostWin::~DesktopHostWin() { | 126 DesktopHostWin::~DesktopHostWin() { |
125 DestroyWindow(hwnd()); | 127 DestroyWindow(hwnd()); |
126 } | 128 } |
127 | 129 |
128 bool DesktopHostWin::Dispatch(const MSG& msg) { | 130 bool DesktopHostWin::Dispatch(const MSG& msg) { |
129 TranslateMessage(&msg); | 131 TranslateMessage(&msg); |
130 DispatchMessage(&msg); | 132 DispatchMessage(&msg); |
131 return true; | 133 return true; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 240 } |
239 | 241 |
240 void DesktopHostWin::OnClose() { | 242 void DesktopHostWin::OnClose() { |
241 // TODO: this obviously shouldn't be here. | 243 // TODO: this obviously shouldn't be here. |
242 MessageLoopForUI::current()->Quit(); | 244 MessageLoopForUI::current()->Quit(); |
243 } | 245 } |
244 | 246 |
245 LRESULT DesktopHostWin::OnKeyEvent(UINT message, | 247 LRESULT DesktopHostWin::OnKeyEvent(UINT message, |
246 WPARAM w_param, | 248 WPARAM w_param, |
247 LPARAM l_param) { | 249 LPARAM l_param) { |
| 250 // TODO(yusukes): Support input method. |
248 MSG msg = { hwnd(), message, w_param, l_param }; | 251 MSG msg = { hwnd(), message, w_param, l_param }; |
249 KeyEvent keyev(msg, message == WM_CHAR); | 252 KeyEvent keyev(msg, message == WM_CHAR); |
250 SetMsgHandled(desktop_->DispatchKeyEvent(&keyev)); | 253 SetMsgHandled(desktop_->DispatchKeyEvent(&keyev)); |
251 return 0; | 254 return 0; |
252 } | 255 } |
253 | 256 |
254 LRESULT DesktopHostWin::OnMouseRange(UINT message, | 257 LRESULT DesktopHostWin::OnMouseRange(UINT message, |
255 WPARAM w_param, | 258 WPARAM w_param, |
256 LPARAM l_param) { | 259 LPARAM l_param) { |
257 MSG msg = { hwnd(), message, w_param, l_param, 0, | 260 MSG msg = { hwnd(), message, w_param, l_param, 0, |
(...skipping 11 matching lines...) Expand all Loading... |
269 ValidateRect(hwnd(), NULL); | 272 ValidateRect(hwnd(), NULL); |
270 } | 273 } |
271 | 274 |
272 void DesktopHostWin::OnSize(UINT param, const CSize& size) { | 275 void DesktopHostWin::OnSize(UINT param, const CSize& size) { |
273 // Minimizing resizes the window to 0x0 which causes our layout to go all | 276 // Minimizing resizes the window to 0x0 which causes our layout to go all |
274 // screwy, so we just ignore it. | 277 // screwy, so we just ignore it. |
275 if (param != SIZE_MINIMIZED) | 278 if (param != SIZE_MINIMIZED) |
276 desktop_->OnHostResized(gfx::Size(size.cx, size.cy)); | 279 desktop_->OnHostResized(gfx::Size(size.cx, size.cy)); |
277 } | 280 } |
278 | 281 |
| 282 ui::InputMethod* DesktopHostWin::GetInputMethod() { |
| 283 return &input_method_; |
| 284 } |
| 285 |
| 286 void DesktopHostWin::DispatchKeyEventPostIME(const base::NativeEvent& event) { |
| 287 // TODO(yusukes): Support input method. |
| 288 NOTIMPLEMENTED(); |
| 289 } |
| 290 |
| 291 void DesktopHostWin::DispatchFabricatedKeyEventPostIME( |
| 292 ui::EventType type, ui::KeyboardCode key_code, int flags) { |
| 293 // TODO(yusukes): Support input method. |
| 294 NOTIMPLEMENTED(); |
| 295 } |
| 296 |
279 } // namespace aura | 297 } // namespace aura |
OLD | NEW |