| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 g_signal_connect(text_buffer_, "insert-text", | 400 g_signal_connect(text_buffer_, "insert-text", |
| 401 G_CALLBACK(&HandleInsertTextThunk), this); | 401 G_CALLBACK(&HandleInsertTextThunk), this); |
| 402 | 402 |
| 403 AdjustVerticalAlignmentOfInstantView(); | 403 AdjustVerticalAlignmentOfInstantView(); |
| 404 | 404 |
| 405 registrar_.Add(this, | 405 registrar_.Add(this, |
| 406 chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 406 chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
| 407 content::Source<ThemeService>(theme_service_)); | 407 content::Source<ThemeService>(theme_service_)); |
| 408 theme_service_->InitThemesFor(this); | 408 theme_service_->InitThemesFor(this); |
| 409 | 409 |
| 410 ViewIDUtil::SetID(GetNativeView(), VIEW_ID_AUTOCOMPLETE); | 410 ViewIDUtil::SetID(GetNativeView(), VIEW_ID_OMNIBOX); |
| 411 } | 411 } |
| 412 | 412 |
| 413 void OmniboxViewGtk::HandleHierarchyChanged(GtkWidget* sender, | 413 void OmniboxViewGtk::HandleHierarchyChanged(GtkWidget* sender, |
| 414 GtkWidget* old_toplevel) { | 414 GtkWidget* old_toplevel) { |
| 415 GtkWindow* new_toplevel = platform_util::GetTopLevel(sender); | 415 GtkWindow* new_toplevel = platform_util::GetTopLevel(sender); |
| 416 if (!new_toplevel) | 416 if (!new_toplevel) |
| 417 return; | 417 return; |
| 418 | 418 |
| 419 // Use |signals_| to make sure we don't get called back after destruction. | 419 // Use |signals_| to make sure we don't get called back after destruction. |
| 420 signals_.Connect(new_toplevel, "set-focus", | 420 signals_.Connect(new_toplevel, "set-focus", |
| (...skipping 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2139 void OmniboxViewGtk::AdjustVerticalAlignmentOfInstantView() { | 2139 void OmniboxViewGtk::AdjustVerticalAlignmentOfInstantView() { |
| 2140 // By default, GtkTextView layouts an anchored child widget just above the | 2140 // By default, GtkTextView layouts an anchored child widget just above the |
| 2141 // baseline, so we need to move the |instant_view_| down to make sure it | 2141 // baseline, so we need to move the |instant_view_| down to make sure it |
| 2142 // has the same baseline as the |text_view_|. | 2142 // has the same baseline as the |text_view_|. |
| 2143 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); | 2143 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); |
| 2144 int height; | 2144 int height; |
| 2145 pango_layout_get_size(layout, NULL, &height); | 2145 pango_layout_get_size(layout, NULL, &height); |
| 2146 int baseline = pango_layout_get_baseline(layout); | 2146 int baseline = pango_layout_get_baseline(layout); |
| 2147 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); | 2147 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); |
| 2148 } | 2148 } |
| OLD | NEW |