OLD | NEW |
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/views/location_bar/location_bar_layout.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_layout.h" |
6 | 6 |
7 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 7 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
8 #include "ui/gfx/rect.h" | 8 #include "ui/gfx/rect.h" |
9 #include "ui/views/view.h" | 9 #include "ui/views/view.h" |
10 | 10 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 decorations_.push_back(new LocationBarDecoration( | 96 decorations_.push_back(new LocationBarDecoration( |
97 y, height, auto_collapse, max_fraction, edge_item_padding, item_padding, | 97 y, height, auto_collapse, max_fraction, edge_item_padding, item_padding, |
98 builtin_padding, view)); | 98 builtin_padding, view)); |
99 } | 99 } |
100 | 100 |
101 void LocationBarLayout::AddDecoration(int y, | 101 void LocationBarLayout::AddDecoration(int y, |
102 int height, | 102 int height, |
103 int builtin_padding, | 103 int builtin_padding, |
104 views::View* view) { | 104 views::View* view) { |
105 decorations_.push_back(new LocationBarDecoration( | 105 decorations_.push_back(new LocationBarDecoration( |
106 y, height, false, 0, LocationBarView::GetItemPadding(), | 106 y, height, false, 0, LocationBarView::kItemPadding, |
107 LocationBarView::GetItemPadding(), builtin_padding, view)); | 107 LocationBarView::kItemPadding, builtin_padding, view)); |
108 } | 108 } |
109 | 109 |
110 void LocationBarLayout::LayoutPass1(int* entry_width) { | 110 void LocationBarLayout::LayoutPass1(int* entry_width) { |
111 bool first_item = true; | 111 bool first_item = true; |
112 for (Decorations::iterator i(decorations_.begin()); i != decorations_.end(); | 112 for (Decorations::iterator i(decorations_.begin()); i != decorations_.end(); |
113 ++i) { | 113 ++i) { |
114 // Autocollapsing decorations are ignored in this pass. | 114 // Autocollapsing decorations are ignored in this pass. |
115 if (!(*i)->auto_collapse) { | 115 if (!(*i)->auto_collapse) { |
116 *entry_width -= -2 * (*i)->builtin_padding + | 116 *entry_width -= -2 * (*i)->builtin_padding + |
117 (first_item ? (*i)->edge_item_padding : (*i)->item_padding); | 117 (first_item ? (*i)->edge_item_padding : (*i)->item_padding); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 (*i)->builtin_padding); | 175 (*i)->builtin_padding); |
176 if (position_ == LEFT_EDGE) { | 176 if (position_ == LEFT_EDGE) { |
177 bounds->set_x( | 177 bounds->set_x( |
178 bounds->x() + padding + (*i)->computed_width - (*i)->builtin_padding); | 178 bounds->x() + padding + (*i)->computed_width - (*i)->builtin_padding); |
179 } | 179 } |
180 } | 180 } |
181 bounds->set_width(bounds->width() - item_edit_padding_); | 181 bounds->set_width(bounds->width() - item_edit_padding_); |
182 if (position_ == LEFT_EDGE) | 182 if (position_ == LEFT_EDGE) |
183 bounds->set_x(bounds->x() + item_edit_padding_); | 183 bounds->set_x(bounds->x() + item_edit_padding_); |
184 } | 184 } |
OLD | NEW |