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

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: couple more 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; 405 int y = top;
Peter Kasting 2016/09/22 23:27:24 Nit: Just use |top| directly below
Evan Stade 2016/09/23 00:31:07 Done.
408 y -= (toolbar_visible && delegate_->IsTabStripVisible()) ?
409 GetLayoutConstant(TABSTRIP_TOOLBAR_OVERLAP) : 0;
410 int height = toolbar_visible ? toolbar_->GetPreferredSize().height() : 0; 406 int height = toolbar_visible ? toolbar_->GetPreferredSize().height() : 0;
411 toolbar_->SetVisible(toolbar_visible); 407 toolbar_->SetVisible(toolbar_visible);
412 toolbar_->SetBounds(vertical_layout_rect_.x(), y, browser_view_width, height); 408 toolbar_->SetBounds(vertical_layout_rect_.x(), y, browser_view_width, height);
413 409
414 return y + height; 410 return y + height;
415 } 411 }
416 412
417 int BrowserViewLayout::LayoutBookmarkAndInfoBars(int top, int browser_view_y) { 413 int BrowserViewLayout::LayoutBookmarkAndInfoBars(int top, int browser_view_y) {
418 web_contents_modal_dialog_top_y_ = 414 web_contents_modal_dialog_top_y_ =
419 top + browser_view_y - kConstrainedWindowOverlap; 415 top + browser_view_y - kConstrainedWindowOverlap;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 return bottom; 540 return bottom;
545 } 541 }
546 542
547 bool BrowserViewLayout::InfobarVisible() const { 543 bool BrowserViewLayout::InfobarVisible() const {
548 // Cast to a views::View to access GetPreferredSize(). 544 // Cast to a views::View to access GetPreferredSize().
549 views::View* infobar_container = infobar_container_; 545 views::View* infobar_container = infobar_container_;
550 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. 546 // NOTE: Can't check if the size IsEmpty() since it's always 0-width.
551 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && 547 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) &&
552 (infobar_container->GetPreferredSize().height() != 0); 548 (infobar_container->GetPreferredSize().height() != 0);
553 } 549 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698