OLD | NEW |
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/gtk/find_bar_gtk.h" | 5 #include "chrome/browser/ui/gtk/find_bar_gtk.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "chrome/browser/ui/gtk/slide_animator_gtk.h" | 29 #include "chrome/browser/ui/gtk/slide_animator_gtk.h" |
30 #include "chrome/browser/ui/gtk/tab_contents_container_gtk.h" | 30 #include "chrome/browser/ui/gtk/tab_contents_container_gtk.h" |
31 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" | 31 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" |
32 #include "chrome/browser/ui/gtk/view_id_util.h" | 32 #include "chrome/browser/ui/gtk/view_id_util.h" |
33 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 33 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
34 #include "chrome/common/chrome_notification_types.h" | 34 #include "chrome/common/chrome_notification_types.h" |
35 #include "content/browser/renderer_host/render_view_host.h" | 35 #include "content/browser/renderer_host/render_view_host.h" |
36 #include "content/browser/tab_contents/tab_contents.h" | 36 #include "content/browser/tab_contents/tab_contents.h" |
37 #include "content/common/native_web_keyboard_event.h" | 37 #include "content/common/native_web_keyboard_event.h" |
38 #include "content/common/notification_service.h" | 38 #include "content/common/notification_service.h" |
39 #include "content/common/view_messages.h" | |
40 #include "grit/generated_resources.h" | 39 #include "grit/generated_resources.h" |
41 #include "grit/theme_resources.h" | 40 #include "grit/theme_resources.h" |
42 #include "grit/theme_resources_standard.h" | 41 #include "grit/theme_resources_standard.h" |
43 #include "ui/base/gtk/gtk_floating_container.h" | 42 #include "ui/base/gtk/gtk_floating_container.h" |
44 #include "ui/base/gtk/gtk_hig_constants.h" | 43 #include "ui/base/gtk/gtk_hig_constants.h" |
45 #include "ui/base/l10n/l10n_util.h" | 44 #include "ui/base/l10n/l10n_util.h" |
46 #include "ui/base/resource/resource_bundle.h" | 45 #include "ui/base/resource/resource_bundle.h" |
47 | 46 |
48 namespace { | 47 namespace { |
49 | 48 |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 } | 662 } |
664 | 663 |
665 TabContentsWrapper* contents = find_bar_controller_->tab_contents(); | 664 TabContentsWrapper* contents = find_bar_controller_->tab_contents(); |
666 if (!contents) | 665 if (!contents) |
667 return false; | 666 return false; |
668 | 667 |
669 RenderViewHost* render_view_host = contents->render_view_host(); | 668 RenderViewHost* render_view_host = contents->render_view_host(); |
670 | 669 |
671 // Make sure we don't have a text field element interfering with keyboard | 670 // Make sure we don't have a text field element interfering with keyboard |
672 // input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom". | 671 // input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom". |
673 render_view_host->Send( | 672 render_view_host->ClearFocusedNode(); |
674 new ViewMsg_ClearFocusedNode(render_view_host->routing_id())); | |
675 | 673 |
676 NativeWebKeyboardEvent wke(event); | 674 NativeWebKeyboardEvent wke(event); |
677 render_view_host->ForwardKeyboardEvent(wke); | 675 render_view_host->ForwardKeyboardEvent(wke); |
678 return true; | 676 return true; |
679 } | 677 } |
680 | 678 |
681 void FindBarGtk::AdjustTextAlignment() { | 679 void FindBarGtk::AdjustTextAlignment() { |
682 PangoDirection content_dir = | 680 PangoDirection content_dir = |
683 pango_find_base_dir(gtk_entry_get_text(GTK_ENTRY(text_entry_)), -1); | 681 pango_find_base_dir(gtk_entry_get_text(GTK_ENTRY(text_entry_)), -1); |
684 | 682 |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 | 979 |
982 // static | 980 // static |
983 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event, | 981 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event, |
984 FindBarGtk* find_bar) { | 982 FindBarGtk* find_bar) { |
985 g_signal_handlers_disconnect_by_func( | 983 g_signal_handlers_disconnect_by_func( |
986 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), | 984 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), |
987 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), find_bar); | 985 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), find_bar); |
988 | 986 |
989 return FALSE; // Continue propagation. | 987 return FALSE; // Continue propagation. |
990 } | 988 } |
OLD | NEW |