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 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 gtk_widget_show(search_engine_menuitem); | 1231 gtk_widget_show(search_engine_menuitem); |
1232 | 1232 |
1233 GtkClipboard* x_clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); | 1233 GtkClipboard* x_clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); |
1234 gchar* text = gtk_clipboard_wait_for_text(x_clipboard); | 1234 gchar* text = gtk_clipboard_wait_for_text(x_clipboard); |
1235 sanitized_text_for_paste_and_go_ = text ? | 1235 sanitized_text_for_paste_and_go_ = text ? |
1236 StripJavascriptSchemas(CollapseWhitespace(UTF8ToUTF16(text), true)) : | 1236 StripJavascriptSchemas(CollapseWhitespace(UTF8ToUTF16(text), true)) : |
1237 string16(); | 1237 string16(); |
1238 g_free(text); | 1238 g_free(text); |
1239 | 1239 |
1240 // Copy URL menu item. | 1240 // Copy URL menu item. |
1241 if (chrome::IsQueryExtractionEnabled(browser_->profile())) { | 1241 if (chrome::IsQueryExtractionEnabled()) { |
1242 GtkWidget* copy_url_menuitem = gtk_menu_item_new_with_mnemonic( | 1242 GtkWidget* copy_url_menuitem = gtk_menu_item_new_with_mnemonic( |
1243 ui::ConvertAcceleratorsFromWindowsStyle( | 1243 ui::ConvertAcceleratorsFromWindowsStyle( |
1244 l10n_util::GetStringUTF8(IDS_COPY_URL)).c_str()); | 1244 l10n_util::GetStringUTF8(IDS_COPY_URL)).c_str()); |
1245 | 1245 |
1246 // Detect the Paste and Copy menu items by searching for the ones that use | 1246 // Detect the Paste and Copy menu items by searching for the ones that use |
1247 // the stock labels (i.e. GTK_STOCK_PASTE and GTK_STOCK_COPY). | 1247 // the stock labels (i.e. GTK_STOCK_PASTE and GTK_STOCK_COPY). |
1248 | 1248 |
1249 // If we don't find the stock Copy menu item, the Copy URL item will be | 1249 // If we don't find the stock Copy menu item, the Copy URL item will be |
1250 // appended at the end of the popup menu. | 1250 // appended at the end of the popup menu. |
1251 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), copy_url_menuitem, | 1251 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), copy_url_menuitem, |
(...skipping 887 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 |