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

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

Issue 1395193002: Fixes BrowserViewHostedAppTest.Layout when using MD (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes BrowserViewHostedAppTest.Layout when using MD (post-LGTM comments) Created 5 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/frame/browser_view_unittest.cc » ('j') | 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 top_container_->GetLocalBounds()); 216 top_container_->GetLocalBounds());
217 217
218 int find_bar_y = 0; 218 int find_bar_y = 0;
219 if (immersive_mode_controller_->IsEnabled() && 219 if (immersive_mode_controller_->IsEnabled() &&
220 !immersive_mode_controller_->IsRevealed()) { 220 !immersive_mode_controller_->IsRevealed()) {
221 // Position the find bar exactly below the top container. In immersive 221 // Position the find bar exactly below the top container. In immersive
222 // fullscreen, when the top-of-window views are not revealed, only the 222 // fullscreen, when the top-of-window views are not revealed, only the
223 // miniature immersive style tab strip is visible. Do not overlap the 223 // miniature immersive style tab strip is visible. Do not overlap the
224 // find bar and the tab strip. 224 // find bar and the tab strip.
225 find_bar_y = top_container_bounds.bottom(); 225 find_bar_y = top_container_bounds.bottom();
226 } else if (ui::MaterialDesignController::IsModeMaterial()) {
227 find_bar_y = top_container_bounds.bottom() - 6;
228 } else { 226 } else {
229 // Position the find bar 1 pixel above the bottom of the top container 227 // Overlap the find bar atop |top_container_|.
230 // so that it occludes the border between the content area and the top 228 // The find bar should look connected to the top container when material
231 // container and looks connected to the top container. 229 // design is not enabled.
232 find_bar_y = top_container_bounds.bottom() - 1; 230 find_bar_y = top_container_bounds.bottom() -
231 GetLayoutConstant(FIND_BAR_TOOLBAR_OVERLAP);
233 } 232 }
234 233
235 // Grow the height of |bounding_box| by the height of any elements between 234 // Grow the height of |bounding_box| by the height of any elements between
236 // the top container and |contents_container_| such as the detached bookmark 235 // the top container and |contents_container_| such as the detached bookmark
237 // bar and any infobars. 236 // bar and any infobars.
238 int height_delta = bounding_box.y() - find_bar_y; 237 int height_delta = bounding_box.y() - find_bar_y;
239 bounding_box.set_y(find_bar_y); 238 bounding_box.set_y(find_bar_y);
240 bounding_box.set_height(std::max(0, bounding_box.height() + height_delta)); 239 bounding_box.set_height(std::max(0, bounding_box.height() + height_delta));
241 240
242 // Finally decrease the width of the bounding box by the width of 241 // Finally decrease the width of the bounding box by the width of
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 return bottom; 540 return bottom;
542 } 541 }
543 542
544 bool BrowserViewLayout::InfobarVisible() const { 543 bool BrowserViewLayout::InfobarVisible() const {
545 // Cast to a views::View to access GetPreferredSize(). 544 // Cast to a views::View to access GetPreferredSize().
546 views::View* infobar_container = infobar_container_; 545 views::View* infobar_container = infobar_container_;
547 // 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.
548 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && 547 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) &&
549 (infobar_container->GetPreferredSize().height() != 0); 548 (infobar_container->GetPreferredSize().height() != 0);
550 } 549 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/frame/browser_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698