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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view_layout.cc

Issue 6913026: Compact Navigation prototype (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 7 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/frame/browser_view_layout.h" 5 #include "chrome/browser/ui/views/frame/browser_view_layout.h"
6 6
7 #include "chrome/browser/sidebar/sidebar_manager.h" 7 #include "chrome/browser/sidebar/sidebar_manager.h"
8 #include "chrome/browser/ui/find_bar/find_bar.h" 8 #include "chrome/browser/ui/find_bar/find_bar.h"
9 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 9 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
10 #include "chrome/browser/ui/view_ids.h" 10 #include "chrome/browser/ui/view_ids.h"
(...skipping 16 matching lines...) Expand all
27 #include "views/window/hit_test.h" 27 #include "views/window/hit_test.h"
28 #endif 28 #endif
29 29
30 namespace { 30 namespace {
31 31
32 // The visible height of the shadow above the tabs. Clicks in this area are 32 // The visible height of the shadow above the tabs. Clicks in this area are
33 // treated as clicks to the frame, rather than clicks to the tab. 33 // treated as clicks to the frame, rather than clicks to the tab.
34 const int kTabShadowSize = 2; 34 const int kTabShadowSize = 2;
35 // The vertical overlap between the TabStrip and the Toolbar. 35 // The vertical overlap between the TabStrip and the Toolbar.
36 const int kToolbarTabStripVerticalOverlap = 3; 36 const int kToolbarTabStripVerticalOverlap = 3;
37 // The vertical size of the space between the content area and the tabstrip that
38 // is inserted in compact navigation mode. Note that we need to use a height
39 // that includes the overlap to get the visible height we want, in order to
40 // match how the toolbar overlaps the tabstrip.
41 static const int kCompactNavbarSpacerVisibleHeight = 4;
sky 2011/05/03 18:38:32 no need for static since in anonymouse namespace.
SteveT 2011/05/06 18:48:43 Done.
42 static const int kCompactNavbarSpacerHeight =
43 kCompactNavbarSpacerVisibleHeight + kToolbarTabStripVerticalOverlap;
44 // The size of the padding between the compact navigation bar and the tab strip.
45 static const int kCompactNavbarHorizontalPadding = 2;
46 // The number of pixels the bookmark bar should overlap the spacer by if the
47 // spacer is visible.
48 static const int kSpacerBookmarkBarOverlap = 1;
49
50 // Combines View::ConvertPointToView and View::HitTest for a given |point|.
51 // Converts |point| from |src| to |dst| and hit tests it against |dst|. The
52 // converted |point| can then be retrieved and used for additional tests.
53 bool ConvertedHitTest(views::View* src, views::View* dst, gfx::Point* point) {
54 DCHECK(src);
55 DCHECK(dst);
56 DCHECK(point);
57 views::View::ConvertPointToView(src, dst, point);
58 return dst->HitTest(*point);
59 }
37 60
38 } // namespace 61 } // namespace
39 62
40 //////////////////////////////////////////////////////////////////////////////// 63 ////////////////////////////////////////////////////////////////////////////////
41 // BrowserViewLayout, public: 64 // BrowserViewLayout, public:
42 65
43 BrowserViewLayout::BrowserViewLayout() 66 BrowserViewLayout::BrowserViewLayout()
44 : tabstrip_(NULL), 67 : tabstrip_(NULL),
45 toolbar_(NULL), 68 toolbar_(NULL),
46 contents_split_(NULL), 69 contents_split_(NULL),
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // Since the TabStrip only renders in some parts of the top of the window, 154 // Since the TabStrip only renders in some parts of the top of the window,
132 // the un-obscured area is considered to be part of the non-client caption 155 // the un-obscured area is considered to be part of the non-client caption
133 // area of the window. So we need to treat hit-tests in these regions as 156 // area of the window. So we need to treat hit-tests in these regions as
134 // hit-tests of the titlebar. 157 // hit-tests of the titlebar.
135 158
136 views::View* parent = browser_view_->parent(); 159 views::View* parent = browser_view_->parent();
137 160
138 gfx::Point point_in_browser_view_coords(point); 161 gfx::Point point_in_browser_view_coords(point);
139 views::View::ConvertPointToView( 162 views::View::ConvertPointToView(
140 parent, browser_view_, &point_in_browser_view_coords); 163 parent, browser_view_, &point_in_browser_view_coords);
164 gfx::Point test_point(point);
141 165
142 // Determine if the TabStrip exists and is capable of being clicked on. We 166 // Determine if the TabStrip exists and is capable of being clicked on. We
143 // might be a popup window without a TabStrip. 167 // might be a popup window without a TabStrip.
144 if (browser_view_->IsTabStripVisible()) { 168 if (browser_view_->IsTabStripVisible()) {
145 // See if the mouse pointer is within the bounds of the TabStrip. 169 // See if the mouse pointer is within the bounds of the TabStrip.
146 gfx::Point point_in_tabstrip_coords(point); 170 if (ConvertedHitTest(parent, tabstrip_, &test_point)) {
147 views::View::ConvertPointToView(parent, tabstrip_, 171 if (tabstrip_->IsPositionInWindowCaption(test_point))
148 &point_in_tabstrip_coords);
149 if (tabstrip_->HitTest(point_in_tabstrip_coords)) {
150 if (tabstrip_->IsPositionInWindowCaption(point_in_tabstrip_coords))
151 return HTCAPTION; 172 return HTCAPTION;
152 return HTCLIENT; 173 return HTCLIENT;
153 } 174 }
154 175
176 // If the tabstrip is visible and we are in compact navigation mode, test
177 // against the compact navigation and option bars.
178 if (browser_view_->UseCompactNavigationBar()) {
179 test_point = point;
180 if (ConvertedHitTest(parent, compact_navigation_bar_, &test_point))
181 return HTCLIENT;
182 test_point = point;
183 if (ConvertedHitTest(parent, compact_options_bar_, &test_point))
184 return HTCLIENT;
185 }
186
155 // The top few pixels of the TabStrip are a drop-shadow - as we're pretty 187 // The top few pixels of the TabStrip are a drop-shadow - as we're pretty
156 // starved of dragable area, let's give it to window dragging (this also 188 // starved of dragable area, let's give it to window dragging (this also
157 // makes sense visually). 189 // makes sense visually).
158 if (!browser_view_->IsMaximized() && 190 if (!browser_view_->IsMaximized() &&
159 (point_in_browser_view_coords.y() < 191 (point_in_browser_view_coords.y() <
160 (tabstrip_->y() + kTabShadowSize))) { 192 (tabstrip_->y() + kTabShadowSize))) {
161 // We return HTNOWHERE as this is a signal to our containing 193 // We return HTNOWHERE as this is a signal to our containing
162 // NonClientView that it should figure out what the correct hit-test 194 // NonClientView that it should figure out what the correct hit-test
163 // code is given the mouse position... 195 // code is given the mouse position...
164 return HTNOWHERE; 196 return HTNOWHERE;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // BrowserViewLayout, views::LayoutManager implementation: 229 // BrowserViewLayout, views::LayoutManager implementation:
198 230
199 void BrowserViewLayout::Installed(views::View* host) { 231 void BrowserViewLayout::Installed(views::View* host) {
200 toolbar_ = NULL; 232 toolbar_ = NULL;
201 contents_split_ = NULL; 233 contents_split_ = NULL;
202 contents_container_ = NULL; 234 contents_container_ = NULL;
203 infobar_container_ = NULL; 235 infobar_container_ = NULL;
204 download_shelf_ = NULL; 236 download_shelf_ = NULL;
205 active_bookmark_bar_ = NULL; 237 active_bookmark_bar_ = NULL;
206 tabstrip_ = NULL; 238 tabstrip_ = NULL;
239 compact_navigation_bar_ = NULL;
240 compact_options_bar_ = NULL;
241 spacer_ = NULL;
207 browser_view_ = static_cast<BrowserView*>(host); 242 browser_view_ = static_cast<BrowserView*>(host);
208 } 243 }
209 244
210 void BrowserViewLayout::Uninstalled(views::View* host) {} 245 void BrowserViewLayout::Uninstalled(views::View* host) {}
211 246
212 void BrowserViewLayout::ViewAdded(views::View* host, views::View* view) { 247 void BrowserViewLayout::ViewAdded(views::View* host, views::View* view) {
213 switch (view->GetID()) { 248 switch (view->GetID()) {
214 case VIEW_ID_CONTENTS_SPLIT: { 249 case VIEW_ID_CONTENTS_SPLIT: {
215 contents_split_ = static_cast<views::SingleSplitView*>(view); 250 contents_split_ = static_cast<views::SingleSplitView*>(view);
216 // We're installed as the LayoutManager before BrowserView creates the 251 // We're installed as the LayoutManager before BrowserView creates the
(...skipping 10 matching lines...) Expand all
227 break; 262 break;
228 case VIEW_ID_BOOKMARK_BAR: 263 case VIEW_ID_BOOKMARK_BAR:
229 active_bookmark_bar_ = static_cast<BookmarkBarView*>(view); 264 active_bookmark_bar_ = static_cast<BookmarkBarView*>(view);
230 break; 265 break;
231 case VIEW_ID_TOOLBAR: 266 case VIEW_ID_TOOLBAR:
232 toolbar_ = static_cast<ToolbarView*>(view); 267 toolbar_ = static_cast<ToolbarView*>(view);
233 break; 268 break;
234 case VIEW_ID_TAB_STRIP: 269 case VIEW_ID_TAB_STRIP:
235 tabstrip_ = static_cast<AbstractTabStripView*>(view); 270 tabstrip_ = static_cast<AbstractTabStripView*>(view);
236 break; 271 break;
272 case VIEW_ID_SPACER:
273 spacer_ = view;
274 break;
275 case VIEW_ID_COMPACT_NAV_BAR:
276 compact_navigation_bar_ = view;
277 break;
278 case VIEW_ID_COMPACT_OPT_BAR:
279 compact_options_bar_ = view;
280 break;
237 } 281 }
238 } 282 }
239 283
240 void BrowserViewLayout::ViewRemoved(views::View* host, views::View* view) { 284 void BrowserViewLayout::ViewRemoved(views::View* host, views::View* view) {
241 switch (view->GetID()) { 285 switch (view->GetID()) {
242 case VIEW_ID_BOOKMARK_BAR: 286 case VIEW_ID_BOOKMARK_BAR:
243 active_bookmark_bar_ = NULL; 287 active_bookmark_bar_ = NULL;
244 break; 288 break;
245 } 289 }
246 } 290 }
247 291
248 void BrowserViewLayout::Layout(views::View* host) { 292 void BrowserViewLayout::Layout(views::View* host) {
249 vertical_layout_rect_ = browser_view_->GetLocalBounds(); 293 vertical_layout_rect_ = browser_view_->GetLocalBounds();
250 int top = LayoutTabStrip(); 294 int top = LayoutTabStripRegion();
251 if (browser_view_->IsTabStripVisible() && !browser_view_->UseVerticalTabs()) { 295 if (browser_view_->IsTabStripVisible() && !browser_view_->UseVerticalTabs()) {
252 tabstrip_->SetBackgroundOffset(gfx::Point( 296 tabstrip_->SetBackgroundOffset(gfx::Point(
253 tabstrip_->GetMirroredX() + browser_view_->GetMirroredX(), 297 tabstrip_->GetMirroredX() + browser_view_->GetMirroredX(),
254 browser_view_->frame()->GetHorizontalTabStripVerticalOffset(false))); 298 browser_view_->frame()->GetHorizontalTabStripVerticalOffset(false)));
255 } 299 }
256 top = LayoutToolbar(top); 300 top = LayoutToolbar(top);
257 top = LayoutBookmarkAndInfoBars(top); 301 top = LayoutBookmarkAndInfoBars(top);
258 int bottom = LayoutDownloadShelf(browser_view_->height()); 302 int bottom = LayoutDownloadShelf(browser_view_->height());
259 int active_top_margin = GetTopMarginForActiveContent(); 303 int active_top_margin = GetTopMarginForActiveContent();
260 top -= active_top_margin; 304 top -= active_top_margin;
261 contents_container_->SetActiveTopMargin(active_top_margin); 305 contents_container_->SetActiveTopMargin(active_top_margin);
262 LayoutTabContents(top, bottom); 306 LayoutTabContents(top, bottom);
263 // This must be done _after_ we lay out the TabContents since this 307 // This must be done _after_ we lay out the TabContents since this
264 // code calls back into us to find the bounding box the find bar 308 // code calls back into us to find the bounding box the find bar
265 // must be laid out within, and that code depends on the 309 // must be laid out within, and that code depends on the
266 // TabContentsContainer's bounds being up to date. 310 // TabContentsContainer's bounds being up to date.
267 if (browser()->HasFindBarController()) { 311 if (browser()->HasFindBarController()) {
268 browser()->GetFindBarController()->find_bar()->MoveWindowIfNecessary( 312 browser()->GetFindBarController()->find_bar()->MoveWindowIfNecessary(
269 gfx::Rect(), true); 313 gfx::Rect(), true);
270 } 314 }
315 if (browser()->UseCompactNavigationBar()) {
316 DCHECK(browser_view_->compact_location_bar_view_host());
317 browser_view_->compact_location_bar_view_host()->MoveWindowIfNecessary(
318 gfx::Rect(), true);
319 }
271 } 320 }
272 321
273 // Return the preferred size which is the size required to give each 322 // Return the preferred size which is the size required to give each
274 // children their respective preferred size. 323 // children their respective preferred size.
275 gfx::Size BrowserViewLayout::GetPreferredSize(views::View* host) { 324 gfx::Size BrowserViewLayout::GetPreferredSize(views::View* host) {
276 return gfx::Size(); 325 return gfx::Size();
277 } 326 }
278 327
279 ////////////////////////////////////////////////////////////////////////////// 328 //////////////////////////////////////////////////////////////////////////////
280 // BrowserViewLayout, private: 329 // BrowserViewLayout, private:
281 330
282 Browser* BrowserViewLayout::browser() { 331 Browser* BrowserViewLayout::browser() {
283 return browser_view_->browser(); 332 return browser_view_->browser();
284 } 333 }
285 334
286 const Browser* BrowserViewLayout::browser() const { 335 const Browser* BrowserViewLayout::browser() const {
287 return browser_view_->browser(); 336 return browser_view_->browser();
288 } 337 }
289 338
290 int BrowserViewLayout::LayoutTabStrip() { 339 int BrowserViewLayout::LayoutTabStripRegion() {
291 if (!browser_view_->IsTabStripVisible()) { 340 if (!browser_view_->IsTabStripVisible()) {
341 compact_navigation_bar_->SetVisible(false);
sky 2011/05/03 18:38:32 Are we really always creating the compact nav clas
SteveT 2011/05/06 18:48:43 I agree with you here, though I am having troubles
sky 2011/05/06 19:56:06 Are you sure about that? The code for choosing sid
SteveT 2011/05/06 22:13:40 Ah, this was my bad - I was checking the pref (con
342 compact_options_bar_->SetVisible(false);
292 tabstrip_->SetVisible(false); 343 tabstrip_->SetVisible(false);
293 tabstrip_->SetBounds(0, 0, 0, 0); 344 tabstrip_->SetBounds(0, 0, 0, 0);
294 return 0; 345 return 0;
295 } 346 }
296 347
348 // This retrieves the bounds for the tab strip based on whether or not we show
349 // anything to the left of it, like the incognito avatar.
297 gfx::Rect tabstrip_bounds( 350 gfx::Rect tabstrip_bounds(
298 browser_view_->frame()->GetBoundsForTabStrip(tabstrip_)); 351 browser_view_->frame()->GetBoundsForTabStrip(tabstrip_));
299 gfx::Point tabstrip_origin(tabstrip_bounds.origin()); 352 gfx::Point tabstrip_origin(tabstrip_bounds.origin());
300 views::View::ConvertPointToView(browser_view_->parent(), browser_view_, 353 views::View::ConvertPointToView(browser_view_->parent(), browser_view_,
301 &tabstrip_origin); 354 &tabstrip_origin);
sky 2011/05/03 18:38:32 This spacing is preferable; leave it.
SteveT 2011/05/06 18:48:43 Done.
302 tabstrip_bounds.set_origin(tabstrip_origin); 355 tabstrip_bounds.set_origin(tabstrip_origin);
303 356
357 // If we are in compact nav mode, we want to reduce the tab strip bounds from
358 // both ends enough to lay out the compact navigation and options bars.
359 compact_navigation_bar_->SetVisible(browser_view_->UseCompactNavigationBar());
360 compact_options_bar_->SetVisible(browser_view_->UseCompactNavigationBar());
361 if (compact_navigation_bar_->IsVisible()) {
362 gfx::Rect cnav_bar_bounds;
363 gfx::Size cnav_bar_size = compact_navigation_bar_->GetPreferredSize();
364 cnav_bar_bounds.set_origin(tabstrip_bounds.origin());
365 cnav_bar_bounds.set_size(cnav_bar_size);
366 compact_navigation_bar_->SetBoundsRect(cnav_bar_bounds);
367
368 // The options bar is flush right of the tab strip region.
369 gfx::Rect copt_bar_bounds;
370 gfx::Size copt_bar_size = compact_options_bar_->GetPreferredSize();
371 copt_bar_bounds.set_x(std::max(0, tabstrip_bounds.right() -
372 copt_bar_size.width()));
373 copt_bar_bounds.set_y(tabstrip_origin.y());
374 copt_bar_bounds.set_size(copt_bar_size);
375 compact_options_bar_->SetBoundsRect(copt_bar_bounds);
376
377 // Reduce the bounds of the tab strip accordingly.
378 tabstrip_bounds.set_x(tabstrip_bounds.x() + cnav_bar_size.width() +
379 kCompactNavbarHorizontalPadding);
380 tabstrip_bounds.set_width(std::max(0, tabstrip_bounds.width() -
381 cnav_bar_size.width() - copt_bar_size.width() -
382 kCompactNavbarHorizontalPadding * 2));
383 }
384
304 if (browser_view_->UseVerticalTabs()) 385 if (browser_view_->UseVerticalTabs())
305 vertical_layout_rect_.Inset(tabstrip_bounds.width(), 0, 0, 0); 386 vertical_layout_rect_.Inset(tabstrip_bounds.width(), 0, 0, 0);
306 387
307 tabstrip_->SetVisible(true); 388 tabstrip_->SetVisible(true);
308 tabstrip_->SetBoundsRect(tabstrip_bounds); 389 tabstrip_->SetBoundsRect(tabstrip_bounds);
309 return browser_view_->UseVerticalTabs() ? 390 return browser_view_->UseVerticalTabs() ?
310 tabstrip_bounds.y() : tabstrip_bounds.bottom(); 391 tabstrip_bounds.y() : tabstrip_bounds.bottom();
311 } 392 }
312 393
313 int BrowserViewLayout::LayoutToolbar(int top) { 394 int BrowserViewLayout::LayoutToolbar(int top) {
314 int browser_view_width = vertical_layout_rect_.width(); 395 int browser_view_width = vertical_layout_rect_.width();
315 bool visible = browser_view_->IsToolbarVisible(); 396 bool toolbar_visible = browser_view_->IsToolbarVisible();
316 toolbar_->location_bar()->SetFocusable(visible); 397 toolbar_->location_bar()->SetFocusable(toolbar_visible);
317 int y = top; 398 int y = top;
318 if (!browser_view_->UseVerticalTabs()) { 399 if (!browser_view_->UseVerticalTabs()) {
319 y -= ((visible && browser_view_->IsTabStripVisible()) ? 400 y -= ((toolbar_visible || browser_view_->UseCompactNavigationBar()) &&
320 kToolbarTabStripVerticalOverlap : 0); 401 browser_view_->IsTabStripVisible()) ?
402 kToolbarTabStripVerticalOverlap : 0;
321 } 403 }
322 int height = visible ? toolbar_->GetPreferredSize().height() : 0; 404 int height = toolbar_visible ? toolbar_->GetPreferredSize().height() : 0;
323 toolbar_->SetVisible(visible); 405 toolbar_->SetVisible(toolbar_visible);
324 toolbar_->SetBounds(vertical_layout_rect_.x(), y, browser_view_width, height); 406 toolbar_->SetBounds(vertical_layout_rect_.x(), y, browser_view_width, height);
407
408 // The spacer essentially replaces the toolbar when in compact mode.
409 if (browser_view_->UseCompactNavigationBar()) {
410 spacer_->SetVisible(!toolbar_visible);
411 spacer_->SetBounds(vertical_layout_rect_.x(), y, browser_view_width,
412 toolbar_visible ? 0 : kCompactNavbarSpacerHeight);
413 height = kCompactNavbarSpacerHeight;
414 }
415
325 return y + height; 416 return y + height;
326 } 417 }
327 418
328 int BrowserViewLayout::LayoutBookmarkAndInfoBars(int top) { 419 int BrowserViewLayout::LayoutBookmarkAndInfoBars(int top) {
329 find_bar_y_ = top + browser_view_->y() - 1; 420 find_bar_y_ = top + browser_view_->y() - 1;
330 if (active_bookmark_bar_) { 421 if (active_bookmark_bar_) {
331 // If we're showing the Bookmark bar in detached style, then we 422 // If we're showing the Bookmark bar in detached style, then we
332 // need to show any Info bar _above_ the Bookmark bar, since the 423 // need to show any Info bar _above_ the Bookmark bar, since the
333 // Bookmark bar is styled to look like it's part of the page. 424 // Bookmark bar is styled to look like it's part of the page.
334 if (active_bookmark_bar_->IsDetached()) 425 if (active_bookmark_bar_->IsDetached())
335 return LayoutBookmarkBar(LayoutInfoBar(top)); 426 return LayoutBookmarkBar(LayoutInfoBar(top));
336 // Otherwise, Bookmark bar first, Info bar second. 427 // Otherwise, Bookmark bar first, Info bar second.
337 top = std::max(toolbar_->bounds().bottom(), LayoutBookmarkBar(top)); 428 top = std::max(toolbar_->bounds().bottom(), LayoutBookmarkBar(top));
338 } 429 }
339 find_bar_y_ = top + browser_view_->y() - 1; 430 find_bar_y_ = top + browser_view_->y() - 1;
340 return LayoutInfoBar(top); 431 return LayoutInfoBar(top);
341 } 432 }
342 433
343 int BrowserViewLayout::LayoutBookmarkBar(int top) { 434 int BrowserViewLayout::LayoutBookmarkBar(int top) {
344 DCHECK(active_bookmark_bar_); 435 DCHECK(active_bookmark_bar_);
345 int y = top; 436 int y = top;
346 if (!browser_view_->IsBookmarkBarVisible()) { 437 if (!browser_view_->IsBookmarkBarVisible()) {
347 active_bookmark_bar_->SetVisible(false); 438 active_bookmark_bar_->SetVisible(false);
348 active_bookmark_bar_->SetBounds(0, y, browser_view_->width(), 0); 439 active_bookmark_bar_->SetBounds(0, y, browser_view_->width(), 0);
349 return y; 440 return y;
350 } 441 }
351 442
352 active_bookmark_bar_->set_infobar_visible(InfobarVisible()); 443 active_bookmark_bar_->set_infobar_visible(InfobarVisible());
353 int bookmark_bar_height = active_bookmark_bar_->GetPreferredSize().height(); 444 int bookmark_bar_height = active_bookmark_bar_->GetPreferredSize().height();
354 y -= views::NonClientFrameView::kClientEdgeThickness + 445 if (!browser_view_->UseCompactNavigationBar()) {
355 active_bookmark_bar_->GetToolbarOverlap(false); 446 y -= views::NonClientFrameView::kClientEdgeThickness +
447 active_bookmark_bar_->GetToolbarOverlap(false);
448 } else {
449 y -= kSpacerBookmarkBarOverlap;
450 }
356 active_bookmark_bar_->SetVisible(true); 451 active_bookmark_bar_->SetVisible(true);
357 active_bookmark_bar_->SetBounds(vertical_layout_rect_.x(), y, 452 active_bookmark_bar_->SetBounds(vertical_layout_rect_.x(), y,
358 vertical_layout_rect_.width(), 453 vertical_layout_rect_.width(),
359 bookmark_bar_height); 454 bookmark_bar_height);
360 return y + bookmark_bar_height; 455 return y + bookmark_bar_height;
361 } 456 }
362 457
363 int BrowserViewLayout::LayoutInfoBar(int top) { 458 int BrowserViewLayout::LayoutInfoBar(int top) {
364 // Raise the |infobar_container_| by its vertical overlap. 459 // Raise the |infobar_container_| by its vertical overlap.
365 infobar_container_->SetVisible(InfobarVisible()); 460 infobar_container_->SetVisible(InfobarVisible());
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 bottom -= height; 615 bottom -= height;
521 } 616 }
522 return bottom; 617 return bottom;
523 } 618 }
524 619
525 bool BrowserViewLayout::InfobarVisible() const { 620 bool BrowserViewLayout::InfobarVisible() const {
526 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. 621 // NOTE: Can't check if the size IsEmpty() since it's always 0-width.
527 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && 622 return browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR) &&
528 (infobar_container_->GetPreferredSize().height() != 0); 623 (infobar_container_->GetPreferredSize().height() != 0);
529 } 624 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698