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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/gtk/location_bar_view_gtk.cc
diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
index 554d6ff1b4af50ff1abf2e4acf0ed84c53e8bfa0..f14602f560d438ad0cdc2982f1466c36e28db372 100644
--- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
@@ -120,10 +120,10 @@ const int kFirstRunBubbleLeftSpacing = 4;
const int kHboxBorder = 2;
// Padding between the elements in the bar.
-const int kInnerPadding = 2;
+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.
// Padding between the right of the star and the edge of the URL entry.
-const int kStarRightPadding = 2;
+const int kStarRightPadding = 4;
Jeffrey Yasskin 2012/08/29 00:37:50 Turns out this was unused.
// Colors used to draw the EV certificate rounded bubble.
const GdkColor kEvSecureTextColor = GDK_COLOR_RGB(0x07, 0x95, 0x00);
@@ -1002,6 +1002,7 @@ void LocationBarViewGtk::UpdatePageActions() {
page_action_views_[i]->UpdateVisibility(
toolbar_model_->input_in_progress() ? NULL : contents, url);
}
+ gtk_widget_queue_draw(hbox_.get());
}
// If there are no visible page actions, hide the hbox too, so that it does
@@ -1198,6 +1199,30 @@ gboolean LocationBarViewGtk::HandleExpose(GtkWidget* widget,
background.RenderToWidget(widget);
}
+ // Draw ExtensionAction backgrounds and borders, if necessary. The borders
+ // appear exactly between the elements, so they can't draw the borders
+ // themselves.
+ 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
+ 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.
+ PageActionViewGtk& page_action_view = *page_action_views_[i];
+ if (page_action_view.IsVisible()) {
+ // Figure out where the page action is drawn so we can draw
+ // borders to its left and right.
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(page_action_view.widget(), &allocation);
+ ExtensionAction* action = page_action_view.page_action();
+ gfx::Rect bounds(allocation);
+ // These offsets place the top and bottom edges on top of the darkest line
+ // in the location bar border, and the side edges on the pixels exactly
+ // between two page actions. If the border image changes, these offsets
+ // will have to change to match.
+ 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.
+ -kInnerPadding / 2, -2);
+ action->PaintBackground(&canvas, bounds,
+ SessionID::IdForTab(GetTabContents()));
+ }
+ }
+
return FALSE; // Continue propagating the expose.
}

Powered by Google App Engine
This is Rietveld 408576698