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

Side by Side 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: addressed peter's comments 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_LAYOUT_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_LAYOUT_H_
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_LAYOUT_H_ 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_LAYOUT_H_
7 7
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 9
10 namespace gfx { 10 namespace gfx {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 bool auto_collapse, 48 bool auto_collapse,
49 double max_fraction, 49 double max_fraction,
50 int edge_item_padding, 50 int edge_item_padding,
51 int item_padding, 51 int item_padding,
52 int builtin_padding, 52 int builtin_padding,
53 views::View* view); 53 views::View* view);
54 54
55 // Add a non-resizable decoration with standard padding. 55 // Add a non-resizable decoration with standard padding.
56 void AddDecoration(int height, int builtin_padding, views::View* view); 56 void AddDecoration(int height, int builtin_padding, views::View* view);
57 57
58 void AddSeparator(int y, int height, int padding_from_previous_item,
Peter Kasting 2013/01/17 23:30:43 Nit: One arg per line
kuan 2013/01/17 23:46:34 Done.
59 views::View* separator);
60
58 // First pass of decoration layout process. Pass the full width of the 61 // First pass of decoration layout process. Pass the full width of the
59 // location bar in |entry_width|. This pass will adjust it to account for 62 // location bar in |entry_width|. This pass will adjust it to account for
60 // non-collapsible and non-resizable decorations. 63 // non-collapsible and non-resizable decorations.
61 void LayoutPass1(int* entry_width); 64 void LayoutPass1(int* entry_width);
62 65
63 // Second pass of decoration layout process. Pass the |entry_width| computed 66 // Second pass of decoration layout process. Pass the |entry_width| computed
64 // by the first pass. This pass will adjust it to account for resizable 67 // by the first pass. This pass will adjust it to account for resizable
65 // decorations. 68 // decorations.
66 void LayoutPass2(int* entry_width); 69 void LayoutPass2(int* entry_width);
67 70
68 // Third and final pass of decoration layout process. Pass the |bounds| 71 // Third and final pass of decoration layout process. Pass the |bounds|
69 // corresponding to the entire space available in the location bar. This pass 72 // corresponding to the entire space available in the location bar. This pass
70 // will update it as decorations are laid out. |available_width| measures the 73 // will update it as decorations are laid out. |available_width| measures the
71 // empty space within the location bar, taking the decorations and text into 74 // empty space within the location bar, taking the decorations and text into
72 // account. |decorations| must always be ordered from the edge of the location 75 // account. |decorations| must always be ordered from the edge of the location
73 // bar towards the middle. 76 // bar towards the middle.
74 void LayoutPass3(gfx::Rect* bounds, int* available_width); 77 void LayoutPass3(gfx::Rect* bounds, int* available_width);
75 78
79 // Sets the padding between edit and the decoration beside it.
80 // This value must not be modified after LayoutPass1 has been called.
81 void set_item_edit_padding(int item_edit_padding) {
82 item_edit_padding_ = item_edit_padding;
83 }
84
76 private: 85 private:
86 typedef ScopedVector<LocationBarDecoration> Decorations;
87
88 void SetVisibilityForDecorations(int* available_width);
89 void HideUnneededSeparators(int* available_width);
90 void SetBoundsForDecorations(gfx::Rect* bounds);
91
77 // LEFT_EDGE means decorations are added from left to right and stacked on 92 // LEFT_EDGE means decorations are added from left to right and stacked on
78 // the left of the omnibox, RIGHT_EDGE means the opposite. 93 // the left of the omnibox, RIGHT_EDGE means the opposite.
79 Position position_; 94 Position position_;
80 95
81 // The padding between the last decoration and the edit box. 96 // The padding between the last decoration and the edit box.
82 int item_edit_padding_; 97 int item_edit_padding_;
83 98
84 // The padding between the edge and the edit box, if there are no decorations. 99 // The padding between the edge and the edit box, if there are no decorations.
85 int edge_edit_padding_; 100 int edge_edit_padding_;
86 101
87 // The list of decorations to layout. 102 // The list of decorations to layout.
88 ScopedVector<LocationBarDecoration> decorations_; 103 Decorations decorations_;
89 104
90 DISALLOW_COPY_AND_ASSIGN(LocationBarLayout); 105 DISALLOW_COPY_AND_ASSIGN(LocationBarLayout);
91 }; 106 };
92 107
93 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_LAYOUT_H_ 108 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_LAYOUT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698