| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/find_bar_gtk.h" | 5 #include "chrome/browser/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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 slide_widget_->IsShowing(); | 550 slide_widget_->IsShowing(); |
| 551 } | 551 } |
| 552 return true; | 552 return true; |
| 553 } | 553 } |
| 554 | 554 |
| 555 string16 FindBarGtk::GetFindText() { | 555 string16 FindBarGtk::GetFindText() { |
| 556 std::string contents(gtk_entry_get_text(GTK_ENTRY(text_entry_))); | 556 std::string contents(gtk_entry_get_text(GTK_ENTRY(text_entry_))); |
| 557 return UTF8ToUTF16(contents); | 557 return UTF8ToUTF16(contents); |
| 558 } | 558 } |
| 559 | 559 |
| 560 string16 FindBarGtk::GetFindSelectedText() { |
| 561 gint cursor_pos; |
| 562 gint selection_bound; |
| 563 g_object_get(G_OBJECT(text_entry_), "cursor-position", &cursor_pos, |
| 564 NULL); |
| 565 g_object_get(G_OBJECT(text_entry_), "selection-bound", &selection_bound, |
| 566 NULL); |
| 567 std::string contents(gtk_entry_get_text(GTK_ENTRY(text_entry_))); |
| 568 return UTF8ToUTF16(contents.substr(cursor_pos, selection_bound)); |
| 569 } |
| 570 |
| 560 string16 FindBarGtk::GetMatchCountText() { | 571 string16 FindBarGtk::GetMatchCountText() { |
| 561 std::string contents(gtk_label_get_text(GTK_LABEL(match_count_label_))); | 572 std::string contents(gtk_label_get_text(GTK_LABEL(match_count_label_))); |
| 562 return UTF8ToUTF16(contents); | 573 return UTF8ToUTF16(contents); |
| 563 } | 574 } |
| 564 | 575 |
| 565 void FindBarGtk::FindEntryTextInContents(bool forward_search) { | 576 void FindBarGtk::FindEntryTextInContents(bool forward_search) { |
| 566 TabContents* tab_contents = find_bar_controller_->tab_contents(); | 577 TabContents* tab_contents = find_bar_controller_->tab_contents(); |
| 567 if (!tab_contents) | 578 if (!tab_contents) |
| 568 return; | 579 return; |
| 569 | 580 |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 | 983 |
| 973 // static | 984 // static |
| 974 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event, | 985 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event, |
| 975 FindBarGtk* find_bar) { | 986 FindBarGtk* find_bar) { |
| 976 g_signal_handlers_disconnect_by_func( | 987 g_signal_handlers_disconnect_by_func( |
| 977 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), | 988 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), |
| 978 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), find_bar); | 989 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), find_bar); |
| 979 | 990 |
| 980 return FALSE; // Continue propagation. | 991 return FALSE; // Continue propagation. |
| 981 } | 992 } |
| OLD | NEW |