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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 } | 233 } |
232 | 234 |
233 void DesktopHostWin::OnClose() { | 235 void DesktopHostWin::OnClose() { |
234 // TODO: this obviously shouldn't be here. | 236 // TODO: this obviously shouldn't be here. |
235 MessageLoopForUI::current()->Quit(); | 237 MessageLoopForUI::current()->Quit(); |
236 } | 238 } |
237 | 239 |
238 LRESULT DesktopHostWin::OnKeyEvent(UINT message, | 240 LRESULT DesktopHostWin::OnKeyEvent(UINT message, |
239 WPARAM w_param, | 241 WPARAM w_param, |
240 LPARAM l_param) { | 242 LPARAM l_param) { |
| 243 // TODO(yusukes): Support input method. |
241 MSG msg = { hwnd(), message, w_param, l_param }; | 244 MSG msg = { hwnd(), message, w_param, l_param }; |
242 KeyEvent keyev(msg, message == WM_CHAR); | 245 KeyEvent keyev(msg, message == WM_CHAR); |
243 SetMsgHandled(desktop_->DispatchKeyEvent(&keyev)); | 246 SetMsgHandled(desktop_->DispatchKeyEvent(&keyev)); |
244 return 0; | 247 return 0; |
245 } | 248 } |
246 | 249 |
247 LRESULT DesktopHostWin::OnMouseRange(UINT message, | 250 LRESULT DesktopHostWin::OnMouseRange(UINT message, |
248 WPARAM w_param, | 251 WPARAM w_param, |
249 LPARAM l_param) { | 252 LPARAM l_param) { |
250 MSG msg = { hwnd(), message, w_param, l_param, 0, | 253 MSG msg = { hwnd(), message, w_param, l_param, 0, |
(...skipping 11 matching lines...) Expand all Loading... |
262 ValidateRect(hwnd(), NULL); | 265 ValidateRect(hwnd(), NULL); |
263 } | 266 } |
264 | 267 |
265 void DesktopHostWin::OnSize(UINT param, const CSize& size) { | 268 void DesktopHostWin::OnSize(UINT param, const CSize& size) { |
266 // Minimizing resizes the window to 0x0 which causes our layout to go all | 269 // Minimizing resizes the window to 0x0 which causes our layout to go all |
267 // screwy, so we just ignore it. | 270 // screwy, so we just ignore it. |
268 if (param != SIZE_MINIMIZED) | 271 if (param != SIZE_MINIMIZED) |
269 desktop_->OnHostResized(gfx::Size(size.cx, size.cy)); | 272 desktop_->OnHostResized(gfx::Size(size.cx, size.cy)); |
270 } | 273 } |
271 | 274 |
| 275 ui::InputMethod* DesktopHostWin::GetInputMethod() { |
| 276 return &input_method_; |
| 277 } |
| 278 |
| 279 void DesktopHostWin::DispatchKeyEventPostIME(const base::NativeEvent& event) { |
| 280 // TODO(yusukes): Support input method. |
| 281 NOTIMPLEMENTED(); |
| 282 } |
| 283 |
| 284 void DesktopHostWin::DispatchFabricatedKeyEventPostIME( |
| 285 ui::EventType type, ui::KeyboardCode key_code, int flags) { |
| 286 // TODO(yusukes): Support input method. |
| 287 NOTIMPLEMENTED(); |
| 288 } |
| 289 |
272 } // namespace aura | 290 } // namespace aura |
OLD | NEW |