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.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
959 if (selected_web_contents) | 959 if (selected_web_contents) |
960 selected_web_contents->GetView()->RestoreFocus(); | 960 selected_web_contents->GetView()->RestoreFocus(); |
961 } | 961 } |
962 | 962 |
963 void BrowserView::SetWindowSwitcherButton(views::Button* button) { | 963 void BrowserView::SetWindowSwitcherButton(views::Button* button) { |
964 if (window_switcher_button_) | 964 if (window_switcher_button_) |
965 RemoveChildView(window_switcher_button_); | 965 RemoveChildView(window_switcher_button_); |
966 window_switcher_button_ = button; | 966 window_switcher_button_ = button; |
967 } | 967 } |
968 | 968 |
969 void BrowserView::FullscreenStateChanged() { | |
970 CHECK(!IsFullscreen()); | |
971 ProcessFullscreen(false, FOR_DESKTOP, GURL(), FEB_TYPE_NONE); | |
972 } | |
973 | |
969 void BrowserView::ToolbarSizeChanged(bool is_animating) { | 974 void BrowserView::ToolbarSizeChanged(bool is_animating) { |
970 // The call to InfoBarContainer::SetMaxTopArrowHeight() below can result in | 975 // The call to InfoBarContainer::SetMaxTopArrowHeight() below can result in |
971 // reentrancy; |call_state| tracks whether we're reentrant. We can't just | 976 // reentrancy; |call_state| tracks whether we're reentrant. We can't just |
972 // early-return in this case because we need to layout again so the infobar | 977 // early-return in this case because we need to layout again so the infobar |
973 // container's bounds are set correctly. | 978 // container's bounds are set correctly. |
974 static CallState call_state = NORMAL; | 979 static CallState call_state = NORMAL; |
975 | 980 |
976 // A reentrant call can (and should) use the fast resize path unless both it | 981 // A reentrant call can (and should) use the fast resize path unless both it |
977 // and the normal call are both non-animating. | 982 // and the normal call are both non-animating. |
978 bool use_fast_resize = | 983 bool use_fast_resize = |
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1857 return chrome::ExecuteCommand(browser_.get(), command_id); | 1862 return chrome::ExecuteCommand(browser_.get(), command_id); |
1858 } | 1863 } |
1859 | 1864 |
1860 /////////////////////////////////////////////////////////////////////////////// | 1865 /////////////////////////////////////////////////////////////////////////////// |
1861 // BrowserView, OmniboxPopupModelObserver overrides: | 1866 // BrowserView, OmniboxPopupModelObserver overrides: |
1862 void BrowserView::OnOmniboxPopupShownOrHidden() { | 1867 void BrowserView::OnOmniboxPopupShownOrHidden() { |
1863 infobar_container_->SetMaxTopArrowHeight(GetMaxTopInfoBarArrowHeight()); | 1868 infobar_container_->SetMaxTopArrowHeight(GetMaxTopInfoBarArrowHeight()); |
1864 } | 1869 } |
1865 | 1870 |
1866 /////////////////////////////////////////////////////////////////////////////// | 1871 /////////////////////////////////////////////////////////////////////////////// |
1867 // BrowserView, ImmersiveModeController::Delegate overrides: | |
1868 | |
1869 FullscreenController* BrowserView::GetFullscreenController() { | |
1870 // Cannot be injected into ImmersiveModeController because it is constructed | |
1871 // after BrowserView. | |
1872 return browser()->fullscreen_controller(); | |
1873 } | |
1874 | |
1875 void BrowserView::FullscreenStateChanged() { | |
1876 if (IsFullscreen()) { | |
1877 ProcessFullscreen(true, FOR_DESKTOP, GURL(), | |
1878 FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION); | |
1879 } else { | |
1880 ProcessFullscreen(false, FOR_DESKTOP, GURL(), FEB_TYPE_NONE); | |
1881 } | |
1882 } | |
1883 | |
1884 void BrowserView::SetImmersiveStyle(bool immersive) { | |
1885 // Only the tab strip changes its painting style for immersive fullscreen. | |
1886 if (tabstrip_) | |
1887 tabstrip_->SetImmersiveStyle(immersive); | |
1888 } | |
1889 | |
1890 WebContents* BrowserView::GetWebContents() { | |
1891 return GetActiveWebContents(); | |
1892 } | |
1893 | |
1894 /////////////////////////////////////////////////////////////////////////////// | |
1895 // BrowserView, InfoBarContainer::Delegate overrides: | 1872 // BrowserView, InfoBarContainer::Delegate overrides: |
1896 | 1873 |
1897 SkColor BrowserView::GetInfoBarSeparatorColor() const { | 1874 SkColor BrowserView::GetInfoBarSeparatorColor() const { |
1898 // NOTE: Keep this in sync with ToolbarView::OnPaint()! | 1875 // NOTE: Keep this in sync with ToolbarView::OnPaint()! |
1899 return (IsTabStripVisible() || !frame_->ShouldUseNativeFrame()) ? | 1876 return (IsTabStripVisible() || !frame_->ShouldUseNativeFrame()) ? |
1900 ThemeProperties::GetDefaultColor( | 1877 ThemeProperties::GetDefaultColor( |
1901 ThemeProperties::COLOR_TOOLBAR_SEPARATOR) : | 1878 ThemeProperties::COLOR_TOOLBAR_SEPARATOR) : |
1902 SK_ColorBLACK; | 1879 SK_ColorBLACK; |
1903 } | 1880 } |
1904 | 1881 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2002 toolbar_->Init(); | 1979 toolbar_->Init(); |
2003 | 1980 |
2004 // Create do-nothing view for the sake of controlling the z-order of the find | 1981 // Create do-nothing view for the sake of controlling the z-order of the find |
2005 // bar widget. | 1982 // bar widget. |
2006 find_bar_host_view_ = new View(); | 1983 find_bar_host_view_ = new View(); |
2007 AddChildView(find_bar_host_view_); | 1984 AddChildView(find_bar_host_view_); |
2008 | 1985 |
2009 if (window_switcher_button_) | 1986 if (window_switcher_button_) |
2010 AddChildView(window_switcher_button_); | 1987 AddChildView(window_switcher_button_); |
2011 | 1988 |
2012 immersive_mode_controller_->Init(this, GetWidget(), top_container_); | 1989 immersive_mode_controller_->Init(this); |
James Cook
2013/10/28 18:32:51
Do you need the whole BrowserView, or can you just
| |
2013 | 1990 |
2014 BrowserViewLayout* browser_view_layout = new BrowserViewLayout; | 1991 BrowserViewLayout* browser_view_layout = new BrowserViewLayout; |
2015 browser_view_layout->Init(new BrowserViewLayoutDelegateImpl(this), | 1992 browser_view_layout->Init(new BrowserViewLayoutDelegateImpl(this), |
2016 browser(), | 1993 browser(), |
2017 this, | 1994 this, |
2018 top_container_, | 1995 top_container_, |
2019 tabstrip_, | 1996 tabstrip_, |
2020 toolbar_, | 1997 toolbar_, |
2021 infobar_container_, | 1998 infobar_container_, |
2022 contents_split_, | 1999 contents_split_, |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2693 // The +1 in the next line creates a 1-px gap between icon and arrow tip. | 2670 // The +1 in the next line creates a 1-px gap between icon and arrow tip. |
2694 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - | 2671 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - |
2695 LocationBarView::kIconInternalPadding + 1); | 2672 LocationBarView::kIconInternalPadding + 1); |
2696 ConvertPointToTarget(location_icon_view, this, &icon_bottom); | 2673 ConvertPointToTarget(location_icon_view, this, &icon_bottom); |
2697 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2674 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2698 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2675 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2699 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2676 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2700 } | 2677 } |
2701 return top_arrow_height; | 2678 return top_arrow_height; |
2702 } | 2679 } |
OLD | NEW |