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

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 nits from peter 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,
59 int height,
60 int padding_from_previous_item,
61 views::View* separator);
62
58 // First pass of decoration layout process. Pass the full width of the 63 // 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 64 // location bar in |entry_width|. This pass will adjust it to account for
60 // non-collapsible and non-resizable decorations. 65 // non-collapsible and non-resizable decorations.
61 void LayoutPass1(int* entry_width); 66 void LayoutPass1(int* entry_width);
62 67
63 // Second pass of decoration layout process. Pass the |entry_width| computed 68 // 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 69 // by the first pass. This pass will adjust it to account for resizable
65 // decorations. 70 // decorations.
66 void LayoutPass2(int* entry_width); 71 void LayoutPass2(int* entry_width);
67 72
68 // Third and final pass of decoration layout process. Pass the |bounds| 73 // Third and final pass of decoration layout process. Pass the |bounds|
69 // corresponding to the entire space available in the location bar. This pass 74 // 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 75 // 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 76 // 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 77 // account. |decorations| must always be ordered from the edge of the location
73 // bar towards the middle. 78 // bar towards the middle.
74 void LayoutPass3(gfx::Rect* bounds, int* available_width); 79 void LayoutPass3(gfx::Rect* bounds, int* available_width);
75 80
81 // Sets the padding between edit and the decoration beside it.
82 // This value must not be modified after LayoutPass1 has been called.
83 void set_item_edit_padding(int item_edit_padding) {
84 item_edit_padding_ = item_edit_padding;
85 }
86
76 private: 87 private:
88 typedef ScopedVector<LocationBarDecoration> Decorations;
89
90 void SetVisibilityForDecorations(int* available_width);
91 void HideUnneededSeparators(int* available_width);
92 void SetBoundsForDecorations(gfx::Rect* bounds);
93
77 // LEFT_EDGE means decorations are added from left to right and stacked on 94 // LEFT_EDGE means decorations are added from left to right and stacked on
78 // the left of the omnibox, RIGHT_EDGE means the opposite. 95 // the left of the omnibox, RIGHT_EDGE means the opposite.
79 Position position_; 96 Position position_;
80 97
81 // The padding between the last decoration and the edit box. 98 // The padding between the last decoration and the edit box.
82 int item_edit_padding_; 99 int item_edit_padding_;
83 100
84 // The padding between the edge and the edit box, if there are no decorations. 101 // The padding between the edge and the edit box, if there are no decorations.
85 int edge_edit_padding_; 102 int edge_edit_padding_;
86 103
87 // The list of decorations to layout. 104 // The list of decorations to layout.
88 ScopedVector<LocationBarDecoration> decorations_; 105 Decorations decorations_;
89 106
90 DISALLOW_COPY_AND_ASSIGN(LocationBarLayout); 107 DISALLOW_COPY_AND_ASSIGN(LocationBarLayout);
91 }; 108 };
92 109
93 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_LAYOUT_H_ 110 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_LAYOUT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698