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

Side by Side Diff: views/focus/accelerator_handler_win.cc

Issue 8588064: views: Move bubble, events, focus and layout to ui/views/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | « views/focus/accelerator_handler_wayland.cc ('k') | views/focus/external_focus_tracker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 "views/focus/accelerator_handler.h"
6
7 #include "ui/base/keycodes/keyboard_codes.h"
8 #include "ui/base/keycodes/keyboard_code_conversion_win.h"
9 #include "views/events/event.h"
10 #include "views/focus/focus_manager.h"
11 #include "views/widget/widget.h"
12
13 namespace views {
14
15 AcceleratorHandler::AcceleratorHandler() {
16 }
17
18 bool AcceleratorHandler::Dispatch(const MSG& msg) {
19 bool process_message = true;
20
21 if (msg.message >= WM_KEYFIRST && msg.message <= WM_KEYLAST) {
22 Widget* widget = Widget::GetTopLevelWidgetForNativeView(msg.hwnd);
23 FocusManager* focus_manager = widget ? widget->GetFocusManager() : NULL;
24 if (focus_manager) {
25 switch (msg.message) {
26 case WM_KEYDOWN:
27 case WM_SYSKEYDOWN: {
28 KeyEvent event(msg);
29 process_message = focus_manager->OnKeyEvent(event);
30 if (!process_message) {
31 // Record that this key is pressed so we can remember not to
32 // translate and dispatch the associated WM_KEYUP.
33 pressed_keys_.insert(msg.wParam);
34 }
35 break;
36 }
37 case WM_KEYUP:
38 case WM_SYSKEYUP: {
39 std::set<WPARAM>::iterator iter = pressed_keys_.find(msg.wParam);
40 if (iter != pressed_keys_.end()) {
41 // Don't translate/dispatch the KEYUP since we have eaten the
42 // associated KEYDOWN.
43 pressed_keys_.erase(iter);
44 return true;
45 }
46 break;
47 }
48 }
49 }
50 }
51
52 if (process_message) {
53 TranslateMessage(&msg);
54 DispatchMessage(&msg);
55 }
56
57 return true;
58 }
59
60 } // namespace views
OLDNEW
« no previous file with comments | « views/focus/accelerator_handler_wayland.cc ('k') | views/focus/external_focus_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698