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

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

Issue 10834279: Give request-to-act badges a grey background, and increase spacing to make it fit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add Views UI; clean up GTK Created 8 years, 4 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // Spacing needed to align the bubble with the left side of the omnibox. 113 // Spacing needed to align the bubble with the left side of the omnibox.
114 const int kFirstRunBubbleLeftSpacing = 4; 114 const int kFirstRunBubbleLeftSpacing = 4;
115 115
116 // The padding around the top, bottom, and sides of the location bar hbox. 116 // The padding around the top, bottom, and sides of the location bar hbox.
117 // We don't want to edit control's text to be right against the edge, 117 // We don't want to edit control's text to be right against the edge,
118 // as well the tab to search box and other widgets need to have the padding on 118 // as well the tab to search box and other widgets need to have the padding on
119 // top and bottom to avoid drawing larger than the location bar space. 119 // top and bottom to avoid drawing larger than the location bar space.
120 const int kHboxBorder = 2; 120 const int kHboxBorder = 2;
121 121
122 // Padding between the elements in the bar. 122 // Padding between the elements in the bar.
123 const int kInnerPadding = 2; 123 const int kInnerPadding = 9;
Aaron Boodman 2012/08/24 15:36:53 We only want to change the layout in the case wher
Jeffrey Yasskin 2012/08/29 00:37:50 Good point. Done.
124 124
125 // Padding between the right of the star and the edge of the URL entry. 125 // Padding between the right of the star and the edge of the URL entry.
126 const int kStarRightPadding = 2; 126 const int kStarRightPadding = 4;
Jeffrey Yasskin 2012/08/29 00:37:50 Turns out this was unused.
127 127
128 // Colors used to draw the EV certificate rounded bubble. 128 // Colors used to draw the EV certificate rounded bubble.
129 const GdkColor kEvSecureTextColor = GDK_COLOR_RGB(0x07, 0x95, 0x00); 129 const GdkColor kEvSecureTextColor = GDK_COLOR_RGB(0x07, 0x95, 0x00);
130 const GdkColor kEvSecureBackgroundColor = GDK_COLOR_RGB(0xef, 0xfc, 0xef); 130 const GdkColor kEvSecureBackgroundColor = GDK_COLOR_RGB(0xef, 0xfc, 0xef);
131 const GdkColor kEvSecureBorderColor = GDK_COLOR_RGB(0x90, 0xc3, 0x90); 131 const GdkColor kEvSecureBorderColor = GDK_COLOR_RGB(0x90, 0xc3, 0x90);
132 132
133 // Colors used to draw the Tab to Search rounded bubble. 133 // Colors used to draw the Tab to Search rounded bubble.
134 const GdkColor kKeywordBackgroundColor = GDK_COLOR_RGB(0xf0, 0xf4, 0xfa); 134 const GdkColor kKeywordBackgroundColor = GDK_COLOR_RGB(0xf0, 0xf4, 0xfa);
135 const GdkColor kKeywordBorderColor = GDK_COLOR_RGB(0xcb, 0xde, 0xf7); 135 const GdkColor kKeywordBorderColor = GDK_COLOR_RGB(0xcb, 0xde, 0xf7);
136 136
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 } 995 }
996 996
997 WebContents* contents = GetWebContents(); 997 WebContents* contents = GetWebContents();
998 if (!page_action_views_.empty() && contents) { 998 if (!page_action_views_.empty() && contents) {
999 GURL url = chrome::GetActiveWebContents(browser())->GetURL(); 999 GURL url = chrome::GetActiveWebContents(browser())->GetURL();
1000 1000
1001 for (size_t i = 0; i < page_action_views_.size(); i++) { 1001 for (size_t i = 0; i < page_action_views_.size(); i++) {
1002 page_action_views_[i]->UpdateVisibility( 1002 page_action_views_[i]->UpdateVisibility(
1003 toolbar_model_->input_in_progress() ? NULL : contents, url); 1003 toolbar_model_->input_in_progress() ? NULL : contents, url);
1004 } 1004 }
1005 gtk_widget_queue_draw(hbox_.get());
1005 } 1006 }
1006 1007
1007 // If there are no visible page actions, hide the hbox too, so that it does 1008 // If there are no visible page actions, hide the hbox too, so that it does
1008 // not affect the padding in the location bar. 1009 // not affect the padding in the location bar.
1009 gtk_widget_set_visible(page_action_hbox_.get(), 1010 gtk_widget_set_visible(page_action_hbox_.get(),
1010 PageActionVisibleCount() && !ShouldOnlyShowLocation()); 1011 PageActionVisibleCount() && !ShouldOnlyShowLocation());
1011 } 1012 }
1012 1013
1013 void LocationBarViewGtk::InvalidatePageActions() { 1014 void LocationBarViewGtk::InvalidatePageActions() {
1014 size_t count_before = page_action_views_.size(); 1015 size_t count_before = page_action_views_.size();
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 left = IDR_LOCATIONBG_L; 1192 left = IDR_LOCATIONBG_L;
1192 center = IDR_LOCATIONBG_C; 1193 center = IDR_LOCATIONBG_C;
1193 right = IDR_LOCATIONBG_R; 1194 right = IDR_LOCATIONBG_R;
1194 } 1195 }
1195 1196
1196 NineBox background(left, center, right, 1197 NineBox background(left, center, right,
1197 0, 0, 0, 0, 0, 0); 1198 0, 0, 0, 0, 0, 0);
1198 background.RenderToWidget(widget); 1199 background.RenderToWidget(widget);
1199 } 1200 }
1200 1201
1202 // Draw ExtensionAction backgrounds and borders, if necessary. The borders
1203 // appear exactly between the elements, so they can't draw the borders
1204 // themselves.
1205 gfx::CanvasSkiaPaint canvas(event, false);
Aaron Boodman 2012/08/24 15:36:53 Document the magic boolean, or else make it a name
Peter Kasting 2012/08/24 23:08:28 Honestly I'm not a huge fan of documenting at a ca
Jeffrey Yasskin 2012/08/29 00:37:50 I am a fan of doing this, and just forgot here. I
1206 for (size_t i = 0; i < page_action_views_.size(); ++i) {
Peter Kasting 2012/08/24 23:08:28 Nit: Use iterator (see location_bar_view.cc)
Jeffrey Yasskin 2012/08/29 00:37:50 Done.
1207 PageActionViewGtk& page_action_view = *page_action_views_[i];
1208 if (page_action_view.IsVisible()) {
1209 // Figure out where the page action is drawn so we can draw
1210 // borders to its left and right.
1211 GtkAllocation allocation;
1212 gtk_widget_get_allocation(page_action_view.widget(), &allocation);
1213 ExtensionAction* action = page_action_view.page_action();
1214 gfx::Rect bounds(allocation);
1215 // These offsets place the top and bottom edges on top of the darkest line
1216 // in the location bar border, and the side edges on the pixels exactly
1217 // between two page actions. If the border image changes, these offsets
1218 // will have to change to match.
1219 bounds.Inset(-kInnerPadding / 2, -2,
Peter Kasting 2012/08/24 23:08:28 How come we have to offset by -2 here and -1 in vi
Jeffrey Yasskin 2012/08/29 00:37:50 The visible edge in gtk (http://i.imgur.com/tmB3A.
1220 -kInnerPadding / 2, -2);
1221 action->PaintBackground(&canvas, bounds,
1222 SessionID::IdForTab(GetTabContents()));
1223 }
1224 }
1225
1201 return FALSE; // Continue propagating the expose. 1226 return FALSE; // Continue propagating the expose.
1202 } 1227 }
1203 1228
1204 void LocationBarViewGtk::UpdateSiteTypeArea() { 1229 void LocationBarViewGtk::UpdateSiteTypeArea() {
1205 // The icon is always visible except when the |tab_to_search_alignment_| is 1230 // The icon is always visible except when the |tab_to_search_alignment_| is
1206 // visible. 1231 // visible.
1207 if (!location_entry_->model()->keyword().empty() && 1232 if (!location_entry_->model()->keyword().empty() &&
1208 !location_entry_->model()->is_keyword_hint()) { 1233 !location_entry_->model()->is_keyword_hint()) {
1209 gtk_widget_hide(site_type_area()); 1234 gtk_widget_hide(site_type_area());
1210 return; 1235 return;
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 } 2161 }
2137 2162
2138 void LocationBarViewGtk::PageActionViewGtk::InspectPopup( 2163 void LocationBarViewGtk::PageActionViewGtk::InspectPopup(
2139 ExtensionAction* action) { 2164 ExtensionAction* action) {
2140 ExtensionPopupGtk::Show( 2165 ExtensionPopupGtk::Show(
2141 action->GetPopupUrl(current_tab_id_), 2166 action->GetPopupUrl(current_tab_id_),
2142 owner_->browser_, 2167 owner_->browser_,
2143 event_box_.get(), 2168 event_box_.get(),
2144 ExtensionPopupGtk::SHOW_AND_INSPECT); 2169 ExtensionPopupGtk::SHOW_AND_INSPECT);
2145 } 2170 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698