| OLD | NEW |
| 1 // Copyright (c) 2010 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/autocomplete/autocomplete_edit_view_gtk.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> |
| 7 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 8 #include <gdk/gdkkeysyms.h> | |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 | 11 |
| 12 #include "app/l10n_util.h" | 12 #include "app/l10n_util.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "chrome/app/chrome_command_ids.h" | 16 #include "chrome/app/chrome_command_ids.h" |
| 17 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 17 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
| 18 #include "chrome/browser/autocomplete/autocomplete_match.h" | 18 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 19 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 19 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| 20 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 20 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
| 21 #include "chrome/browser/command_updater.h" | 21 #include "chrome/browser/command_updater.h" |
| 22 #include "chrome/browser/defaults.h" | 22 #include "chrome/browser/defaults.h" |
| 23 #include "chrome/browser/gtk/gtk_util.h" | |
| 24 #include "chrome/browser/gtk/view_id_util.h" | |
| 25 #include "chrome/browser/instant/instant_controller.h" | 23 #include "chrome/browser/instant/instant_controller.h" |
| 26 #include "chrome/browser/platform_util.h" | 24 #include "chrome/browser/platform_util.h" |
| 27 #include "chrome/browser/tab_contents/tab_contents.h" | 25 #include "chrome/browser/tab_contents/tab_contents.h" |
| 26 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 27 #include "chrome/browser/ui/gtk/view_id_util.h" |
| 28 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 28 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
| 29 #include "chrome/common/notification_service.h" | 29 #include "chrome/common/notification_service.h" |
| 30 #include "gfx/color_utils.h" | 30 #include "gfx/color_utils.h" |
| 31 #include "gfx/font.h" | 31 #include "gfx/font.h" |
| 32 #include "gfx/gtk_util.h" | 32 #include "gfx/gtk_util.h" |
| 33 #include "gfx/skia_utils_gtk.h" | 33 #include "gfx/skia_utils_gtk.h" |
| 34 #include "googleurl/src/gurl.h" | 34 #include "googleurl/src/gurl.h" |
| 35 #include "grit/generated_resources.h" | 35 #include "grit/generated_resources.h" |
| 36 #include "net/base/escape.h" | 36 #include "net/base/escape.h" |
| 37 #include "third_party/undoview/undo_view.h" | 37 #include "third_party/undoview/undo_view.h" |
| 38 #include "ui/base/animation/multi_animation.h" | 38 #include "ui/base/animation/multi_animation.h" |
| 39 | 39 |
| 40 #if defined(TOOLKIT_VIEWS) | 40 #if defined(TOOLKIT_VIEWS) |
| 41 #include "chrome/browser/gtk/accessible_widget_helper_gtk.h" | 41 #include "chrome/browser/ui/gtk/accessible_widget_helper_gtk.h" |
| 42 #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.
h" | 42 #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.
h" |
| 43 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 43 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 44 #else | 44 #else |
| 45 #include "chrome/browser/autocomplete/autocomplete_popup_view_gtk.h" | 45 #include "chrome/browser/autocomplete/autocomplete_popup_view_gtk.h" |
| 46 #include "chrome/browser/gtk/gtk_theme_provider.h" | 46 #include "chrome/browser/ui/gtk/gtk_theme_provider.h" |
| 47 #include "chrome/browser/gtk/location_bar_view_gtk.h" | 47 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" |
| 48 #include "views/controls/native/native_view_host.h" | 48 #include "views/controls/native/native_view_host.h" |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 namespace { | 51 namespace { |
| 52 | 52 |
| 53 const gchar* kAutocompleteEditViewGtkKey = "__ACE_VIEW_GTK__"; | 53 const gchar* kAutocompleteEditViewGtkKey = "__ACE_VIEW_GTK__"; |
| 54 | 54 |
| 55 const char kTextBaseColor[] = "#808080"; | 55 const char kTextBaseColor[] = "#808080"; |
| 56 const char kSecureSchemeColor[] = "#079500"; | 56 const char kSecureSchemeColor[] = "#079500"; |
| 57 const char kSecurityErrorSchemeColor[] = "#a20000"; | 57 const char kSecurityErrorSchemeColor[] = "#a20000"; |
| (...skipping 2153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2211 // baseline, so we need to move the |instant_view_| down to make sure it | 2211 // baseline, so we need to move the |instant_view_| down to make sure it |
| 2212 // has the same baseline as the |text_view_|. | 2212 // has the same baseline as the |text_view_|. |
| 2213 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); | 2213 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); |
| 2214 int height; | 2214 int height; |
| 2215 pango_layout_get_size(layout, NULL, &height); | 2215 pango_layout_get_size(layout, NULL, &height); |
| 2216 PangoLayoutIter* iter = pango_layout_get_iter(layout); | 2216 PangoLayoutIter* iter = pango_layout_get_iter(layout); |
| 2217 int baseline = pango_layout_iter_get_baseline(iter); | 2217 int baseline = pango_layout_iter_get_baseline(iter); |
| 2218 pango_layout_iter_free(iter); | 2218 pango_layout_iter_free(iter); |
| 2219 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); | 2219 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); |
| 2220 } | 2220 } |
| OLD | NEW |