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

Side by Side Diff: chrome/browser/ui/views/dropdown_bar_host_gtk.cc

Issue 6034002: Replace Textfield::Keystroke with views::KeyEvent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: key_code, ET_KEY_PRESS for WM_CHAR Created 9 years, 11 months 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 (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 "chrome/browser/views/dropdown_bar_host.h" 5 #include "chrome/browser/views/dropdown_bar_host.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 8
9 #include "chrome/browser/tab_contents/tab_contents.h" 9 #include "chrome/browser/tab_contents/tab_contents.h"
10 #include "chrome/browser/views/frame/browser_view.h" 10 #include "chrome/browser/views/frame/browser_view.h"
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 24
25 void DropdownBarHost::SetWidgetPositionNative(const gfx::Rect& new_pos, 25 void DropdownBarHost::SetWidgetPositionNative(const gfx::Rect& new_pos,
26 bool no_redraw) { 26 bool no_redraw) {
27 host_->SetBounds(new_pos); 27 host_->SetBounds(new_pos);
28 host_->Show(); 28 host_->Show();
29 } 29 }
30 30
31 NativeWebKeyboardEvent DropdownBarHost::GetKeyboardEvent( 31 NativeWebKeyboardEvent DropdownBarHost::GetKeyboardEvent(
32 const TabContents* contents, 32 const TabContents* contents,
33 const views::Textfield::Keystroke& key_stroke) { 33 const views::KeyEvent& key_event) {
34 #if defined(TOUCH_UI) 34 #if defined(TOUCH_UI)
35 // TODO(oshima): This is a copy from 35 // TODO(oshima): This is a copy from
36 // RenderWidgetHostViewViews::OnKeyPressed(). 36 // RenderWidgetHostViewViews::OnKeyPressed().
37 // Refactor and eliminate the dup code. 37 // Refactor and eliminate the dup code.
38 const views::KeyEvent& e = key_stroke.key_event();
39 NativeWebKeyboardEvent wke; 38 NativeWebKeyboardEvent wke;
40 wke.type = WebKit::WebInputEvent::KeyDown; 39 wke.type = WebKit::WebInputEvent::KeyDown;
41 wke.windowsKeyCode = e.GetKeyCode(); 40 wke.windowsKeyCode = key_event.GetKeyCode();
42 wke.setKeyIdentifierFromWindowsKeyCode(); 41 wke.setKeyIdentifierFromWindowsKeyCode();
43 42
44 wke.text[0] = wke.unmodifiedText[0] = 43 wke.text[0] = wke.unmodifiedText[0] =
45 static_cast<unsigned short>(gdk_keyval_to_unicode( 44 static_cast<unsigned short>(gdk_keyval_to_unicode(
46 app::GdkKeyCodeForWindowsKeyCode(e.GetKeyCode(), 45 app::GdkKeyCodeForWindowsKeyCode(key_event.GetKeyCode(),
47 e.IsShiftDown() ^ e.IsCapsLockDown()))); 46 key_event.IsShiftDown() ^ key_event.IsCapsLockDown())));
48 return wke; 47 return wke;
49 #else 48 #else
50 return NativeWebKeyboardEvent(key_stroke.event()); 49 return NativeWebKeyboardEvent(key_event.native_event());
51 #endif 50 #endif
52 } 51 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/dropdown_bar_host.h ('k') | chrome/browser/ui/views/dropdown_bar_host_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698