Chromium Code Reviews| 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" |
| 11 #include "chrome/browser/ui/browser_finder.h" | 11 #include "chrome/browser/ui/browser_finder.h" |
| 12 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
| 13 #include "chrome/browser/ui/find_bar/find_bar.h" | 13 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 14 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 14 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 15 #include "chrome/browser/ui/layout_constants.h" | |
| 16 #include "chrome/browser/ui/search/search_model.h" | 15 #include "chrome/browser/ui/search/search_model.h" |
| 17 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" | 16 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
| 18 #include "chrome/browser/ui/views/download/download_shelf_view.h" | 17 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
| 19 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" | 18 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" |
| 20 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" | 19 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" |
| 21 #include "chrome/browser/ui/views/frame/contents_layout_manager.h" | 20 #include "chrome/browser/ui/views/frame/contents_layout_manager.h" |
| 22 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 21 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
| 23 #include "chrome/browser/ui/views/frame/top_container_view.h" | 22 #include "chrome/browser/ui/views/frame/top_container_view.h" |
| 24 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" | 23 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" |
| 25 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 24 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 !immersive_mode_controller_->IsRevealed()) { | 216 !immersive_mode_controller_->IsRevealed()) { |
| 218 // Position the find bar exactly below the top container. In immersive | 217 // Position the find bar exactly below the top container. In immersive |
| 219 // fullscreen, when the top-of-window views are not revealed, only the | 218 // fullscreen, when the top-of-window views are not revealed, only the |
| 220 // miniature immersive style tab strip is visible. Do not overlap the | 219 // miniature immersive style tab strip is visible. Do not overlap the |
| 221 // find bar and the tab strip. | 220 // find bar and the tab strip. |
| 222 find_bar_y = top_container_bounds.bottom(); | 221 find_bar_y = top_container_bounds.bottom(); |
| 223 } else { | 222 } else { |
| 224 // Overlap the find bar atop |top_container_|. | 223 // Overlap the find bar atop |top_container_|. |
| 225 // The find bar should look connected to the top container when material | 224 // The find bar should look connected to the top container when material |
| 226 // design is not enabled. | 225 // design is not enabled. |
| 227 find_bar_y = top_container_bounds.bottom() - | 226 const int kOverlapDip = 6; |
|
Peter Kasting
2016/12/08 20:57:49
Nit: Dip suffix optional (I don't mind it, but mos
Evan Stade
2016/12/13 01:31:17
I guess I thought "kOverlap" was insufficiently de
| |
| 228 GetLayoutConstant(FIND_BAR_TOOLBAR_OVERLAP); | 227 find_bar_y = top_container_bounds.bottom() - kOverlapDip; |
| 229 } | 228 } |
| 230 | 229 |
| 231 // Grow the height of |bounding_box| by the height of any elements between | 230 // 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 | 231 // the top container and |contents_container_| such as the detached bookmark |
| 233 // bar and any infobars. | 232 // bar and any infobars. |
| 234 int height_delta = bounding_box.y() - find_bar_y; | 233 int height_delta = bounding_box.y() - find_bar_y; |
| 235 bounding_box.set_y(find_bar_y); | 234 bounding_box.set_y(find_bar_y); |
| 236 bounding_box.set_height(std::max(0, bounding_box.height() + height_delta)); | 235 bounding_box.set_height(std::max(0, bounding_box.height() + height_delta)); |
| 237 | 236 |
| 238 // Finally decrease the width of the bounding box by the width of | 237 // 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; | 536 return bottom; |
| 538 } | 537 } |
| 539 | 538 |
| 540 bool BrowserViewLayout::InfobarVisible() const { | 539 bool BrowserViewLayout::InfobarVisible() const { |
| 541 // Cast to a views::View to access GetPreferredSize(). | 540 // Cast to a views::View to access GetPreferredSize(). |
| 542 views::View* infobar_container = infobar_container_; | 541 views::View* infobar_container = infobar_container_; |
| 543 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. | 542 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. |
| 544 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 543 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && |
| 545 (infobar_container->GetPreferredSize().height() != 0); | 544 (infobar_container->GetPreferredSize().height() != 0); |
| 546 } | 545 } |
| OLD | NEW |