| 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" |
| 11 #include "chrome/browser/ui/browser_window.h" | 11 #include "chrome/browser/ui/browser_window.h" |
| 12 #include "chrome/browser/ui/find_bar/find_bar.h" | 12 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 13 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 13 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 14 #include "chrome/browser/ui/search/search_model.h" | 14 #include "chrome/browser/ui/search/search_model.h" |
| 15 #include "chrome/browser/ui/view_ids.h" |
| 15 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" | 16 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
| 16 #include "chrome/browser/ui/views/download/download_shelf_view.h" | 17 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
| 17 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" | 18 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" |
| 18 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" | 19 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" |
| 19 #include "chrome/browser/ui/views/frame/contents_layout_manager.h" | 20 #include "chrome/browser/ui/views/frame/contents_layout_manager.h" |
| 20 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 21 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
| 21 #include "chrome/browser/ui/views/frame/top_container_view.h" | 22 #include "chrome/browser/ui/views/frame/top_container_view.h" |
| 22 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" | 23 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" |
| 23 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 24 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 24 #include "components/web_modal/web_contents_modal_dialog_host.h" | 25 #include "components/web_modal/web_contents_modal_dialog_host.h" |
| 25 #include "ui/base/hit_test.h" | 26 #include "ui/base/hit_test.h" |
| 26 #include "ui/base/resource/material_design/material_design_controller.h" | 27 #include "ui/base/resource/material_design/material_design_controller.h" |
| 27 #include "ui/gfx/geometry/point.h" | 28 #include "ui/gfx/geometry/point.h" |
| 28 #include "ui/gfx/geometry/size.h" | 29 #include "ui/gfx/geometry/size.h" |
| 29 #include "ui/gfx/scrollbar_size.h" | 30 #include "ui/gfx/scrollbar_size.h" |
| 31 #include "ui/views/controls/single_split_view.h" |
| 30 #include "ui/views/controls/webview/webview.h" | 32 #include "ui/views/controls/webview/webview.h" |
| 31 #include "ui/views/widget/widget.h" | 33 #include "ui/views/widget/widget.h" |
| 32 #include "ui/views/window/client_view.h" | 34 #include "ui/views/window/client_view.h" |
| 33 | 35 |
| 34 using views::View; | 36 using views::View; |
| 35 using web_modal::WebContentsModalDialogHost; | 37 using web_modal::WebContentsModalDialogHost; |
| 36 using web_modal::ModalDialogHostObserver; | 38 using web_modal::ModalDialogHostObserver; |
| 37 | 39 |
| 38 namespace { | 40 namespace { |
| 39 | 41 |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 if (exclusive_access_bubble) | 364 if (exclusive_access_bubble) |
| 363 exclusive_access_bubble->RepositionIfVisible(); | 365 exclusive_access_bubble->RepositionIfVisible(); |
| 364 | 366 |
| 365 // Adjust any hosted dialogs if the browser's dialog hosting bounds changed. | 367 // Adjust any hosted dialogs if the browser's dialog hosting bounds changed. |
| 366 const gfx::Rect dialog_bounds(dialog_host_->GetDialogPosition(gfx::Size()), | 368 const gfx::Rect dialog_bounds(dialog_host_->GetDialogPosition(gfx::Size()), |
| 367 dialog_host_->GetMaximumDialogSize()); | 369 dialog_host_->GetMaximumDialogSize()); |
| 368 if (latest_dialog_bounds_ != dialog_bounds) { | 370 if (latest_dialog_bounds_ != dialog_bounds) { |
| 369 latest_dialog_bounds_ = dialog_bounds; | 371 latest_dialog_bounds_ = dialog_bounds; |
| 370 dialog_host_->NotifyPositionRequiresUpdate(); | 372 dialog_host_->NotifyPositionRequiresUpdate(); |
| 371 } | 373 } |
| 374 |
| 375 views::SingleSplitView* ssplitview = |
| 376 (views::SingleSplitView*)contents_container_; |
| 377 views::View* sidebar_web_view = |
| 378 browser_view_->GetViewByID(VIEW_ID_SIDE_BAR_VIEW); |
| 379 if (ssplitview && sidebar_web_view && sidebar_web_view->visible()) { |
| 380 int width = (contents_container_->width() - ssplitview->divider_offset()); |
| 381 sidebar_web_view->SetBoundsRect( |
| 382 gfx::Rect(0, 0, width, contents_container_->height())); |
| 383 } |
| 372 } | 384 } |
| 373 | 385 |
| 374 // Return the preferred size which is the size required to give each | 386 // Return the preferred size which is the size required to give each |
| 375 // children their respective preferred size. | 387 // children their respective preferred size. |
| 376 gfx::Size BrowserViewLayout::GetPreferredSize(const views::View* host) const { | 388 gfx::Size BrowserViewLayout::GetPreferredSize(const views::View* host) const { |
| 377 return gfx::Size(); | 389 return gfx::Size(); |
| 378 } | 390 } |
| 379 | 391 |
| 380 ////////////////////////////////////////////////////////////////////////////// | 392 ////////////////////////////////////////////////////////////////////////////// |
| 381 // BrowserViewLayout, private: | 393 // BrowserViewLayout, private: |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 return bottom; | 555 return bottom; |
| 544 } | 556 } |
| 545 | 557 |
| 546 bool BrowserViewLayout::InfobarVisible() const { | 558 bool BrowserViewLayout::InfobarVisible() const { |
| 547 // Cast to a views::View to access GetPreferredSize(). | 559 // Cast to a views::View to access GetPreferredSize(). |
| 548 views::View* infobar_container = infobar_container_; | 560 views::View* infobar_container = infobar_container_; |
| 549 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. | 561 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. |
| 550 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 562 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && |
| 551 (infobar_container->GetPreferredSize().height() != 0); | 563 (infobar_container->GetPreferredSize().height() != 0); |
| 552 } | 564 } |
| OLD | NEW |