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

Side by Side Diff: ui/views/controls/webview/unhandled_keyboard_event_handler_linux.cc

Issue 61553006: Rename WebKit namespace to blink (part 5) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/views/controls/webview/unhandled_keyboard_event_handler.h" 5 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/public/browser/native_web_keyboard_event.h" 8 #include "content/public/browser/native_web_keyboard_event.h"
9 #include "ui/events/event.h" 9 #include "ui/events/event.h"
10 #include "ui/views/focus/focus_manager.h" 10 #include "ui/views/focus/focus_manager.h"
(...skipping 10 matching lines...) Expand all
21 const NativeWebKeyboardEvent& event, 21 const NativeWebKeyboardEvent& event,
22 FocusManager* focus_manager) { 22 FocusManager* focus_manager) {
23 if (!focus_manager) { 23 if (!focus_manager) {
24 NOTREACHED(); 24 NOTREACHED();
25 return; 25 return;
26 } 26 }
27 27
28 // Previous calls to TranslateMessage can generate Char events as well as 28 // Previous calls to TranslateMessage can generate Char events as well as
29 // RawKeyDown events, even if the latter triggered an accelerator. In these 29 // RawKeyDown events, even if the latter triggered an accelerator. In these
30 // cases, we discard the Char events. 30 // cases, we discard the Char events.
31 if (event.type == WebKit::WebInputEvent::Char && ignore_next_char_event_) { 31 if (event.type == blink::WebInputEvent::Char && ignore_next_char_event_) {
32 ignore_next_char_event_ = false; 32 ignore_next_char_event_ = false;
33 return; 33 return;
34 } 34 }
35 // It's necessary to reset this flag, because a RawKeyDown event may not 35 // It's necessary to reset this flag, because a RawKeyDown event may not
36 // always generate a Char event. 36 // always generate a Char event.
37 ignore_next_char_event_ = false; 37 ignore_next_char_event_ = false;
38 38
39 if (event.type == WebKit::WebInputEvent::RawKeyDown) { 39 if (event.type == blink::WebInputEvent::RawKeyDown) {
40 ui::Accelerator accelerator( 40 ui::Accelerator accelerator(
41 static_cast<ui::KeyboardCode>(event.windowsKeyCode), 41 static_cast<ui::KeyboardCode>(event.windowsKeyCode),
42 content::GetModifiersFromNativeWebKeyboardEvent(event)); 42 content::GetModifiersFromNativeWebKeyboardEvent(event));
43 43
44 // This is tricky: we want to set ignore_next_char_event_ if 44 // This is tricky: we want to set ignore_next_char_event_ if
45 // ProcessAccelerator returns true. But ProcessAccelerator might delete 45 // ProcessAccelerator returns true. But ProcessAccelerator might delete
46 // |this| if the accelerator is a "close tab" one. So we speculatively 46 // |this| if the accelerator is a "close tab" one. So we speculatively
47 // set the flag and fix it if no event was handled. 47 // set the flag and fix it if no event was handled.
48 ignore_next_char_event_ = true; 48 ignore_next_char_event_ = true;
49 49
50 if (focus_manager->ProcessAccelerator(accelerator)) { 50 if (focus_manager->ProcessAccelerator(accelerator)) {
51 return; 51 return;
52 } 52 }
53 53
54 // ProcessAccelerator didn't handle the accelerator, so we know both 54 // ProcessAccelerator didn't handle the accelerator, so we know both
55 // that |this| is still valid, and that we didn't want to set the flag. 55 // that |this| is still valid, and that we didn't want to set the flag.
56 ignore_next_char_event_ = false; 56 ignore_next_char_event_ = false;
57 } 57 }
58 58
59 if (event.os_event && !event.skip_in_browser) 59 if (event.os_event && !event.skip_in_browser)
60 focus_manager->OnKeyEvent(*static_cast<ui::KeyEvent*>(event.os_event)); 60 focus_manager->OnKeyEvent(*static_cast<ui::KeyEvent*>(event.os_event));
61 } 61 }
62 62
63 } // namespace views 63 } // namespace views
OLDNEW
« no previous file with comments | « ui/compositor/test/default_context_factory.cc ('k') | ui/views/controls/webview/unhandled_keyboard_event_handler_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698