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

Side by Side Diff: chrome/browser/ui/gtk/location_bar_view_gtk.cc

Issue 6252003: Accept keyword by pressing space. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only allow 0x0020 and 0x3000 for now. Created 9 years, 11 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
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit_view_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/location_bar_view_gtk.h" 5 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 bool LocationBarViewGtk::ShouldOnlyShowLocation() { 1191 bool LocationBarViewGtk::ShouldOnlyShowLocation() {
1192 return browser_->type() != Browser::TYPE_NORMAL; 1192 return browser_->type() != Browser::TYPE_NORMAL;
1193 } 1193 }
1194 1194
1195 void LocationBarViewGtk::AdjustChildrenVisibility() { 1195 void LocationBarViewGtk::AdjustChildrenVisibility() {
1196 int text_width = location_entry_->TextWidth(); 1196 int text_width = location_entry_->TextWidth();
1197 int available_width = entry_box_width_ - text_width - kInnerPadding; 1197 int available_width = entry_box_width_ - text_width - kInnerPadding;
1198 1198
1199 // Only one of |tab_to_search_box_| and |tab_to_search_hint_| can be visible 1199 // Only one of |tab_to_search_box_| and |tab_to_search_hint_| can be visible
1200 // at the same time. 1200 // at the same time.
1201 if (!show_selected_keyword_ && GTK_WIDGET_VISIBLE(tab_to_search_box_)) { 1201 if (!show_selected_keyword_ && GTK_WIDGET_VISIBLE(tab_to_search_box_))
1202 gtk_widget_hide(tab_to_search_box_); 1202 gtk_widget_hide(tab_to_search_box_);
1203 } else if (!show_keyword_hint_ && GTK_WIDGET_VISIBLE(tab_to_search_hint_)) { 1203 else if (!show_keyword_hint_ && GTK_WIDGET_VISIBLE(tab_to_search_hint_))
1204 gtk_widget_hide(tab_to_search_hint_); 1204 gtk_widget_hide(tab_to_search_hint_);
1205 location_entry_->set_enable_tab_to_search(false);
1206 }
1207 1205
1208 if (show_selected_keyword_) { 1206 if (show_selected_keyword_) {
1209 GtkRequisition box, full_label, partial_label; 1207 GtkRequisition box, full_label, partial_label;
1210 gtk_widget_size_request(tab_to_search_box_, &box); 1208 gtk_widget_size_request(tab_to_search_box_, &box);
1211 gtk_widget_size_request(tab_to_search_full_label_, &full_label); 1209 gtk_widget_size_request(tab_to_search_full_label_, &full_label);
1212 gtk_widget_size_request(tab_to_search_partial_label_, &partial_label); 1210 gtk_widget_size_request(tab_to_search_partial_label_, &partial_label);
1213 int full_partial_width_diff = full_label.width - partial_label.width; 1211 int full_partial_width_diff = full_label.width - partial_label.width;
1214 int full_box_width; 1212 int full_box_width;
1215 int partial_box_width; 1213 int partial_box_width;
1216 if (GTK_WIDGET_VISIBLE(tab_to_search_full_label_)) { 1214 if (GTK_WIDGET_VISIBLE(tab_to_search_full_label_)) {
(...skipping 17 matching lines...) Expand all
1234 } 1232 }
1235 } else if (show_keyword_hint_) { 1233 } else if (show_keyword_hint_) {
1236 GtkRequisition leading, icon, trailing; 1234 GtkRequisition leading, icon, trailing;
1237 gtk_widget_size_request(tab_to_search_hint_leading_label_, &leading); 1235 gtk_widget_size_request(tab_to_search_hint_leading_label_, &leading);
1238 gtk_widget_size_request(tab_to_search_hint_icon_, &icon); 1236 gtk_widget_size_request(tab_to_search_hint_icon_, &icon);
1239 gtk_widget_size_request(tab_to_search_hint_trailing_label_, &trailing); 1237 gtk_widget_size_request(tab_to_search_hint_trailing_label_, &trailing);
1240 int full_width = leading.width + icon.width + trailing.width; 1238 int full_width = leading.width + icon.width + trailing.width;
1241 1239
1242 if (icon.width >= entry_box_width_ - kInnerPadding) { 1240 if (icon.width >= entry_box_width_ - kInnerPadding) {
1243 gtk_widget_hide(tab_to_search_hint_); 1241 gtk_widget_hide(tab_to_search_hint_);
1244 location_entry_->set_enable_tab_to_search(false);
1245 } else if (full_width >= available_width) { 1242 } else if (full_width >= available_width) {
1246 gtk_widget_hide(tab_to_search_hint_leading_label_); 1243 gtk_widget_hide(tab_to_search_hint_leading_label_);
1247 gtk_widget_hide(tab_to_search_hint_trailing_label_); 1244 gtk_widget_hide(tab_to_search_hint_trailing_label_);
1248 gtk_widget_show(tab_to_search_hint_); 1245 gtk_widget_show(tab_to_search_hint_);
1249 location_entry_->set_enable_tab_to_search(true);
1250 } else if (full_width < available_width) { 1246 } else if (full_width < available_width) {
1251 gtk_widget_show(tab_to_search_hint_leading_label_); 1247 gtk_widget_show(tab_to_search_hint_leading_label_);
1252 gtk_widget_show(tab_to_search_hint_trailing_label_); 1248 gtk_widget_show(tab_to_search_hint_trailing_label_);
1253 gtk_widget_show(tab_to_search_hint_); 1249 gtk_widget_show(tab_to_search_hint_);
1254 location_entry_->set_enable_tab_to_search(true);
1255 } 1250 }
1256 } 1251 }
1257 } 1252 }
1258 1253
1259 //////////////////////////////////////////////////////////////////////////////// 1254 ////////////////////////////////////////////////////////////////////////////////
1260 // LocationBarViewGtk::ContentSettingImageViewGtk 1255 // LocationBarViewGtk::ContentSettingImageViewGtk
1261 LocationBarViewGtk::ContentSettingImageViewGtk::ContentSettingImageViewGtk( 1256 LocationBarViewGtk::ContentSettingImageViewGtk::ContentSettingImageViewGtk(
1262 ContentSettingsType content_type, 1257 ContentSettingsType content_type,
1263 const LocationBarViewGtk* parent, 1258 const LocationBarViewGtk* parent,
1264 Profile* profile) 1259 Profile* profile)
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 1543
1549 std::string badge_text = page_action_->GetBadgeText(tab_id); 1544 std::string badge_text = page_action_->GetBadgeText(tab_id);
1550 if (badge_text.empty()) 1545 if (badge_text.empty())
1551 return FALSE; 1546 return FALSE;
1552 1547
1553 gfx::CanvasSkiaPaint canvas(event, false); 1548 gfx::CanvasSkiaPaint canvas(event, false);
1554 gfx::Rect bounding_rect(widget->allocation); 1549 gfx::Rect bounding_rect(widget->allocation);
1555 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); 1550 page_action_->PaintBadge(&canvas, bounding_rect, tab_id);
1556 return FALSE; 1551 return FALSE;
1557 } 1552 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit_view_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698