| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/autocomplete/autocomplete_edit_view_gtk.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 // TODO(deanm): Some keyword hit business, etc here. | 789 // TODO(deanm): Some keyword hit business, etc here. |
| 790 | 790 |
| 791 return FALSE; // Continue propagation. | 791 return FALSE; // Continue propagation. |
| 792 } | 792 } |
| 793 | 793 |
| 794 gboolean AutocompleteEditViewGtk::HandleViewFocusOut() { | 794 gboolean AutocompleteEditViewGtk::HandleViewFocusOut() { |
| 795 // Close the popup. | 795 // Close the popup. |
| 796 ClosePopup(); | 796 ClosePopup(); |
| 797 // Tell the model to reset itself. | 797 // Tell the model to reset itself. |
| 798 model_->OnKillFocus(); | 798 model_->OnKillFocus(); |
| 799 controller_->OnKillFocus(); |
| 799 return FALSE; // Pass the event on to the GtkTextView. | 800 return FALSE; // Pass the event on to the GtkTextView. |
| 800 } | 801 } |
| 801 | 802 |
| 802 void AutocompleteEditViewGtk::HandleViewMoveCursor( | 803 void AutocompleteEditViewGtk::HandleViewMoveCursor( |
| 803 GtkMovementStep step, | 804 GtkMovementStep step, |
| 804 gint count, | 805 gint count, |
| 805 gboolean extend_selection) { | 806 gboolean extend_selection) { |
| 806 GtkTextIter sel_start, sel_end; | 807 GtkTextIter sel_start, sel_end; |
| 807 gboolean has_selection = | 808 gboolean has_selection = |
| 808 gtk_text_buffer_get_selection_bounds(text_buffer_, &sel_start, &sel_end); | 809 gtk_text_buffer_get_selection_bounds(text_buffer_, &sel_start, &sel_end); |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 std::string utf8 = WideToUTF8(text); | 1282 std::string utf8 = WideToUTF8(text); |
| 1282 gtk_text_buffer_set_text(text_buffer_, utf8.data(), utf8.length()); | 1283 gtk_text_buffer_set_text(text_buffer_, utf8.data(), utf8.length()); |
| 1283 SetSelectedRange(range); | 1284 SetSelectedRange(range); |
| 1284 } | 1285 } |
| 1285 | 1286 |
| 1286 void AutocompleteEditViewGtk::SetSelectedRange(const CharRange& range) { | 1287 void AutocompleteEditViewGtk::SetSelectedRange(const CharRange& range) { |
| 1287 GtkTextIter insert, bound; | 1288 GtkTextIter insert, bound; |
| 1288 ItersFromCharRange(range, &bound, &insert); | 1289 ItersFromCharRange(range, &bound, &insert); |
| 1289 gtk_text_buffer_select_range(text_buffer_, &insert, &bound); | 1290 gtk_text_buffer_select_range(text_buffer_, &insert, &bound); |
| 1290 } | 1291 } |
| OLD | NEW |