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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "app/l10n_util.h" | 13 #include "app/l10n_util.h" |
14 #include "app/resource_bundle.h" | 14 #include "app/resource_bundle.h" |
15 #include "base/i18n/rtl.h" | 15 #include "base/i18n/rtl.h" |
| 16 #include "base/string_number_conversions.h" |
16 #include "base/string_util.h" | 17 #include "base/string_util.h" |
17 #include "chrome/browser/browser.h" | 18 #include "chrome/browser/browser.h" |
18 #include "chrome/browser/find_bar_controller.h" | 19 #include "chrome/browser/find_bar_controller.h" |
19 #include "chrome/browser/find_bar_state.h" | 20 #include "chrome/browser/find_bar_state.h" |
20 #include "chrome/browser/gtk/browser_window_gtk.h" | 21 #include "chrome/browser/gtk/browser_window_gtk.h" |
21 #include "chrome/browser/gtk/cairo_cached_surface.h" | 22 #include "chrome/browser/gtk/cairo_cached_surface.h" |
22 #include "chrome/browser/gtk/custom_button.h" | 23 #include "chrome/browser/gtk/custom_button.h" |
23 #include "chrome/browser/gtk/gtk_floating_container.h" | 24 #include "chrome/browser/gtk/gtk_floating_container.h" |
24 #include "chrome/browser/gtk/gtk_theme_provider.h" | 25 #include "chrome/browser/gtk/gtk_theme_provider.h" |
25 #include "chrome/browser/gtk/gtk_util.h" | 26 #include "chrome/browser/gtk/gtk_util.h" |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 378 |
378 std::string entry_text(gtk_entry_get_text(GTK_ENTRY(text_entry_))); | 379 std::string entry_text(gtk_entry_get_text(GTK_ENTRY(text_entry_))); |
379 if (entry_text != find_text_utf8) { | 380 if (entry_text != find_text_utf8) { |
380 SetFindText(find_text); | 381 SetFindText(find_text); |
381 gtk_entry_select_region(GTK_ENTRY(text_entry_), 0, -1); | 382 gtk_entry_select_region(GTK_ENTRY(text_entry_), 0, -1); |
382 } | 383 } |
383 | 384 |
384 if (!find_text.empty() && have_valid_range) { | 385 if (!find_text.empty() && have_valid_range) { |
385 gtk_label_set_text(GTK_LABEL(match_count_label_), | 386 gtk_label_set_text(GTK_LABEL(match_count_label_), |
386 l10n_util::GetStringFUTF8(IDS_FIND_IN_PAGE_COUNT, | 387 l10n_util::GetStringFUTF8(IDS_FIND_IN_PAGE_COUNT, |
387 IntToString16(result.active_match_ordinal()), | 388 base::IntToString16(result.active_match_ordinal()), |
388 IntToString16(result.number_of_matches())).c_str()); | 389 base::IntToString16(result.number_of_matches())).c_str()); |
389 UpdateMatchLabelAppearance(result.number_of_matches() == 0 && | 390 UpdateMatchLabelAppearance(result.number_of_matches() == 0 && |
390 result.final_update()); | 391 result.final_update()); |
391 } else { | 392 } else { |
392 // If there was no text entered, we don't show anything in the result count | 393 // If there was no text entered, we don't show anything in the result count |
393 // area. | 394 // area. |
394 gtk_label_set_text(GTK_LABEL(match_count_label_), ""); | 395 gtk_label_set_text(GTK_LABEL(match_count_label_), ""); |
395 UpdateMatchLabelAppearance(false); | 396 UpdateMatchLabelAppearance(false); |
396 } | 397 } |
397 } | 398 } |
398 | 399 |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 | 958 |
958 // static | 959 // static |
959 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event, | 960 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event, |
960 FindBarGtk* find_bar) { | 961 FindBarGtk* find_bar) { |
961 g_signal_handlers_disconnect_by_func( | 962 g_signal_handlers_disconnect_by_func( |
962 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), | 963 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), |
963 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), find_bar); | 964 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), find_bar); |
964 | 965 |
965 return FALSE; // Continue propagation. | 966 return FALSE; // Continue propagation. |
966 } | 967 } |
OLD | NEW |