| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_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> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 17 #include "chrome/browser/autocomplete/autocomplete.h" | 17 #include "chrome/browser/autocomplete/autocomplete.h" |
| 18 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 18 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
| 19 #include "chrome/browser/autocomplete/autocomplete_match.h" | 19 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 20 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 20 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| 21 #include "chrome/browser/defaults.h" | 21 #include "chrome/browser/defaults.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/search_engines/template_url.h" | 23 #include "chrome/browser/search_engines/template_url.h" |
| 24 #include "chrome/browser/search_engines/template_url_service.h" | 24 #include "chrome/browser/search_engines/template_url_service.h" |
| 25 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | |
| 26 #include "chrome/browser/ui/gtk/gtk_util.h" | 25 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 26 #include "chrome/browser/ui/gtk/theme_service_gtk.h" |
| 27 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 27 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 28 #include "chrome/common/chrome_notification_types.h" | 28 #include "chrome/common/chrome_notification_types.h" |
| 29 #include "content/public/browser/notification_source.h" | 29 #include "content/public/browser/notification_source.h" |
| 30 #include "grit/theme_resources.h" | 30 #include "grit/theme_resources.h" |
| 31 #include "ui/base/gtk/gtk_compat.h" | 31 #include "ui/base/gtk/gtk_compat.h" |
| 32 #include "ui/base/gtk/gtk_hig_constants.h" | 32 #include "ui/base/gtk/gtk_hig_constants.h" |
| 33 #include "ui/base/gtk/gtk_windowing.h" | 33 #include "ui/base/gtk/gtk_windowing.h" |
| 34 #include "ui/gfx/color_utils.h" | 34 #include "ui/gfx/color_utils.h" |
| 35 #include "ui/gfx/font.h" | 35 #include "ui/gfx/font.h" |
| 36 #include "ui/gfx/gtk_util.h" | 36 #include "ui/gfx/gtk_util.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 273 |
| 274 OmniboxPopupViewGtk::OmniboxPopupViewGtk(const gfx::Font& font, | 274 OmniboxPopupViewGtk::OmniboxPopupViewGtk(const gfx::Font& font, |
| 275 OmniboxView* omnibox_view, | 275 OmniboxView* omnibox_view, |
| 276 AutocompleteEditModel* edit_model, | 276 AutocompleteEditModel* edit_model, |
| 277 GtkWidget* location_bar) | 277 GtkWidget* location_bar) |
| 278 : model_(new AutocompletePopupModel(this, edit_model)), | 278 : model_(new AutocompletePopupModel(this, edit_model)), |
| 279 omnibox_view_(omnibox_view), | 279 omnibox_view_(omnibox_view), |
| 280 location_bar_(location_bar), | 280 location_bar_(location_bar), |
| 281 window_(gtk_window_new(GTK_WINDOW_POPUP)), | 281 window_(gtk_window_new(GTK_WINDOW_POPUP)), |
| 282 layout_(NULL), | 282 layout_(NULL), |
| 283 theme_service_(GtkThemeService::GetFrom(edit_model->profile())), | 283 theme_service_(ThemeServiceGtk::GetFrom(edit_model->profile())), |
| 284 font_(font.DeriveFont(kEditFontAdjust)), | 284 font_(font.DeriveFont(kEditFontAdjust)), |
| 285 ignore_mouse_drag_(false), | 285 ignore_mouse_drag_(false), |
| 286 opened_(false) { | 286 opened_(false) { |
| 287 gtk_widget_set_can_focus(window_, FALSE); | 287 gtk_widget_set_can_focus(window_, FALSE); |
| 288 // Don't allow the window to be resized. This also forces the window to | 288 // Don't allow the window to be resized. This also forces the window to |
| 289 // shrink down to the size of its child contents. | 289 // shrink down to the size of its child contents. |
| 290 gtk_window_set_resizable(GTK_WINDOW(window_), FALSE); | 290 gtk_window_set_resizable(GTK_WINDOW(window_), FALSE); |
| 291 gtk_widget_set_app_paintable(window_, TRUE); | 291 gtk_widget_set_app_paintable(window_, TRUE); |
| 292 // Have GTK double buffer around the expose signal. | 292 // Have GTK double buffer around the expose signal. |
| 293 gtk_widget_set_double_buffered(window_, TRUE); | 293 gtk_widget_set_double_buffered(window_, TRUE); |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 (actual_description_width / PANGO_SCALE)), | 694 (actual_description_width / PANGO_SCALE)), |
| 695 content_y); | 695 content_y); |
| 696 pango_cairo_show_layout(cr, layout_); | 696 pango_cairo_show_layout(cr, layout_); |
| 697 cairo_restore(cr); | 697 cairo_restore(cr); |
| 698 } | 698 } |
| 699 } | 699 } |
| 700 | 700 |
| 701 cairo_destroy(cr); | 701 cairo_destroy(cr); |
| 702 return TRUE; | 702 return TRUE; |
| 703 } | 703 } |
| OLD | NEW |