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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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", |
421 G_CALLBACK(&HandleWindowSetFocusThunk), this); | 421 G_CALLBACK(&HandleWindowSetFocusThunk), this); |
422 } | 422 } |
423 | 423 |
424 void OmniboxViewGtk::SetFocus() { | 424 void OmniboxViewGtk::SetFocus() { |
425 DCHECK(text_view_); | 425 DCHECK(text_view_); |
426 gtk_widget_grab_focus(text_view_); | 426 gtk_widget_grab_focus(text_view_); |
427 } | 427 } |
428 | 428 |
| 429 void OmniboxViewGtk::ApplyCaretVisibility() { |
| 430 // TODO(mathp): implement for Linux. |
| 431 NOTIMPLEMENTED(); |
| 432 } |
| 433 |
429 int OmniboxViewGtk::WidthOfTextAfterCursor() { | 434 int OmniboxViewGtk::WidthOfTextAfterCursor() { |
430 // Not used. | 435 // Not used. |
431 return -1; | 436 return -1; |
432 } | 437 } |
433 | 438 |
434 void OmniboxViewGtk::SaveStateToTab(WebContents* tab) { | 439 void OmniboxViewGtk::SaveStateToTab(WebContents* tab) { |
435 DCHECK(tab); | 440 DCHECK(tab); |
436 // If any text has been selected, register it as the PRIMARY selection so it | 441 // If any text has been selected, register it as the PRIMARY selection so it |
437 // can still be pasted via middle-click after the text view is cleared. | 442 // can still be pasted via middle-click after the text view is cleared. |
438 if (!selected_text_.empty()) | 443 if (!selected_text_.empty()) |
(...skipping 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2130 void OmniboxViewGtk::AdjustVerticalAlignmentOfInstantView() { | 2135 void OmniboxViewGtk::AdjustVerticalAlignmentOfInstantView() { |
2131 // By default, GtkTextView layouts an anchored child widget just above the | 2136 // By default, GtkTextView layouts an anchored child widget just above the |
2132 // baseline, so we need to move the |instant_view_| down to make sure it | 2137 // baseline, so we need to move the |instant_view_| down to make sure it |
2133 // has the same baseline as the |text_view_|. | 2138 // has the same baseline as the |text_view_|. |
2134 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); | 2139 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); |
2135 int height; | 2140 int height; |
2136 pango_layout_get_size(layout, NULL, &height); | 2141 pango_layout_get_size(layout, NULL, &height); |
2137 int baseline = pango_layout_get_baseline(layout); | 2142 int baseline = pango_layout_get_baseline(layout); |
2138 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); | 2143 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); |
2139 } | 2144 } |
OLD | NEW |