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/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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 // Not used. | 443 // Not used. |
444 return -1; | 444 return -1; |
445 } | 445 } |
446 | 446 |
447 gfx::Font AutocompleteEditViewGtk::GetFont() { | 447 gfx::Font AutocompleteEditViewGtk::GetFont() { |
448 GtkRcStyle* rc_style = gtk_widget_get_modifier_style(text_view_); | 448 GtkRcStyle* rc_style = gtk_widget_get_modifier_style(text_view_); |
449 return gfx::Font((rc_style && rc_style->font_desc) ? | 449 return gfx::Font((rc_style && rc_style->font_desc) ? |
450 rc_style->font_desc : text_view_->style->font_desc); | 450 rc_style->font_desc : text_view_->style->font_desc); |
451 } | 451 } |
452 | 452 |
| 453 AutocompleteEditModel* AutocompleteEditViewGtk::model() { |
| 454 return model_.get(); |
| 455 } |
| 456 |
| 457 const AutocompleteEditModel* AutocompleteEditViewGtk::model() const { |
| 458 return model_.get(); |
| 459 } |
| 460 |
453 void AutocompleteEditViewGtk::SaveStateToTab(TabContents* tab) { | 461 void AutocompleteEditViewGtk::SaveStateToTab(TabContents* tab) { |
454 DCHECK(tab); | 462 DCHECK(tab); |
455 // If any text has been selected, register it as the PRIMARY selection so it | 463 // If any text has been selected, register it as the PRIMARY selection so it |
456 // can still be pasted via middle-click after the text view is cleared. | 464 // can still be pasted via middle-click after the text view is cleared. |
457 if (!selected_text_.empty()) | 465 if (!selected_text_.empty()) |
458 SavePrimarySelection(selected_text_); | 466 SavePrimarySelection(selected_text_); |
459 // NOTE: GetStateForTabSwitch may affect GetSelection, so order is important. | 467 // NOTE: GetStateForTabSwitch may affect GetSelection, so order is important. |
460 AutocompleteEditModel::State model_state = model_->GetStateForTabSwitch(); | 468 AutocompleteEditModel::State model_state = model_->GetStateForTabSwitch(); |
461 GetStateAccessor()->SetProperty( | 469 GetStateAccessor()->SetProperty( |
462 tab->property_bag(), | 470 tab->property_bag(), |
(...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2064 // baseline, so we need to move the |instant_view_| down to make sure it | 2072 // baseline, so we need to move the |instant_view_| down to make sure it |
2065 // has the same baseline as the |text_view_|. | 2073 // has the same baseline as the |text_view_|. |
2066 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); | 2074 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); |
2067 int height; | 2075 int height; |
2068 pango_layout_get_size(layout, NULL, &height); | 2076 pango_layout_get_size(layout, NULL, &height); |
2069 PangoLayoutIter* iter = pango_layout_get_iter(layout); | 2077 PangoLayoutIter* iter = pango_layout_get_iter(layout); |
2070 int baseline = pango_layout_iter_get_baseline(iter); | 2078 int baseline = pango_layout_iter_get_baseline(iter); |
2071 pango_layout_iter_free(iter); | 2079 pango_layout_iter_free(iter); |
2072 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); | 2080 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); |
2073 } | 2081 } |
OLD | NEW |