Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc

Issue 14259008: Instant Extended: Add prominent search term support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 // the stock labels (i.e. GTK_STOCK_PASTE and GTK_STOCK_COPY). 1256 // the stock labels (i.e. GTK_STOCK_PASTE and GTK_STOCK_COPY).
1257 1257
1258 // If we don't find the stock Copy menu item, the Copy URL item will be 1258 // If we don't find the stock Copy menu item, the Copy URL item will be
1259 // appended at the end of the popup menu. 1259 // appended at the end of the popup menu.
1260 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), copy_url_menuitem, 1260 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), copy_url_menuitem,
1261 GetPopupMenuIndexForStockLabel(GTK_STOCK_COPY, menu)); 1261 GetPopupMenuIndexForStockLabel(GTK_STOCK_COPY, menu));
1262 g_signal_connect(copy_url_menuitem, "activate", 1262 g_signal_connect(copy_url_menuitem, "activate",
1263 G_CALLBACK(HandleCopyURLClipboardThunk), this); 1263 G_CALLBACK(HandleCopyURLClipboardThunk), this);
1264 gtk_widget_set_sensitive( 1264 gtk_widget_set_sensitive(
1265 copy_url_menuitem, 1265 copy_url_menuitem,
1266 toolbar_model()->WouldReplaceSearchURLWithSearchTerms() && 1266 toolbar_model()->GetSearchTermType() !=
1267 ToolbarModel::SEARCH_TERM_NONE &&
1267 !model()->user_input_in_progress()); 1268 !model()->user_input_in_progress());
1268 gtk_widget_show(copy_url_menuitem); 1269 gtk_widget_show(copy_url_menuitem);
1269 } 1270 }
1270 1271
1271 // Paste and Go menu item. 1272 // Paste and Go menu item.
1272 GtkWidget* paste_go_menuitem = gtk_menu_item_new_with_mnemonic( 1273 GtkWidget* paste_go_menuitem = gtk_menu_item_new_with_mnemonic(
1273 ui::ConvertAcceleratorsFromWindowsStyle(l10n_util::GetStringUTF8( 1274 ui::ConvertAcceleratorsFromWindowsStyle(l10n_util::GetStringUTF8(
1274 model()->IsPasteAndSearch(sanitized_text_for_paste_and_go_) ? 1275 model()->IsPasteAndSearch(sanitized_text_for_paste_and_go_) ?
1275 IDS_PASTE_AND_SEARCH : IDS_PASTE_AND_GO)).c_str()); 1276 IDS_PASTE_AND_SEARCH : IDS_PASTE_AND_GO)).c_str());
1276 1277
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
2156 void OmniboxViewGtk::AdjustVerticalAlignmentOfInstantView() { 2157 void OmniboxViewGtk::AdjustVerticalAlignmentOfInstantView() {
2157 // By default, GtkTextView layouts an anchored child widget just above the 2158 // By default, GtkTextView layouts an anchored child widget just above the
2158 // baseline, so we need to move the |instant_view_| down to make sure it 2159 // baseline, so we need to move the |instant_view_| down to make sure it
2159 // has the same baseline as the |text_view_|. 2160 // has the same baseline as the |text_view_|.
2160 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); 2161 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_));
2161 int height; 2162 int height;
2162 pango_layout_get_size(layout, NULL, &height); 2163 pango_layout_get_size(layout, NULL, &height);
2163 int baseline = pango_layout_get_baseline(layout); 2164 int baseline = pango_layout_get_baseline(layout);
2164 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); 2165 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL);
2165 } 2166 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698