| OLD | NEW |
| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 !immersive_mode_controller_->IsRevealed()) { | 217 !immersive_mode_controller_->IsRevealed()) { |
| 218 // Position the find bar exactly below the top container. In immersive | 218 // Position the find bar exactly below the top container. In immersive |
| 219 // fullscreen, when the top-of-window views are not revealed, only the | 219 // fullscreen, when the top-of-window views are not revealed, only the |
| 220 // miniature immersive style tab strip is visible. Do not overlap the | 220 // miniature immersive style tab strip is visible. Do not overlap the |
| 221 // find bar and the tab strip. | 221 // find bar and the tab strip. |
| 222 find_bar_y = top_container_bounds.bottom(); | 222 find_bar_y = top_container_bounds.bottom(); |
| 223 } else { | 223 } else { |
| 224 // Overlap the find bar atop |top_container_|. | 224 // Overlap the find bar atop |top_container_|. |
| 225 // The find bar should look connected to the top container when material | 225 // The find bar should look connected to the top container when material |
| 226 // design is not enabled. | 226 // design is not enabled. |
| 227 find_bar_y = top_container_bounds.bottom() - | 227 const int kOverlapDip = 6; |
| 228 GetLayoutConstant(FIND_BAR_TOOLBAR_OVERLAP); | 228 find_bar_y = top_container_bounds.bottom() - kOverlapDip; |
| 229 } | 229 } |
| 230 | 230 |
| 231 // Grow the height of |bounding_box| by the height of any elements between | 231 // Grow the height of |bounding_box| by the height of any elements between |
| 232 // the top container and |contents_container_| such as the detached bookmark | 232 // the top container and |contents_container_| such as the detached bookmark |
| 233 // bar and any infobars. | 233 // bar and any infobars. |
| 234 int height_delta = bounding_box.y() - find_bar_y; | 234 int height_delta = bounding_box.y() - find_bar_y; |
| 235 bounding_box.set_y(find_bar_y); | 235 bounding_box.set_y(find_bar_y); |
| 236 bounding_box.set_height(std::max(0, bounding_box.height() + height_delta)); | 236 bounding_box.set_height(std::max(0, bounding_box.height() + height_delta)); |
| 237 | 237 |
| 238 // Finally decrease the width of the bounding box by the width of | 238 // Finally decrease the width of the bounding box by the width of |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 return bottom; | 537 return bottom; |
| 538 } | 538 } |
| 539 | 539 |
| 540 bool BrowserViewLayout::InfobarVisible() const { | 540 bool BrowserViewLayout::InfobarVisible() const { |
| 541 // Cast to a views::View to access GetPreferredSize(). | 541 // Cast to a views::View to access GetPreferredSize(). |
| 542 views::View* infobar_container = infobar_container_; | 542 views::View* infobar_container = infobar_container_; |
| 543 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. | 543 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. |
| 544 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 544 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && |
| 545 (infobar_container->GetPreferredSize().height() != 0); | 545 (infobar_container->GetPreferredSize().height() != 0); |
| 546 } | 546 } |
| OLD | NEW |