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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_layout.h

Issue 11418229: alternate ntp: implement right-aligned search token (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: impl new design to handle separator in layout system Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/location_bar/location_bar_layout.h
diff --git a/chrome/browser/ui/views/location_bar/location_bar_layout.h b/chrome/browser/ui/views/location_bar/location_bar_layout.h
index 35c4d43bab06faaa4c821f01283dc24acfb3c3d4..593116104cc446badc808cff9f4364c786a5cb16 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_layout.h
+++ b/chrome/browser/ui/views/location_bar/location_bar_layout.h
@@ -26,6 +26,16 @@ class LocationBarLayout {
RIGHT_EDGE,
};
+ enum Separator {
beaudoin 2013/01/09 20:36:52 Should probably be SeparatorPosition
kuan 2013/01/11 21:21:20 removed based on new design.
+ SEPARATOR_NONE = 0,
+ // For LTR, separator is visually before decoration for LEFT_EDGE and after
+ // decoration for RIGHT_EDGE.
beaudoin 2013/01/09 20:36:52 I would rephrase the comment: SEPARATOR_BEFORE pla
kuan 2013/01/11 21:21:20 ditto.
+ SEPARATOR_BEFORE,
+ // For LTR, separator is visually after decoration for LEFT_EDGE and before
+ // decoration for RIGHT_EDGE.
beaudoin 2013/01/09 20:36:52 Same here.
kuan 2013/01/11 21:21:20 ditto.
+ SEPARATOR_AFTER,
+ };
+
LocationBarLayout(Position position,
int item_edit_padding,
int edge_edit_padding);
@@ -52,6 +62,27 @@ class LocationBarLayout {
int builtin_padding,
views::View* view);
+ // Add a decoration with a separator, the parameters are identical to those
+ // for AddDecoration(), with extra specifications for:
+ // - The |separator| type;
+ // - The |separator_padding| to use between |view| and separator;
+ // - The |separator_height| to use for separator in pixel, 0 meaning final
+ // height used for |view|;
+ // - The |separator_view| corresponding to the separator for this decoration,
+ // a weak pointer.
+ void AddDecorationWithSeparator(int y,
+ int height,
+ bool auto_collapse,
+ double max_fraction,
+ int edge_item_padding,
+ int item_padding,
+ int builtin_padding,
+ Separator separator,
+ int separator_padding,
+ int separator_height,
+ views::View* view,
+ views::View* separator_view);
beaudoin 2013/01/09 20:36:52 I think it would be much simpler to replace the ab
kuan 2013/01/11 21:21:20 Done.
+
// Add a non-resizable decoration with standard padding.
void AddDecoration(int height, int builtin_padding, views::View* view);
@@ -73,7 +104,30 @@ class LocationBarLayout {
// bar towards the middle.
void LayoutPass3(gfx::Rect* bounds, int* available_width);
+ // Sets the padding between edit and the decoration beside it.
+ // This value must not be modified after LayoutPass1 has been called.
+ void set_item_edit_padding(int item_edit_padding) {
+ item_edit_padding_ = item_edit_padding;
+ }
+
private:
+ // Determine if separator of a decoration at |it| should be visible.
+ // |available_width| returns the updated remaining width if separator is
+ // visible.
+ void DetermineSeparatorVisibility(
+ ScopedVector<LocationBarDecoration>::iterator it,
+ bool first_visible,
+ int item_padding,
+ int* available_width);
+
+ // Set bounds of separator is if it's visible, returns true if bounds is set.
beaudoin 2013/01/09 20:36:52 typo: if it is
kuan 2013/01/11 21:21:20 removed, based on new design.
+ // |bounds| returns the updated remaining bounds.
+ bool SetSeparatorBounds(
+ ScopedVector<LocationBarDecoration>::iterator it,
+ int padding,
+ int item_height,
+ gfx::Rect* bounds);
+
// LEFT_EDGE means decorations are added from left to right and stacked on
// the left of the omnibox, RIGHT_EDGE means the opposite.
Position position_;

Powered by Google App Engine
This is Rietveld 408576698