| 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 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 if (selected_web_contents) | 961 if (selected_web_contents) |
| 962 selected_web_contents->GetView()->RestoreFocus(); | 962 selected_web_contents->GetView()->RestoreFocus(); |
| 963 } | 963 } |
| 964 | 964 |
| 965 void BrowserView::SetWindowSwitcherButton(views::Button* button) { | 965 void BrowserView::SetWindowSwitcherButton(views::Button* button) { |
| 966 if (window_switcher_button_) | 966 if (window_switcher_button_) |
| 967 RemoveChildView(window_switcher_button_); | 967 RemoveChildView(window_switcher_button_); |
| 968 window_switcher_button_ = button; | 968 window_switcher_button_ = button; |
| 969 } | 969 } |
| 970 | 970 |
| 971 void BrowserView::FullscreenStateChanged() { |
| 972 CHECK(!IsFullscreen()); |
| 973 ProcessFullscreen(false, FOR_DESKTOP, GURL(), FEB_TYPE_NONE); |
| 974 } |
| 975 |
| 971 void BrowserView::ToolbarSizeChanged(bool is_animating) { | 976 void BrowserView::ToolbarSizeChanged(bool is_animating) { |
| 972 // The call to InfoBarContainer::SetMaxTopArrowHeight() below can result in | 977 // The call to InfoBarContainer::SetMaxTopArrowHeight() below can result in |
| 973 // reentrancy; |call_state| tracks whether we're reentrant. We can't just | 978 // reentrancy; |call_state| tracks whether we're reentrant. We can't just |
| 974 // early-return in this case because we need to layout again so the infobar | 979 // early-return in this case because we need to layout again so the infobar |
| 975 // container's bounds are set correctly. | 980 // container's bounds are set correctly. |
| 976 static CallState call_state = NORMAL; | 981 static CallState call_state = NORMAL; |
| 977 | 982 |
| 978 // A reentrant call can (and should) use the fast resize path unless both it | 983 // A reentrant call can (and should) use the fast resize path unless both it |
| 979 // and the normal call are both non-animating. | 984 // and the normal call are both non-animating. |
| 980 bool use_fast_resize = | 985 bool use_fast_resize = |
| (...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1871 return chrome::ExecuteCommand(browser_.get(), command_id); | 1876 return chrome::ExecuteCommand(browser_.get(), command_id); |
| 1872 } | 1877 } |
| 1873 | 1878 |
| 1874 /////////////////////////////////////////////////////////////////////////////// | 1879 /////////////////////////////////////////////////////////////////////////////// |
| 1875 // BrowserView, OmniboxPopupModelObserver overrides: | 1880 // BrowserView, OmniboxPopupModelObserver overrides: |
| 1876 void BrowserView::OnOmniboxPopupShownOrHidden() { | 1881 void BrowserView::OnOmniboxPopupShownOrHidden() { |
| 1877 infobar_container_->SetMaxTopArrowHeight(GetMaxTopInfoBarArrowHeight()); | 1882 infobar_container_->SetMaxTopArrowHeight(GetMaxTopInfoBarArrowHeight()); |
| 1878 } | 1883 } |
| 1879 | 1884 |
| 1880 /////////////////////////////////////////////////////////////////////////////// | 1885 /////////////////////////////////////////////////////////////////////////////// |
| 1881 // BrowserView, ImmersiveModeController::Delegate overrides: | |
| 1882 | |
| 1883 FullscreenController* BrowserView::GetFullscreenController() { | |
| 1884 // Cannot be injected into ImmersiveModeController because it is constructed | |
| 1885 // after BrowserView. | |
| 1886 return browser()->fullscreen_controller(); | |
| 1887 } | |
| 1888 | |
| 1889 void BrowserView::FullscreenStateChanged() { | |
| 1890 if (IsFullscreen()) { | |
| 1891 ProcessFullscreen(true, FOR_DESKTOP, GURL(), | |
| 1892 FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION); | |
| 1893 } else { | |
| 1894 ProcessFullscreen(false, FOR_DESKTOP, GURL(), FEB_TYPE_NONE); | |
| 1895 } | |
| 1896 } | |
| 1897 | |
| 1898 void BrowserView::SetImmersiveStyle(bool immersive) { | |
| 1899 // Only the tab strip changes its painting style for immersive fullscreen. | |
| 1900 if (tabstrip_) | |
| 1901 tabstrip_->SetImmersiveStyle(immersive); | |
| 1902 } | |
| 1903 | |
| 1904 WebContents* BrowserView::GetWebContents() { | |
| 1905 return GetActiveWebContents(); | |
| 1906 } | |
| 1907 | |
| 1908 /////////////////////////////////////////////////////////////////////////////// | |
| 1909 // BrowserView, InfoBarContainer::Delegate overrides: | 1886 // BrowserView, InfoBarContainer::Delegate overrides: |
| 1910 | 1887 |
| 1911 SkColor BrowserView::GetInfoBarSeparatorColor() const { | 1888 SkColor BrowserView::GetInfoBarSeparatorColor() const { |
| 1912 // NOTE: Keep this in sync with ToolbarView::OnPaint()! | 1889 // NOTE: Keep this in sync with ToolbarView::OnPaint()! |
| 1913 return (IsTabStripVisible() || !frame_->ShouldUseNativeFrame()) ? | 1890 return (IsTabStripVisible() || !frame_->ShouldUseNativeFrame()) ? |
| 1914 ThemeProperties::GetDefaultColor( | 1891 ThemeProperties::GetDefaultColor( |
| 1915 ThemeProperties::COLOR_TOOLBAR_SEPARATOR) : | 1892 ThemeProperties::COLOR_TOOLBAR_SEPARATOR) : |
| 1916 SK_ColorBLACK; | 1893 SK_ColorBLACK; |
| 1917 } | 1894 } |
| 1918 | 1895 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2016 toolbar_->Init(); | 1993 toolbar_->Init(); |
| 2017 | 1994 |
| 2018 // Create do-nothing view for the sake of controlling the z-order of the find | 1995 // Create do-nothing view for the sake of controlling the z-order of the find |
| 2019 // bar widget. | 1996 // bar widget. |
| 2020 find_bar_host_view_ = new View(); | 1997 find_bar_host_view_ = new View(); |
| 2021 AddChildView(find_bar_host_view_); | 1998 AddChildView(find_bar_host_view_); |
| 2022 | 1999 |
| 2023 if (window_switcher_button_) | 2000 if (window_switcher_button_) |
| 2024 AddChildView(window_switcher_button_); | 2001 AddChildView(window_switcher_button_); |
| 2025 | 2002 |
| 2026 immersive_mode_controller_->Init(this, GetWidget(), top_container_); | 2003 immersive_mode_controller_->Init(this); |
| 2027 | 2004 |
| 2028 BrowserViewLayout* browser_view_layout = new BrowserViewLayout; | 2005 BrowserViewLayout* browser_view_layout = new BrowserViewLayout; |
| 2029 browser_view_layout->Init(new BrowserViewLayoutDelegateImpl(this), | 2006 browser_view_layout->Init(new BrowserViewLayoutDelegateImpl(this), |
| 2030 browser(), | 2007 browser(), |
| 2031 this, | 2008 this, |
| 2032 top_container_, | 2009 top_container_, |
| 2033 tabstrip_, | 2010 tabstrip_, |
| 2034 toolbar_, | 2011 toolbar_, |
| 2035 infobar_container_, | 2012 infobar_container_, |
| 2036 contents_split_, | 2013 contents_split_, |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2707 // The +1 in the next line creates a 1-px gap between icon and arrow tip. | 2684 // The +1 in the next line creates a 1-px gap between icon and arrow tip. |
| 2708 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - | 2685 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - |
| 2709 LocationBarView::kIconInternalPadding + 1); | 2686 LocationBarView::kIconInternalPadding + 1); |
| 2710 ConvertPointToTarget(location_icon_view, this, &icon_bottom); | 2687 ConvertPointToTarget(location_icon_view, this, &icon_bottom); |
| 2711 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2688 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
| 2712 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2689 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
| 2713 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2690 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
| 2714 } | 2691 } |
| 2715 return top_arrow_height; | 2692 return top_arrow_height; |
| 2716 } | 2693 } |
| OLD | NEW |