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_popup_view_gtk.h" | 5 #include "chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 } | 263 } |
264 | 264 |
265 pango_layout_set_text(layout, text_utf8.data(), text_utf8.length()); | 265 pango_layout_set_text(layout, text_utf8.data(), text_utf8.length()); |
266 pango_layout_set_attributes(layout, attrs); // Ref taken. | 266 pango_layout_set_attributes(layout, attrs); // Ref taken. |
267 pango_attr_list_unref(attrs); | 267 pango_attr_list_unref(attrs); |
268 } | 268 } |
269 | 269 |
270 OmniboxPopupViewGtk::OmniboxPopupViewGtk(const gfx::Font& font, | 270 OmniboxPopupViewGtk::OmniboxPopupViewGtk(const gfx::Font& font, |
271 OmniboxView* omnibox_view, | 271 OmniboxView* omnibox_view, |
272 AutocompleteEditModel* edit_model, | 272 AutocompleteEditModel* edit_model, |
273 Profile* profile, | |
274 GtkWidget* location_bar) | 273 GtkWidget* location_bar) |
275 : model_(new AutocompletePopupModel(this, edit_model, profile)), | 274 : model_(new AutocompletePopupModel(this, edit_model)), |
276 omnibox_view_(omnibox_view), | 275 omnibox_view_(omnibox_view), |
277 location_bar_(location_bar), | 276 location_bar_(location_bar), |
278 window_(gtk_window_new(GTK_WINDOW_POPUP)), | 277 window_(gtk_window_new(GTK_WINDOW_POPUP)), |
279 layout_(NULL), | 278 layout_(NULL), |
280 theme_service_(GtkThemeService::GetFrom(profile)), | 279 theme_service_(GtkThemeService::GetFrom(edit_model->profile())), |
281 font_(font.DeriveFont(kEditFontAdjust)), | 280 font_(font.DeriveFont(kEditFontAdjust)), |
282 ignore_mouse_drag_(false), | 281 ignore_mouse_drag_(false), |
283 opened_(false) { | 282 opened_(false) { |
284 gtk_widget_set_can_focus(window_, FALSE); | 283 gtk_widget_set_can_focus(window_, FALSE); |
285 // Don't allow the window to be resized. This also forces the window to | 284 // Don't allow the window to be resized. This also forces the window to |
286 // shrink down to the size of its child contents. | 285 // shrink down to the size of its child contents. |
287 gtk_window_set_resizable(GTK_WINDOW(window_), FALSE); | 286 gtk_window_set_resizable(GTK_WINDOW(window_), FALSE); |
288 gtk_widget_set_app_paintable(window_, TRUE); | 287 gtk_widget_set_app_paintable(window_, TRUE); |
289 // Have GTK double buffer around the expose signal. | 288 // Have GTK double buffer around the expose signal. |
290 gtk_widget_set_double_buffered(window_, TRUE); | 289 gtk_widget_set_double_buffered(window_, TRUE); |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 (text_width - actual_content_width - | 680 (text_width - actual_content_width - |
682 (actual_description_width / PANGO_SCALE)), | 681 (actual_description_width / PANGO_SCALE)), |
683 content_y, layout_); | 682 content_y, layout_); |
684 } | 683 } |
685 } | 684 } |
686 | 685 |
687 g_object_unref(gc); | 686 g_object_unref(gc); |
688 | 687 |
689 return TRUE; | 688 return TRUE; |
690 } | 689 } |
OLD | NEW |