| 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_finder.h" | 9 #include "chrome/browser/ui/browser_finder.h" |
| 10 #include "chrome/browser/ui/find_bar/find_bar.h" | 10 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 11 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 11 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 12 #include "chrome/browser/ui/search/search_model.h" | 12 #include "chrome/browser/ui/search/search_model.h" |
| 13 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" | 13 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
| 14 #include "chrome/browser/ui/views/download/download_shelf_view.h" | 14 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
| 15 #include "chrome/browser/ui/views/frame/browser_frame.h" | 15 #include "chrome/browser/ui/views/frame/browser_frame.h" |
| 16 #include "chrome/browser/ui/views/frame/browser_view.h" | 16 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 17 #include "chrome/browser/ui/views/frame/contents_container.h" | 17 #include "chrome/browser/ui/views/frame/contents_container.h" |
| 18 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 18 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
| 19 #include "chrome/browser/ui/views/frame/top_container_view.h" | 19 #include "chrome/browser/ui/views/frame/top_container_view.h" |
| 20 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" | 20 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" |
| 21 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 21 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 22 #include "chrome/browser/ui/views/toolbar_view.h" | 22 #include "chrome/browser/ui/views/toolbar_view.h" |
| 23 #include "chrome/browser/ui/web_contents_modal_dialog_host.h" | 23 #include "components/web_modal/web_contents_modal_dialog_host.h" |
| 24 #include "ui/base/hit_test.h" | 24 #include "ui/base/hit_test.h" |
| 25 #include "ui/gfx/point.h" | 25 #include "ui/gfx/point.h" |
| 26 #include "ui/gfx/scrollbar_size.h" | 26 #include "ui/gfx/scrollbar_size.h" |
| 27 #include "ui/gfx/size.h" | 27 #include "ui/gfx/size.h" |
| 28 #include "ui/views/controls/single_split_view.h" | 28 #include "ui/views/controls/single_split_view.h" |
| 29 #include "ui/views/controls/webview/webview.h" | 29 #include "ui/views/controls/webview/webview.h" |
| 30 | 30 |
| 31 using views::View; | 31 using views::View; |
| 32 using web_modal::WebContentsModalDialogHost; |
| 33 using web_modal::WebContentsModalDialogHostObserver; |
| 32 | 34 |
| 33 namespace { | 35 namespace { |
| 34 | 36 |
| 35 // The visible height of the shadow above the tabs. Clicks in this area are | 37 // The visible height of the shadow above the tabs. Clicks in this area are |
| 36 // treated as clicks to the frame, rather than clicks to the tab. | 38 // treated as clicks to the frame, rather than clicks to the tab. |
| 37 const int kTabShadowSize = 2; | 39 const int kTabShadowSize = 2; |
| 38 // The number of pixels the bookmark bar should overlap the spacer by if the | 40 // The number of pixels the bookmark bar should overlap the spacer by if the |
| 39 // spacer is visible. | 41 // spacer is visible. |
| 40 const int kSpacerBookmarkBarOverlap = 1; | 42 const int kSpacerBookmarkBarOverlap = 1; |
| 41 // The number of pixels the metro switcher is offset from the right edge. | 43 // The number of pixels the metro switcher is offset from the right edge. |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 return bottom; | 576 return bottom; |
| 575 } | 577 } |
| 576 | 578 |
| 577 bool BrowserViewLayout::InfobarVisible() const { | 579 bool BrowserViewLayout::InfobarVisible() const { |
| 578 // Cast to a views::View to access GetPreferredSize(). | 580 // Cast to a views::View to access GetPreferredSize(). |
| 579 views::View* infobar_container = infobar_container_; | 581 views::View* infobar_container = infobar_container_; |
| 580 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. | 582 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. |
| 581 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 583 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && |
| 582 (infobar_container->GetPreferredSize().height() != 0); | 584 (infobar_container->GetPreferredSize().height() != 0); |
| 583 } | 585 } |
| OLD | NEW |