OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/omnibox/omnibox_view_gtk.h" | 5 #include "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 enter_was_inserted_(false), | 204 enter_was_inserted_(false), |
205 selection_suggested_(false), | 205 selection_suggested_(false), |
206 delete_was_pressed_(false), | 206 delete_was_pressed_(false), |
207 delete_at_end_pressed_(false), | 207 delete_at_end_pressed_(false), |
208 handling_key_press_(false), | 208 handling_key_press_(false), |
209 content_maybe_changed_by_key_press_(false), | 209 content_maybe_changed_by_key_press_(false), |
210 update_popup_without_focus_(false), | 210 update_popup_without_focus_(false), |
211 supports_pre_edit_(!gtk_check_version(2, 20, 0)), | 211 supports_pre_edit_(!gtk_check_version(2, 20, 0)), |
212 pre_edit_size_before_change_(0), | 212 pre_edit_size_before_change_(0), |
213 going_to_focus_(NULL) { | 213 going_to_focus_(NULL) { |
214 popup_view_.reset( | 214 OmniboxPopupViewGtk* view = new OmniboxPopupViewGtk( |
215 new OmniboxPopupViewGtk | 215 GetFont(), this, model(), location_bar); |
216 (GetFont(), this, model(), location_bar)); | 216 view->Init(); |
| 217 popup_view_.reset(view); |
217 } | 218 } |
218 | 219 |
219 OmniboxViewGtk::~OmniboxViewGtk() { | 220 OmniboxViewGtk::~OmniboxViewGtk() { |
220 // Explicitly teardown members which have a reference to us. Just to be safe | 221 // Explicitly teardown members which have a reference to us. Just to be safe |
221 // we want them to be destroyed before destroying any other internal state. | 222 // we want them to be destroyed before destroying any other internal state. |
222 popup_view_.reset(); | 223 popup_view_.reset(); |
223 | 224 |
224 // We own our widget and TextView related objects. | 225 // We own our widget and TextView related objects. |
225 if (alignment_.get()) { // Init() has been called. | 226 if (alignment_.get()) { // Init() has been called. |
226 alignment_.Destroy(); | 227 alignment_.Destroy(); |
(...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2135 void OmniboxViewGtk::AdjustVerticalAlignmentOfGrayTextView() { | 2136 void OmniboxViewGtk::AdjustVerticalAlignmentOfGrayTextView() { |
2136 // By default, GtkTextView layouts an anchored child widget just above the | 2137 // By default, GtkTextView layouts an anchored child widget just above the |
2137 // baseline, so we need to move the |gray_text_view_| down to make sure it | 2138 // baseline, so we need to move the |gray_text_view_| down to make sure it |
2138 // has the same baseline as the |text_view_|. | 2139 // has the same baseline as the |text_view_|. |
2139 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(gray_text_view_)); | 2140 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(gray_text_view_)); |
2140 int height; | 2141 int height; |
2141 pango_layout_get_size(layout, NULL, &height); | 2142 pango_layout_get_size(layout, NULL, &height); |
2142 int baseline = pango_layout_get_baseline(layout); | 2143 int baseline = pango_layout_get_baseline(layout); |
2143 g_object_set(gray_text_anchor_tag_, "rise", baseline - height, NULL); | 2144 g_object_set(gray_text_anchor_tag_, "rise", baseline - height, NULL); |
2144 } | 2145 } |
OLD | NEW |