Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1005)

Side by Side Diff: ui/aura/desktop_host_win.cc

Issue 8824007: Revert 113224 - IME (input method editor) support for Aura, part 3 of 3: Use ui::InputMethod in u... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/desktop_host_win.h ('k') | ui/aura/event.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "ui/aura/desktop.h" 12 #include "ui/aura/desktop.h"
13 #include "ui/aura/event.h" 13 #include "ui/aura/event.h"
14 #include "ui/base/ime/mock_input_method.h"
15 14
16 using std::max; 15 using std::max;
17 using std::min; 16 using std::min;
18 17
19 namespace aura { 18 namespace aura {
20 19
21 namespace { 20 namespace {
22 21
23 const wchar_t* GetCursorId(gfx::NativeCursor native_cursor) { 22 const wchar_t* GetCursorId(gfx::NativeCursor native_cursor) {
24 switch (native_cursor) { 23 switch (native_cursor) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 107 }
109 108
110 // static 109 // static
111 gfx::Size DesktopHost::GetNativeScreenSize() { 110 gfx::Size DesktopHost::GetNativeScreenSize() {
112 return gfx::Size(GetSystemMetrics(SM_CXSCREEN), 111 return gfx::Size(GetSystemMetrics(SM_CXSCREEN),
113 GetSystemMetrics(SM_CYSCREEN)); 112 GetSystemMetrics(SM_CYSCREEN));
114 } 113 }
115 114
116 DesktopHostWin::DesktopHostWin(const gfx::Rect& bounds) 115 DesktopHostWin::DesktopHostWin(const gfx::Rect& bounds)
117 : desktop_(NULL), 116 : desktop_(NULL),
118 // TODO(yusukes): implement and use ui::InputMethodWin.
119 ALLOW_THIS_IN_INITIALIZER_LIST(
120 input_method_(new ui::MockInputMethod(this))),
121 fullscreen_(false), 117 fullscreen_(false),
122 saved_window_style_(0), 118 saved_window_style_(0),
123 saved_window_ex_style_(0) { 119 saved_window_ex_style_(0) {
124 Init(NULL, bounds); 120 Init(NULL, bounds);
125 SetWindowText(hwnd(), L"aura::Desktop!"); 121 SetWindowText(hwnd(), L"aura::Desktop!");
126 input_method_->Init(true);
127 } 122 }
128 123
129 DesktopHostWin::~DesktopHostWin() { 124 DesktopHostWin::~DesktopHostWin() {
130 DestroyWindow(hwnd()); 125 DestroyWindow(hwnd());
131 } 126 }
132 127
133 bool DesktopHostWin::Dispatch(const MSG& msg) { 128 bool DesktopHostWin::Dispatch(const MSG& msg) {
134 TranslateMessage(&msg); 129 TranslateMessage(&msg);
135 DispatchMessage(&msg); 130 DispatchMessage(&msg);
136 return true; 131 return true;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 const gfx::Size size = GetSize(); 230 const gfx::Size size = GetSize();
236 return gfx::Point(max(0, min(size.width(), static_cast<int>(pt.x))), 231 return gfx::Point(max(0, min(size.width(), static_cast<int>(pt.x))),
237 max(0, min(size.height(), static_cast<int>(pt.y)))); 232 max(0, min(size.height(), static_cast<int>(pt.y))));
238 } 233 }
239 234
240 void DesktopHostWin::PostNativeEvent(const base::NativeEvent& native_event) { 235 void DesktopHostWin::PostNativeEvent(const base::NativeEvent& native_event) {
241 ::PostMessage( 236 ::PostMessage(
242 hwnd(), native_event.message, native_event.wParam, native_event.lParam); 237 hwnd(), native_event.message, native_event.wParam, native_event.lParam);
243 } 238 }
244 239
245 void DesktopHostWin::SetInputMethod(ui::InputMethod* input_method) {
246 input_method_.reset(input_method);
247 }
248
249 ui::InputMethod* DesktopHostWin::GetInputMethod() const {
250 return input_method_.get();
251 }
252
253 void DesktopHostWin::DispatchKeyEventPostIME(const base::NativeEvent& event) {
254 // TODO(yusukes): Support input method.
255 NOTIMPLEMENTED();
256 }
257
258 void DesktopHostWin::DispatchFabricatedKeyEventPostIME(
259 ui::EventType type, ui::KeyboardCode key_code, int flags) {
260 // TODO(yusukes): Support input method.
261 NOTIMPLEMENTED();
262 }
263
264 void DesktopHostWin::OnClose() { 240 void DesktopHostWin::OnClose() {
265 // TODO: this obviously shouldn't be here. 241 // TODO: this obviously shouldn't be here.
266 MessageLoopForUI::current()->Quit(); 242 MessageLoopForUI::current()->Quit();
267 } 243 }
268 244
269 LRESULT DesktopHostWin::OnKeyEvent(UINT message, 245 LRESULT DesktopHostWin::OnKeyEvent(UINT message,
270 WPARAM w_param, 246 WPARAM w_param,
271 LPARAM l_param) { 247 LPARAM l_param) {
272 // TODO(yusukes): Support input method.
273 MSG msg = { hwnd(), message, w_param, l_param }; 248 MSG msg = { hwnd(), message, w_param, l_param };
274 KeyEvent keyev(msg, message == WM_CHAR); 249 KeyEvent keyev(msg, message == WM_CHAR);
275 SetMsgHandled(desktop_->DispatchKeyEvent(&keyev)); 250 SetMsgHandled(desktop_->DispatchKeyEvent(&keyev));
276 return 0; 251 return 0;
277 } 252 }
278 253
279 LRESULT DesktopHostWin::OnMouseRange(UINT message, 254 LRESULT DesktopHostWin::OnMouseRange(UINT message,
280 WPARAM w_param, 255 WPARAM w_param,
281 LPARAM l_param) { 256 LPARAM l_param) {
282 MSG msg = { hwnd(), message, w_param, l_param, 0, 257 MSG msg = { hwnd(), message, w_param, l_param, 0,
(...skipping 12 matching lines...) Expand all
295 } 270 }
296 271
297 void DesktopHostWin::OnSize(UINT param, const CSize& size) { 272 void DesktopHostWin::OnSize(UINT param, const CSize& size) {
298 // Minimizing resizes the window to 0x0 which causes our layout to go all 273 // Minimizing resizes the window to 0x0 which causes our layout to go all
299 // screwy, so we just ignore it. 274 // screwy, so we just ignore it.
300 if (param != SIZE_MINIMIZED) 275 if (param != SIZE_MINIMIZED)
301 desktop_->OnHostResized(gfx::Size(size.cx, size.cy)); 276 desktop_->OnHostResized(gfx::Size(size.cx, size.cy));
302 } 277 }
303 278
304 } // namespace aura 279 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/desktop_host_win.h ('k') | ui/aura/event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698