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

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

Issue 16021009: Redo display of web contents modal dialog under the bookmark bar (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Handle detached bookmarks bar Created 7 years, 6 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
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view_layout.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/frame/browser_view_layout.h" 5 #include "chrome/browser/ui/views/frame/browser_view_layout.h"
6 6
7 #include "base/observer_list.h" 7 #include "base/observer_list.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_finder.h" 10 #include "chrome/browser/ui/browser_finder.h"
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 int top = LayoutTabStripRegion(browser_view); 326 int top = LayoutTabStripRegion(browser_view);
327 if (delegate_->IsTabStripVisible()) { 327 if (delegate_->IsTabStripVisible()) {
328 int x = tab_strip_->GetMirroredX() + 328 int x = tab_strip_->GetMirroredX() +
329 browser_view_->GetMirroredX() + 329 browser_view_->GetMirroredX() +
330 browser_view_->frame()->GetThemeBackgroundXInset(); 330 browser_view_->frame()->GetThemeBackgroundXInset();
331 tab_strip_->SetBackgroundOffset( 331 tab_strip_->SetBackgroundOffset(
332 gfx::Point(x, browser_view_->frame()->GetTabStripInsets(false).top)); 332 gfx::Point(x, browser_view_->frame()->GetTabStripInsets(false).top));
333 } 333 }
334 top = LayoutToolbar(top); 334 top = LayoutToolbar(top);
335 335
336 web_contents_modal_dialog_top_y_ =
337 top + browser_view->y() - kConstrainedWindowOverlap;
338
339 // Overlay container requires updated toolbar bounds to determine its 336 // Overlay container requires updated toolbar bounds to determine its
340 // position, and needs to be laid out before: 337 // position, and needs to be laid out before:
341 // - GetTopMarginForActiveContent(), which calls GetInstantUIState() to check 338 // - GetTopMarginForActiveContent(), which calls GetInstantUIState() to check
342 // if overlay container is visible 339 // if overlay container is visible
343 // - LayoutInfoBar(): children of infobar container will layout and call 340 // - LayoutInfoBar(): children of infobar container will layout and call
344 // BrowserView::DrawInfoBarArrows(), which checks if overlay container is 341 // BrowserView::DrawInfoBarArrows(), which checks if overlay container is
345 // visible. 342 // visible.
346 LayoutOverlayContainer(); 343 LayoutOverlayContainer();
347 344
348 top = LayoutBookmarkAndInfoBars(top); 345 top = LayoutBookmarkAndInfoBars(top, browser_view->y());
349 346
350 // Top container requires updated toolbar and bookmark bar to compute size. 347 // Top container requires updated toolbar and bookmark bar to compute size.
351 top_container_->SetSize(top_container_->GetPreferredSize()); 348 top_container_->SetSize(top_container_->GetPreferredSize());
352 349
353 int bottom = LayoutDownloadShelf(browser_view->height()); 350 int bottom = LayoutDownloadShelf(browser_view->height());
354 // Treat a detached bookmark bar as if the web contents container is shifted 351 // Treat a detached bookmark bar as if the web contents container is shifted
355 // upwards and overlaps it. 352 // upwards and overlaps it.
356 top -= GetContentsOffsetForBookmarkBar(); 353 top -= GetContentsOffsetForBookmarkBar();
357 LayoutContentsSplitView(top, bottom); 354 LayoutContentsSplitView(top, bottom);
358 355
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 int y = top; 439 int y = top;
443 y -= (toolbar_visible && delegate_->IsTabStripVisible()) ? 440 y -= (toolbar_visible && delegate_->IsTabStripVisible()) ?
444 kToolbarTabStripVerticalOverlap : 0; 441 kToolbarTabStripVerticalOverlap : 0;
445 int height = toolbar_visible ? toolbar_->GetPreferredSize().height() : 0; 442 int height = toolbar_visible ? toolbar_->GetPreferredSize().height() : 0;
446 toolbar_->SetVisible(toolbar_visible); 443 toolbar_->SetVisible(toolbar_visible);
447 toolbar_->SetBounds(vertical_layout_rect_.x(), y, browser_view_width, height); 444 toolbar_->SetBounds(vertical_layout_rect_.x(), y, browser_view_width, height);
448 445
449 return y + height; 446 return y + height;
450 } 447 }
451 448
452 int BrowserViewLayout::LayoutBookmarkAndInfoBars(int top) { 449 int BrowserViewLayout::LayoutBookmarkAndInfoBars(int top, int browser_view_y) {
453 if (bookmark_bar_) { 450 if (bookmark_bar_) {
454 // If we're showing the Bookmark bar in detached style, then we 451 // If we're showing the Bookmark bar in detached style, then we
455 // need to show any Info bar _above_ the Bookmark bar, since the 452 // need to show any Info bar _above_ the Bookmark bar, since the
456 // Bookmark bar is styled to look like it's part of the page. 453 // Bookmark bar is styled to look like it's part of the page.
457 if (bookmark_bar_->IsDetached()) 454 if (bookmark_bar_->IsDetached()) {
455 web_contents_modal_dialog_top_y_ =
456 top + browser_view_y - kConstrainedWindowOverlap;
458 return LayoutBookmarkBar(LayoutInfoBar(top)); 457 return LayoutBookmarkBar(LayoutInfoBar(top));
458 }
459 // Otherwise, Bookmark bar first, Info bar second. 459 // Otherwise, Bookmark bar first, Info bar second.
460 top = std::max(toolbar_->bounds().bottom(), LayoutBookmarkBar(top)); 460 top = std::max(toolbar_->bounds().bottom(), LayoutBookmarkBar(top));
461 } 461 }
462
463 web_contents_modal_dialog_top_y_ =
464 top + browser_view_y - kConstrainedWindowOverlap;
465
462 return LayoutInfoBar(top); 466 return LayoutInfoBar(top);
463 } 467 }
464 468
465 int BrowserViewLayout::LayoutBookmarkBar(int top) { 469 int BrowserViewLayout::LayoutBookmarkBar(int top) {
466 int y = top; 470 int y = top;
467 if (!delegate_->IsBookmarkBarVisible()) { 471 if (!delegate_->IsBookmarkBarVisible()) {
468 bookmark_bar_->SetVisible(false); 472 bookmark_bar_->SetVisible(false);
469 // TODO(jamescook): Don't change the bookmark bar height when it is 473 // TODO(jamescook): Don't change the bookmark bar height when it is
470 // invisible, so we can use its height for layout even in that state. 474 // invisible, so we can use its height for layout even in that state.
471 bookmark_bar_->SetBounds(0, y, browser_view_->width(), 0); 475 bookmark_bar_->SetBounds(0, y, browser_view_->width(), 0);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 return bottom; 617 return bottom;
614 } 618 }
615 619
616 bool BrowserViewLayout::InfobarVisible() const { 620 bool BrowserViewLayout::InfobarVisible() const {
617 // Cast to a views::View to access GetPreferredSize(). 621 // Cast to a views::View to access GetPreferredSize().
618 views::View* infobar_container = infobar_container_; 622 views::View* infobar_container = infobar_container_;
619 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. 623 // NOTE: Can't check if the size IsEmpty() since it's always 0-width.
620 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && 624 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) &&
621 (infobar_container->GetPreferredSize().height() != 0); 625 (infobar_container->GetPreferredSize().height() != 0);
622 } 626 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view_layout.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698