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

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

Issue 8621006: Remove most obvious TOUCH_UI code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert file that CQ does not like. 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 | « chrome/browser/ui/views/dialog_stubs_gtk.cc ('k') | ui/ui.gyp » ('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 "chrome/browser/ui/views/dropdown_bar_host.h" 5 #include "chrome/browser/ui/views/dropdown_bar_host.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 8
9 #include "chrome/browser/ui/views/frame/browser_view.h" 9 #include "chrome/browser/ui/views/frame/browser_view.h"
10 #include "content/browser/tab_contents/tab_contents.h" 10 #include "content/browser/tab_contents/tab_contents.h"
11 #include "ui/views/widget/widget.h" 11 #include "ui/views/widget/widget.h"
12 #include "views/controls/textfield/textfield.h" 12 #include "views/controls/textfield/textfield.h"
13 13
14 #if defined(TOUCH_UI)
15 #include "ui/base/keycodes/keyboard_code_conversion_gtk.h"
16 #endif
17
18 void DropdownBarHost::SetWidgetPositionNative(const gfx::Rect& new_pos, 14 void DropdownBarHost::SetWidgetPositionNative(const gfx::Rect& new_pos,
19 bool no_redraw) { 15 bool no_redraw) {
20 host_->SetBounds(new_pos); 16 host_->SetBounds(new_pos);
21 host_->Show(); 17 host_->Show();
22 } 18 }
23 19
24 NativeWebKeyboardEvent DropdownBarHost::GetKeyboardEvent( 20 NativeWebKeyboardEvent DropdownBarHost::GetKeyboardEvent(
25 const TabContents* contents, 21 const TabContents* contents,
26 const views::KeyEvent& key_event) { 22 const views::KeyEvent& key_event) {
27 #if defined(TOUCH_UI)
28 // TODO(oshima): This is a copy from
29 // RenderWidgetHostViewViews::OnKeyPressed().
30 // Refactor and eliminate the dup code.
31 NativeWebKeyboardEvent wke;
32 wke.type = WebKit::WebInputEvent::KeyDown;
33 wke.windowsKeyCode = key_event.key_code();
34 wke.setKeyIdentifierFromWindowsKeyCode();
35
36 wke.text[0] = wke.unmodifiedText[0] =
37 static_cast<unsigned short>(gdk_keyval_to_unicode(
38 ui::GdkKeyCodeForWindowsKeyCode(key_event.key_code(),
39 key_event.IsShiftDown() ^ key_event.IsCapsLockDown())));
40
41 // Due to a bug in GDK, gdk_keyval_to_unicode(keyval) returns 0 if keyval
42 // is GDK_Return. It should instead return '\r'. This is causing
43 // http://code.google.com/p/chromium/issues/detail?id=75779
44 // Hence, the ugly hack below.
45 // TODO(varunjain): remove the hack when the GDK bug
46 // https://bugzilla.gnome.org/show_bug.cgi?id=644836 gets sorted out.
47 if (key_event.key_code() == ui::VKEY_RETURN) {
48 wke.text[0] = wke.unmodifiedText[0] = '\r';
49 }
50
51 return wke;
52 #else
53 return NativeWebKeyboardEvent(key_event.gdk_event()); 23 return NativeWebKeyboardEvent(key_event.gdk_event());
54 #endif
55 } 24 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/dialog_stubs_gtk.cc ('k') | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698