| 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 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1235 gtk_widget_show(search_engine_menuitem); | 1235 gtk_widget_show(search_engine_menuitem); |
| 1236 | 1236 |
| 1237 GtkClipboard* x_clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); | 1237 GtkClipboard* x_clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); |
| 1238 gchar* text = gtk_clipboard_wait_for_text(x_clipboard); | 1238 gchar* text = gtk_clipboard_wait_for_text(x_clipboard); |
| 1239 sanitized_text_for_paste_and_go_ = text ? | 1239 sanitized_text_for_paste_and_go_ = text ? |
| 1240 StripJavascriptSchemas(CollapseWhitespace(UTF8ToUTF16(text), true)) : | 1240 StripJavascriptSchemas(CollapseWhitespace(UTF8ToUTF16(text), true)) : |
| 1241 string16(); | 1241 string16(); |
| 1242 g_free(text); | 1242 g_free(text); |
| 1243 | 1243 |
| 1244 // Copy URL menu item. | 1244 // Copy URL menu item. |
| 1245 if (chrome::IsQueryExtractionEnabled()) { | 1245 if (chrome::IsQueryExtractionEnabled(browser_->profile())) { |
| 1246 GtkWidget* copy_url_menuitem = gtk_menu_item_new_with_mnemonic( | 1246 GtkWidget* copy_url_menuitem = gtk_menu_item_new_with_mnemonic( |
| 1247 ui::ConvertAcceleratorsFromWindowsStyle( | 1247 ui::ConvertAcceleratorsFromWindowsStyle( |
| 1248 l10n_util::GetStringUTF8(IDS_COPY_URL)).c_str()); | 1248 l10n_util::GetStringUTF8(IDS_COPY_URL)).c_str()); |
| 1249 | 1249 |
| 1250 // Detect the Paste and Copy menu items by searching for the ones that use | 1250 // Detect the Paste and Copy menu items by searching for the ones that use |
| 1251 // the stock labels (i.e. GTK_STOCK_PASTE and GTK_STOCK_COPY). | 1251 // the stock labels (i.e. GTK_STOCK_PASTE and GTK_STOCK_COPY). |
| 1252 | 1252 |
| 1253 // If we don't find the stock Copy menu item, the Copy URL item will be | 1253 // If we don't find the stock Copy menu item, the Copy URL item will be |
| 1254 // appended at the end of the popup menu. | 1254 // appended at the end of the popup menu. |
| 1255 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), copy_url_menuitem, | 1255 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), copy_url_menuitem, |
| (...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2151 void OmniboxViewGtk::AdjustVerticalAlignmentOfInstantView() { | 2151 void OmniboxViewGtk::AdjustVerticalAlignmentOfInstantView() { |
| 2152 // By default, GtkTextView layouts an anchored child widget just above the | 2152 // By default, GtkTextView layouts an anchored child widget just above the |
| 2153 // baseline, so we need to move the |instant_view_| down to make sure it | 2153 // baseline, so we need to move the |instant_view_| down to make sure it |
| 2154 // has the same baseline as the |text_view_|. | 2154 // has the same baseline as the |text_view_|. |
| 2155 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); | 2155 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); |
| 2156 int height; | 2156 int height; |
| 2157 pango_layout_get_size(layout, NULL, &height); | 2157 pango_layout_get_size(layout, NULL, &height); |
| 2158 int baseline = pango_layout_get_baseline(layout); | 2158 int baseline = pango_layout_get_baseline(layout); |
| 2159 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); | 2159 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); |
| 2160 } | 2160 } |
| OLD | NEW |