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/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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 bookmark_bar_->visible() && | 179 bookmark_bar_->visible() && |
180 browser()->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR)) { | 180 browser()->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR)) { |
181 bookmark_bar_size = bookmark_bar_->GetMinimumSize(); | 181 bookmark_bar_size = bookmark_bar_->GetMinimumSize(); |
182 bookmark_bar_size.Enlarge(0, -bookmark_bar_->GetToolbarOverlap()); | 182 bookmark_bar_size.Enlarge(0, -bookmark_bar_->GetToolbarOverlap()); |
183 } | 183 } |
184 gfx::Size infobar_container_size(infobar_container_->GetMinimumSize()); | 184 gfx::Size infobar_container_size(infobar_container_->GetMinimumSize()); |
185 // TODO: Adjust the minimum height for the find bar. | 185 // TODO: Adjust the minimum height for the find bar. |
186 | 186 |
187 gfx::Size contents_size(contents_container_->GetMinimumSize()); | 187 gfx::Size contents_size(contents_container_->GetMinimumSize()); |
188 | 188 |
189 int min_height = delegate_->GetTopInsetInBrowserView() + | 189 int min_height = delegate_->GetTopInsetInBrowserView(false) + |
190 tabstrip_size.height() + toolbar_size.height() + | 190 tabstrip_size.height() + toolbar_size.height() + |
191 bookmark_bar_size.height() + infobar_container_size.height() + | 191 bookmark_bar_size.height() + infobar_container_size.height() + |
192 contents_size.height(); | 192 contents_size.height(); |
193 int widths[] = { | 193 int widths[] = { |
194 tabstrip_size.width(), | 194 tabstrip_size.width(), |
195 toolbar_size.width(), | 195 toolbar_size.width(), |
196 bookmark_bar_size.width(), | 196 bookmark_bar_size.width(), |
197 infobar_container_size.width(), | 197 infobar_container_size.width(), |
198 contents_size.width() }; | 198 contents_size.width() }; |
199 int min_width = *std::max_element(&widths[0], &widths[arraysize(widths)]); | 199 int min_width = *std::max_element(&widths[0], &widths[arraysize(widths)]); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
311 | 311 |
312 // If the point is somewhere else, delegate to the default implementation. | 312 // If the point is somewhere else, delegate to the default implementation. |
313 return browser_view_->views::ClientView::NonClientHitTest(point); | 313 return browser_view_->views::ClientView::NonClientHitTest(point); |
314 } | 314 } |
315 | 315 |
316 ////////////////////////////////////////////////////////////////////////////// | 316 ////////////////////////////////////////////////////////////////////////////// |
317 // BrowserViewLayout, views::LayoutManager implementation: | 317 // BrowserViewLayout, views::LayoutManager implementation: |
318 | 318 |
319 void BrowserViewLayout::Layout(views::View* browser_view) { | 319 void BrowserViewLayout::Layout(views::View* browser_view) { |
320 vertical_layout_rect_ = browser_view->GetLocalBounds(); | 320 vertical_layout_rect_ = browser_view->GetLocalBounds(); |
321 int top = delegate_->GetTopInsetInBrowserView(); | 321 int top = delegate_->GetTopInsetInBrowserView(false); |
322 top = LayoutTabStripRegion(top); | 322 top = LayoutTabStripRegion(top); |
323 if (delegate_->IsTabStripVisible()) { | 323 if (delegate_->IsTabStripVisible()) { |
324 int x = tab_strip_->GetMirroredX() + | 324 int x = tab_strip_->GetMirroredX() + |
325 browser_view_->GetMirroredX() + | 325 browser_view_->GetMirroredX() + |
326 delegate_->GetThemeBackgroundXInset(); | 326 delegate_->GetThemeBackgroundXInset(); |
327 int y = browser_view_->y() + delegate_->GetTopInsetInBrowserView(); | 327 int y = browser_view_->y() + delegate_->GetTopInsetInBrowserView(true); |
sky
2015/11/06 16:49:48
This looks so wrong. 321 supplies false, and this
Peter Kasting
2015/11/06 22:04:03
Sure, will add.
In brief, the summary is:
* "fals
| |
328 tab_strip_->SetBackgroundOffset(gfx::Point(x, y)); | 328 tab_strip_->SetBackgroundOffset(gfx::Point(x, y)); |
329 } | 329 } |
330 top = LayoutToolbar(top); | 330 top = LayoutToolbar(top); |
331 | 331 |
332 top = LayoutBookmarkAndInfoBars(top, browser_view->y()); | 332 top = LayoutBookmarkAndInfoBars(top, browser_view->y()); |
333 | 333 |
334 // Top container requires updated toolbar and bookmark bar to compute bounds. | 334 // Top container requires updated toolbar and bookmark bar to compute bounds. |
335 UpdateTopContainerBounds(); | 335 UpdateTopContainerBounds(); |
336 | 336 |
337 int bottom = LayoutDownloadShelf(browser_view->height()); | 337 int bottom = LayoutDownloadShelf(browser_view->height()); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
492 if (!child->visible()) | 492 if (!child->visible()) |
493 continue; | 493 continue; |
494 int child_bottom = child->bounds().bottom(); | 494 int child_bottom = child->bounds().bottom(); |
495 if (child_bottom > height) | 495 if (child_bottom > height) |
496 height = child_bottom; | 496 height = child_bottom; |
497 } | 497 } |
498 | 498 |
499 // Ensure that the top container view reaches the topmost view in the | 499 // Ensure that the top container view reaches the topmost view in the |
500 // ClientView because the bounds of the top container view are used in | 500 // ClientView because the bounds of the top container view are used in |
501 // layout and we assume that this is the case. | 501 // layout and we assume that this is the case. |
502 height = std::max(height, delegate_->GetTopInsetInBrowserView()); | 502 height = std::max(height, delegate_->GetTopInsetInBrowserView(false)); |
503 | 503 |
504 gfx::Rect top_container_bounds(vertical_layout_rect_.width(), height); | 504 gfx::Rect top_container_bounds(vertical_layout_rect_.width(), height); |
505 | 505 |
506 // If the immersive mode controller is animating the top container, it may be | 506 // If the immersive mode controller is animating the top container, it may be |
507 // partly offscreen. | 507 // partly offscreen. |
508 top_container_bounds.set_y( | 508 top_container_bounds.set_y( |
509 immersive_mode_controller_->GetTopContainerVerticalOffset( | 509 immersive_mode_controller_->GetTopContainerVerticalOffset( |
510 top_container_bounds.size())); | 510 top_container_bounds.size())); |
511 top_container_->SetBoundsRect(top_container_bounds); | 511 top_container_->SetBoundsRect(top_container_bounds); |
512 } | 512 } |
(...skipping 27 matching lines...) Expand all Loading... | |
540 return bottom; | 540 return bottom; |
541 } | 541 } |
542 | 542 |
543 bool BrowserViewLayout::InfobarVisible() const { | 543 bool BrowserViewLayout::InfobarVisible() const { |
544 // Cast to a views::View to access GetPreferredSize(). | 544 // Cast to a views::View to access GetPreferredSize(). |
545 views::View* infobar_container = infobar_container_; | 545 views::View* infobar_container = infobar_container_; |
546 // 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. |
547 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 547 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && |
548 (infobar_container->GetPreferredSize().height() != 0); | 548 (infobar_container->GetPreferredSize().height() != 0); |
549 } | 549 } |
OLD | NEW |