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/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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 #if GTK_CHECK_VERSION(2, 20, 0) | 202 #if GTK_CHECK_VERSION(2, 20, 0) |
203 pre_edit_size_before_change_(0), | 203 pre_edit_size_before_change_(0), |
204 #endif | 204 #endif |
205 going_to_focus_(NULL) { | 205 going_to_focus_(NULL) { |
206 popup_view_.reset( | 206 popup_view_.reset( |
207 #if defined(TOOLKIT_VIEWS) | 207 #if defined(TOOLKIT_VIEWS) |
208 new AutocompletePopupContentsView | 208 new AutocompletePopupContentsView |
209 #else | 209 #else |
210 new OmniboxPopupViewGtk | 210 new OmniboxPopupViewGtk |
211 #endif | 211 #endif |
212 (GetFont(), this, model_.get(), profile, location_bar)); | 212 (GetFont(), this, model_.get(), location_bar)); |
213 } | 213 } |
214 | 214 |
215 OmniboxViewGtk::~OmniboxViewGtk() { | 215 OmniboxViewGtk::~OmniboxViewGtk() { |
216 // Explicitly teardown members which have a reference to us. Just to be safe | 216 // Explicitly teardown members which have a reference to us. Just to be safe |
217 // we want them to be destroyed before destroying any other internal state. | 217 // we want them to be destroyed before destroying any other internal state. |
218 popup_view_.reset(); | 218 popup_view_.reset(); |
219 model_.reset(); | 219 model_.reset(); |
220 | 220 |
221 // We own our widget and TextView related objects. | 221 // We own our widget and TextView related objects. |
222 if (alignment_.get()) { // Init() has been called. | 222 if (alignment_.get()) { // Init() has been called. |
(...skipping 2106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2329 // baseline, so we need to move the |instant_view_| down to make sure it | 2329 // baseline, so we need to move the |instant_view_| down to make sure it |
2330 // has the same baseline as the |text_view_|. | 2330 // has the same baseline as the |text_view_|. |
2331 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); | 2331 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); |
2332 int height; | 2332 int height; |
2333 pango_layout_get_size(layout, NULL, &height); | 2333 pango_layout_get_size(layout, NULL, &height); |
2334 PangoLayoutIter* iter = pango_layout_get_iter(layout); | 2334 PangoLayoutIter* iter = pango_layout_get_iter(layout); |
2335 int baseline = pango_layout_iter_get_baseline(iter); | 2335 int baseline = pango_layout_iter_get_baseline(iter); |
2336 pango_layout_iter_free(iter); | 2336 pango_layout_iter_free(iter); |
2337 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); | 2337 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); |
2338 } | 2338 } |
OLD | NEW |