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

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

Issue 2360803002: Remove some pre-MD code from toolbar/tabstrip/frame. (Closed)
Patch Set: pkasting review Created 4 years, 3 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
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/macros.h" 7 #include "base/macros.h"
8 #include "base/observer_list.h" 8 #include "base/observer_list.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 166 }
167 167
168 gfx::Size BrowserViewLayout::GetMinimumSize() { 168 gfx::Size BrowserViewLayout::GetMinimumSize() {
169 gfx::Size tabstrip_size( 169 gfx::Size tabstrip_size(
170 browser()->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) ? 170 browser()->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) ?
171 tab_strip_->GetMinimumSize() : gfx::Size()); 171 tab_strip_->GetMinimumSize() : gfx::Size());
172 gfx::Size toolbar_size( 172 gfx::Size toolbar_size(
173 (browser()->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) || 173 (browser()->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) ||
174 browser()->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)) ? 174 browser()->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)) ?
175 toolbar_->GetMinimumSize() : gfx::Size()); 175 toolbar_->GetMinimumSize() : gfx::Size());
176 if (tabstrip_size.height() && toolbar_size.height())
177 toolbar_size.Enlarge(0, -GetLayoutConstant(TABSTRIP_TOOLBAR_OVERLAP));
178 gfx::Size bookmark_bar_size; 176 gfx::Size bookmark_bar_size;
179 if (bookmark_bar_ && 177 if (bookmark_bar_ &&
180 bookmark_bar_->visible() && 178 bookmark_bar_->visible() &&
181 browser()->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR)) { 179 browser()->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR)) {
182 bookmark_bar_size = bookmark_bar_->GetMinimumSize(); 180 bookmark_bar_size = bookmark_bar_->GetMinimumSize();
183 bookmark_bar_size.Enlarge(0, -bookmark_bar_->GetToolbarOverlap()); 181 bookmark_bar_size.Enlarge(0, -bookmark_bar_->GetToolbarOverlap());
184 } 182 }
185 gfx::Size infobar_container_size(infobar_container_->GetMinimumSize()); 183 gfx::Size infobar_container_size(infobar_container_->GetMinimumSize());
186 // TODO: Adjust the minimum height for the find bar. 184 // TODO: Adjust the minimum height for the find bar.
187 185
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 395
398 tab_strip_->SetVisible(true); 396 tab_strip_->SetVisible(true);
399 tab_strip_->SetBoundsRect(tabstrip_bounds); 397 tab_strip_->SetBoundsRect(tabstrip_bounds);
400 398
401 return tabstrip_bounds.bottom(); 399 return tabstrip_bounds.bottom();
402 } 400 }
403 401
404 int BrowserViewLayout::LayoutToolbar(int top) { 402 int BrowserViewLayout::LayoutToolbar(int top) {
405 int browser_view_width = vertical_layout_rect_.width(); 403 int browser_view_width = vertical_layout_rect_.width();
406 bool toolbar_visible = delegate_->IsToolbarVisible(); 404 bool toolbar_visible = delegate_->IsToolbarVisible();
407 int y = top;
408 y -= (toolbar_visible && delegate_->IsTabStripVisible()) ?
409 GetLayoutConstant(TABSTRIP_TOOLBAR_OVERLAP) : 0;
410 int height = toolbar_visible ? toolbar_->GetPreferredSize().height() : 0; 405 int height = toolbar_visible ? toolbar_->GetPreferredSize().height() : 0;
411 toolbar_->SetVisible(toolbar_visible); 406 toolbar_->SetVisible(toolbar_visible);
412 toolbar_->SetBounds(vertical_layout_rect_.x(), y, browser_view_width, height); 407 toolbar_->SetBounds(vertical_layout_rect_.x(), top, browser_view_width,
413 408 height);
414 return y + height; 409 return toolbar_->bounds().bottom();
415 } 410 }
416 411
417 int BrowserViewLayout::LayoutBookmarkAndInfoBars(int top, int browser_view_y) { 412 int BrowserViewLayout::LayoutBookmarkAndInfoBars(int top, int browser_view_y) {
418 web_contents_modal_dialog_top_y_ = 413 web_contents_modal_dialog_top_y_ =
419 top + browser_view_y - kConstrainedWindowOverlap; 414 top + browser_view_y - kConstrainedWindowOverlap;
420 415
421 if (bookmark_bar_) { 416 if (bookmark_bar_) {
422 // If we're showing the Bookmark bar in detached style, then we 417 // If we're showing the Bookmark bar in detached style, then we
423 // need to show any Info bar _above_ the Bookmark bar, since the 418 // need to show any Info bar _above_ the Bookmark bar, since the
424 // Bookmark bar is styled to look like it's part of the page. 419 // Bookmark bar is styled to look like it's part of the page.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 return bottom; 539 return bottom;
545 } 540 }
546 541
547 bool BrowserViewLayout::InfobarVisible() const { 542 bool BrowserViewLayout::InfobarVisible() const {
548 // Cast to a views::View to access GetPreferredSize(). 543 // Cast to a views::View to access GetPreferredSize().
549 views::View* infobar_container = infobar_container_; 544 views::View* infobar_container = infobar_container_;
550 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. 545 // NOTE: Can't check if the size IsEmpty() since it's always 0-width.
551 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && 546 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) &&
552 (infobar_container->GetPreferredSize().height() != 0); 547 (infobar_container->GetPreferredSize().height() != 0);
553 } 548 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698