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/views/bookmarks/bookmark_bar_view.h" | 15 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
| 16 #include "chrome/browser/ui/views/download/download_shelf_view.h" | 16 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
| 17 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" | 17 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" |
| 18 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" | 18 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" |
| 19 #include "chrome/browser/ui/views/frame/contents_layout_manager.h" | 19 #include "chrome/browser/ui/views/frame/contents_layout_manager.h" |
| 20 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 20 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
| 21 #include "chrome/browser/ui/views/frame/top_container_view.h" | 21 #include "chrome/browser/ui/views/frame/top_container_view.h" |
| 22 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" | 22 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" |
| 23 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 23 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 24 #include "components/web_modal/web_contents_modal_dialog_host.h" | 24 #include "components/web_modal/web_contents_modal_dialog_host.h" |
| 25 #include "ui/base/hit_test.h" | 25 #include "ui/base/hit_test.h" |
| 26 #include "ui/base/material_design/material_design_controller.h" | |
| 27 #include "ui/gfx/geometry/point.h" | 26 #include "ui/gfx/geometry/point.h" |
| 28 #include "ui/gfx/geometry/size.h" | 27 #include "ui/gfx/geometry/size.h" |
| 29 #include "ui/gfx/scrollbar_size.h" | 28 #include "ui/gfx/scrollbar_size.h" |
| 30 #include "ui/views/controls/webview/webview.h" | 29 #include "ui/views/controls/webview/webview.h" |
| 31 #include "ui/views/widget/widget.h" | 30 #include "ui/views/widget/widget.h" |
| 32 #include "ui/views/window/client_view.h" | 31 #include "ui/views/window/client_view.h" |
| 33 | 32 |
| 34 using views::View; | 33 using views::View; |
| 35 using web_modal::WebContentsModalDialogHost; | 34 using web_modal::WebContentsModalDialogHost; |
| 36 using web_modal::ModalDialogHostObserver; | 35 using web_modal::ModalDialogHostObserver; |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 482 int height = 0; | 481 int height = 0; |
| 483 for (int i = 0; i < top_container_->child_count(); ++i) { | 482 for (int i = 0; i < top_container_->child_count(); ++i) { |
| 484 views::View* child = top_container_->child_at(i); | 483 views::View* child = top_container_->child_at(i); |
| 485 if (!child->visible()) | 484 if (!child->visible()) |
| 486 continue; | 485 continue; |
| 487 int child_bottom = child->bounds().bottom(); | 486 int child_bottom = child->bounds().bottom(); |
| 488 if (child_bottom > height) | 487 if (child_bottom > height) |
| 489 height = child_bottom; | 488 height = child_bottom; |
| 490 } | 489 } |
| 491 | 490 |
| 491 // For immersive fullscreen, tabstrip is considered visible. During the | |
| 492 // |height| update, the non-zero |height| should return to zero instead. | |
| 493 if (immersive_mode_controller_->IsEnabled() && | |
|
sky
2017/02/13 16:57:19
How did pre-md immersive inject a height of 3?
Qiang(Joe) Xu
2017/02/13 21:21:08
It is because: https://cs.chromium.org/chromium/sr
| |
| 494 !immersive_mode_controller_->IsRevealed()) { | |
| 495 height = 0; | |
| 496 } | |
| 497 | |
| 492 // Ensure that the top container view reaches the topmost view in the | 498 // Ensure that the top container view reaches the topmost view in the |
| 493 // ClientView because the bounds of the top container view are used in | 499 // ClientView because the bounds of the top container view are used in |
| 494 // layout and we assume that this is the case. | 500 // layout and we assume that this is the case. |
| 495 height = std::max(height, delegate_->GetTopInsetInBrowserView(false)); | 501 height = std::max(height, delegate_->GetTopInsetInBrowserView(false)); |
| 496 | 502 |
| 497 gfx::Rect top_container_bounds(vertical_layout_rect_.width(), height); | 503 gfx::Rect top_container_bounds(vertical_layout_rect_.width(), height); |
| 498 | 504 |
| 499 // If the immersive mode controller is animating the top container, it may be | 505 // If the immersive mode controller is animating the top container, it may be |
| 500 // partly offscreen. | 506 // partly offscreen. |
| 501 top_container_bounds.set_y( | 507 top_container_bounds.set_y( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 return bottom; | 539 return bottom; |
| 534 } | 540 } |
| 535 | 541 |
| 536 bool BrowserViewLayout::InfobarVisible() const { | 542 bool BrowserViewLayout::InfobarVisible() const { |
| 537 // Cast to a views::View to access GetPreferredSize(). | 543 // Cast to a views::View to access GetPreferredSize(). |
| 538 views::View* infobar_container = infobar_container_; | 544 views::View* infobar_container = infobar_container_; |
| 539 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. | 545 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. |
| 540 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 546 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && |
| 541 (infobar_container->GetPreferredSize().height() != 0); | 547 (infobar_container->GetPreferredSize().height() != 0); |
| 542 } | 548 } |
| OLD | NEW |