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

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 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
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 // Position the find bar above the bottom of the top container so that it
230 // so that it occludes the border between the content area and the top 228 // occludes the border between the content area and the top container. The
231 // container and looks connected to the top container. 229 // find bar should look connected to the top container when material design
232 find_bar_y = top_container_bounds.bottom() - 1; 230 // is not enabled.
231 find_bar_y = top_container_bounds.bottom() -
232 GetLayoutConstant(FIND_BAR_VERTICAL_OFFSET);
Peter Kasting 2015/10/09 22:15:06 It seems like this is more an "overlap" value than
varkha 2015/10/13 14:51:13 Done. I've left the part about connected look when
233 } 233 }
234 234
235 // Grow the height of |bounding_box| by the height of any elements between 235 // 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 236 // the top container and |contents_container_| such as the detached bookmark
237 // bar and any infobars. 237 // bar and any infobars.
238 int height_delta = bounding_box.y() - find_bar_y; 238 int height_delta = bounding_box.y() - find_bar_y;
239 bounding_box.set_y(find_bar_y); 239 bounding_box.set_y(find_bar_y);
240 bounding_box.set_height(std::max(0, bounding_box.height() + height_delta)); 240 bounding_box.set_height(std::max(0, bounding_box.height() + height_delta));
241 241
242 // Finally decrease the width of the bounding box by the width of 242 // 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; 541 return bottom;
542 } 542 }
543 543
544 bool BrowserViewLayout::InfobarVisible() const { 544 bool BrowserViewLayout::InfobarVisible() const {
545 // Cast to a views::View to access GetPreferredSize(). 545 // Cast to a views::View to access GetPreferredSize().
546 views::View* infobar_container = infobar_container_; 546 views::View* infobar_container = infobar_container_;
547 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. 547 // NOTE: Can't check if the size IsEmpty() since it's always 0-width.
548 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && 548 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) &&
549 (infobar_container->GetPreferredSize().height() != 0); 549 (infobar_container->GetPreferredSize().height() != 0);
550 } 550 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698