| 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 NULL); | 566 NULL); |
| 567 std::string contents(gtk_entry_get_text(GTK_ENTRY(text_entry_))); | 567 std::string contents(gtk_entry_get_text(GTK_ENTRY(text_entry_))); |
| 568 return UTF8ToUTF16(contents.substr(cursor_pos, selection_bound)); | 568 return UTF8ToUTF16(contents.substr(cursor_pos, selection_bound)); |
| 569 } | 569 } |
| 570 | 570 |
| 571 string16 FindBarGtk::GetMatchCountText() { | 571 string16 FindBarGtk::GetMatchCountText() { |
| 572 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_))); |
| 573 return UTF8ToUTF16(contents); | 573 return UTF8ToUTF16(contents); |
| 574 } | 574 } |
| 575 | 575 |
| 576 int FindBarGtk::GetWidth() { |
| 577 return container_->allocation.width; |
| 578 } |
| 579 |
| 576 void FindBarGtk::FindEntryTextInContents(bool forward_search) { | 580 void FindBarGtk::FindEntryTextInContents(bool forward_search) { |
| 577 TabContentsWrapper* tab_contents = find_bar_controller_->tab_contents(); | 581 TabContentsWrapper* tab_contents = find_bar_controller_->tab_contents(); |
| 578 if (!tab_contents) | 582 if (!tab_contents) |
| 579 return; | 583 return; |
| 580 FindTabHelper* find_tab_helper = tab_contents->find_tab_helper(); | 584 FindTabHelper* find_tab_helper = tab_contents->find_tab_helper(); |
| 581 | 585 |
| 582 std::string new_contents(gtk_entry_get_text(GTK_ENTRY(text_entry_))); | 586 std::string new_contents(gtk_entry_get_text(GTK_ENTRY(text_entry_))); |
| 583 | 587 |
| 584 if (new_contents.length() > 0) { | 588 if (new_contents.length() > 0) { |
| 585 find_tab_helper->StartFinding(UTF8ToUTF16(new_contents), forward_search, | 589 find_tab_helper->StartFinding(UTF8ToUTF16(new_contents), forward_search, |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 | 981 |
| 978 // static | 982 // static |
| 979 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event, | 983 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event, |
| 980 FindBarGtk* find_bar) { | 984 FindBarGtk* find_bar) { |
| 981 g_signal_handlers_disconnect_by_func( | 985 g_signal_handlers_disconnect_by_func( |
| 982 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), | 986 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), |
| 983 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), find_bar); | 987 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), find_bar); |
| 984 | 988 |
| 985 return FALSE; // Continue propagation. | 989 return FALSE; // Continue propagation. |
| 986 } | 990 } |
| OLD | NEW |