| 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 if (animate) | 335 if (animate) |
| 336 slide_widget_->Close(); | 336 slide_widget_->Close(); |
| 337 else | 337 else |
| 338 slide_widget_->CloseWithoutAnimation(); | 338 slide_widget_->CloseWithoutAnimation(); |
| 339 } | 339 } |
| 340 | 340 |
| 341 void FindBarGtk::SetFocusAndSelection() { | 341 void FindBarGtk::SetFocusAndSelection() { |
| 342 StoreOutsideFocus(); | 342 StoreOutsideFocus(); |
| 343 gtk_widget_grab_focus(text_entry_); | 343 gtk_widget_grab_focus(text_entry_); |
| 344 // Select all the text. | 344 // Select all the text. |
| 345 gtk_entry_select_region(GTK_ENTRY(text_entry_), 0, -1); | 345 gtk_editable_select_region(GTK_EDITABLE(text_entry_), 0, -1); |
| 346 } | 346 } |
| 347 | 347 |
| 348 void FindBarGtk::ClearResults(const FindNotificationDetails& results) { | 348 void FindBarGtk::ClearResults(const FindNotificationDetails& results) { |
| 349 UpdateUIForFindResult(results, string16()); | 349 UpdateUIForFindResult(results, string16()); |
| 350 } | 350 } |
| 351 | 351 |
| 352 void FindBarGtk::StopAnimation() { | 352 void FindBarGtk::StopAnimation() { |
| 353 slide_widget_->End(); | 353 slide_widget_->End(); |
| 354 } | 354 } |
| 355 | 355 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 384 if (result.number_of_matches() > 0) | 384 if (result.number_of_matches() > 0) |
| 385 focus_store_.Store(NULL); | 385 focus_store_.Store(NULL); |
| 386 | 386 |
| 387 std::string find_text_utf8 = UTF16ToUTF8(find_text); | 387 std::string find_text_utf8 = UTF16ToUTF8(find_text); |
| 388 bool have_valid_range = | 388 bool have_valid_range = |
| 389 result.number_of_matches() != -1 && result.active_match_ordinal() != -1; | 389 result.number_of_matches() != -1 && result.active_match_ordinal() != -1; |
| 390 | 390 |
| 391 std::string entry_text(gtk_entry_get_text(GTK_ENTRY(text_entry_))); | 391 std::string entry_text(gtk_entry_get_text(GTK_ENTRY(text_entry_))); |
| 392 if (entry_text != find_text_utf8) { | 392 if (entry_text != find_text_utf8) { |
| 393 SetFindText(find_text); | 393 SetFindText(find_text); |
| 394 gtk_entry_select_region(GTK_ENTRY(text_entry_), 0, -1); | 394 gtk_editable_select_region(GTK_EDITABLE(text_entry_), 0, -1); |
| 395 } | 395 } |
| 396 | 396 |
| 397 if (!find_text.empty() && have_valid_range) { | 397 if (!find_text.empty() && have_valid_range) { |
| 398 gtk_label_set_text(GTK_LABEL(match_count_label_), | 398 gtk_label_set_text(GTK_LABEL(match_count_label_), |
| 399 l10n_util::GetStringFUTF8(IDS_FIND_IN_PAGE_COUNT, | 399 l10n_util::GetStringFUTF8(IDS_FIND_IN_PAGE_COUNT, |
| 400 base::IntToString16(result.active_match_ordinal()), | 400 base::IntToString16(result.active_match_ordinal()), |
| 401 base::IntToString16(result.number_of_matches())).c_str()); | 401 base::IntToString16(result.number_of_matches())).c_str()); |
| 402 UpdateMatchLabelAppearance(result.number_of_matches() == 0 && | 402 UpdateMatchLabelAppearance(result.number_of_matches() == 0 && |
| 403 result.final_update()); | 403 result.final_update()); |
| 404 } else { | 404 } else { |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 return FALSE; // Continue propagation. | 982 return FALSE; // Continue propagation. |
| 983 } | 983 } |
| 984 | 984 |
| 985 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event) { | 985 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event) { |
| 986 g_signal_handlers_disconnect_by_func( | 986 g_signal_handlers_disconnect_by_func( |
| 987 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), | 987 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), |
| 988 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), this); | 988 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), this); |
| 989 | 989 |
| 990 return FALSE; // Continue propagation. | 990 return FALSE; // Continue propagation. |
| 991 } | 991 } |
| OLD | NEW |