| 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" |
| 25 #include "chrome/browser/ui/gtk/gtk_util.h" | 26 #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_screen_util.h" | 33 #include "ui/base/gtk/gtk_screen_util.h" |
| 34 #include "ui/base/gtk/gtk_signal_registrar.h" | 34 #include "ui/base/gtk/gtk_signal_registrar.h" |
| 35 #include "ui/base/gtk/gtk_windowing.h" | 35 #include "ui/base/gtk/gtk_windowing.h" |
| 36 #include "ui/gfx/color_utils.h" | 36 #include "ui/gfx/color_utils.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 OmniboxPopupViewGtk::OmniboxPopupViewGtk(const gfx::Font& font, | 276 OmniboxPopupViewGtk::OmniboxPopupViewGtk(const gfx::Font& font, |
| 277 OmniboxView* omnibox_view, | 277 OmniboxView* omnibox_view, |
| 278 AutocompleteEditModel* edit_model, | 278 AutocompleteEditModel* edit_model, |
| 279 GtkWidget* location_bar) | 279 GtkWidget* location_bar) |
| 280 : signal_registrar_(new ui::GtkSignalRegistrar), | 280 : signal_registrar_(new ui::GtkSignalRegistrar), |
| 281 model_(new AutocompletePopupModel(this, edit_model)), | 281 model_(new AutocompletePopupModel(this, edit_model)), |
| 282 omnibox_view_(omnibox_view), | 282 omnibox_view_(omnibox_view), |
| 283 location_bar_(location_bar), | 283 location_bar_(location_bar), |
| 284 window_(gtk_window_new(GTK_WINDOW_POPUP)), | 284 window_(gtk_window_new(GTK_WINDOW_POPUP)), |
| 285 layout_(NULL), | 285 layout_(NULL), |
| 286 theme_service_(ThemeServiceGtk::GetFrom(edit_model->profile())), | 286 theme_service_(GtkThemeService::GetFrom(edit_model->profile())), |
| 287 font_(font.DeriveFont(kEditFontAdjust)), | 287 font_(font.DeriveFont(kEditFontAdjust)), |
| 288 ignore_mouse_drag_(false), | 288 ignore_mouse_drag_(false), |
| 289 opened_(false) { | 289 opened_(false) { |
| 290 gtk_widget_set_can_focus(window_, FALSE); | 290 gtk_widget_set_can_focus(window_, FALSE); |
| 291 // Don't allow the window to be resized. This also forces the window to | 291 // Don't allow the window to be resized. This also forces the window to |
| 292 // shrink down to the size of its child contents. | 292 // shrink down to the size of its child contents. |
| 293 gtk_window_set_resizable(GTK_WINDOW(window_), FALSE); | 293 gtk_window_set_resizable(GTK_WINDOW(window_), FALSE); |
| 294 gtk_widget_set_app_paintable(window_, TRUE); | 294 gtk_widget_set_app_paintable(window_, TRUE); |
| 295 // Have GTK double buffer around the expose signal. | 295 // Have GTK double buffer around the expose signal. |
| 296 gtk_widget_set_double_buffered(window_, TRUE); | 296 gtk_widget_set_double_buffered(window_, TRUE); |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 DrawFullImage(cr, widget, | 741 DrawFullImage(cr, widget, |
| 742 theme_service_->GetImageNamed( | 742 theme_service_->GetImageNamed( |
| 743 is_selected ? IDR_OMNIBOX_TTS_DARK : IDR_OMNIBOX_TTS), | 743 is_selected ? IDR_OMNIBOX_TTS_DARK : IDR_OMNIBOX_TTS), |
| 744 icon_start_x, line_rect.y() + kIconTopPadding); | 744 icon_start_x, line_rect.y() + kIconTopPadding); |
| 745 } | 745 } |
| 746 } | 746 } |
| 747 | 747 |
| 748 cairo_destroy(cr); | 748 cairo_destroy(cr); |
| 749 return TRUE; | 749 return TRUE; |
| 750 } | 750 } |
| OLD | NEW |