Chromium Code Reviews| 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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 571 NULL); | 571 NULL); |
| 572 std::string contents(gtk_entry_get_text(GTK_ENTRY(text_entry_))); | 572 std::string contents(gtk_entry_get_text(GTK_ENTRY(text_entry_))); |
| 573 return UTF8ToUTF16(contents.substr(cursor_pos, selection_bound)); | 573 return UTF8ToUTF16(contents.substr(cursor_pos, selection_bound)); |
| 574 } | 574 } |
| 575 | 575 |
| 576 string16 FindBarGtk::GetMatchCountText() { | 576 string16 FindBarGtk::GetMatchCountText() { |
| 577 std::string contents(gtk_label_get_text(GTK_LABEL(match_count_label_))); | 577 std::string contents(gtk_label_get_text(GTK_LABEL(match_count_label_))); |
| 578 return UTF8ToUTF16(contents); | 578 return UTF8ToUTF16(contents); |
| 579 } | 579 } |
| 580 | 580 |
| 581 int FindBarGtk::GetWidth() { | |
| 582 GtkAllocation allocation; | |
| 583 gtk_widget_get_allocation(container_, &allocation); | |
|
Evan Stade
2011/05/25 18:18:10
I'd just use container_->allocation.width, we use
jennb
2011/05/25 19:02:41
Done.
| |
| 584 return allocation.width; | |
| 585 } | |
| 586 | |
| 581 void FindBarGtk::FindEntryTextInContents(bool forward_search) { | 587 void FindBarGtk::FindEntryTextInContents(bool forward_search) { |
| 582 TabContentsWrapper* tab_contents = find_bar_controller_->tab_contents(); | 588 TabContentsWrapper* tab_contents = find_bar_controller_->tab_contents(); |
| 583 if (!tab_contents) | 589 if (!tab_contents) |
| 584 return; | 590 return; |
| 585 FindTabHelper* find_tab_helper = tab_contents->find_tab_helper(); | 591 FindTabHelper* find_tab_helper = tab_contents->find_tab_helper(); |
| 586 | 592 |
| 587 std::string new_contents(gtk_entry_get_text(GTK_ENTRY(text_entry_))); | 593 std::string new_contents(gtk_entry_get_text(GTK_ENTRY(text_entry_))); |
| 588 | 594 |
| 589 if (new_contents.length() > 0) { | 595 if (new_contents.length() > 0) { |
| 590 find_tab_helper->StartFinding(UTF8ToUTF16(new_contents), forward_search, | 596 find_tab_helper->StartFinding(UTF8ToUTF16(new_contents), forward_search, |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 986 | 992 |
| 987 // static | 993 // static |
| 988 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event, | 994 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event, |
| 989 FindBarGtk* find_bar) { | 995 FindBarGtk* find_bar) { |
| 990 g_signal_handlers_disconnect_by_func( | 996 g_signal_handlers_disconnect_by_func( |
| 991 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), | 997 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), |
| 992 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), find_bar); | 998 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), find_bar); |
| 993 | 999 |
| 994 return FALSE; // Continue propagation. | 1000 return FALSE; // Continue propagation. |
| 995 } | 1001 } |
| OLD | NEW |