Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 48963002: [Refactor] Move the non-browser specific logic of ImmersiveModeControllerAsh into ash part 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 if (selected_web_contents) 960 if (selected_web_contents)
961 selected_web_contents->GetView()->RestoreFocus(); 961 selected_web_contents->GetView()->RestoreFocus();
962 } 962 }
963 963
964 void BrowserView::SetWindowSwitcherButton(views::Button* button) { 964 void BrowserView::SetWindowSwitcherButton(views::Button* button) {
965 if (window_switcher_button_) 965 if (window_switcher_button_)
966 RemoveChildView(window_switcher_button_); 966 RemoveChildView(window_switcher_button_);
967 window_switcher_button_ = button; 967 window_switcher_button_ = button;
968 } 968 }
969 969
970 void BrowserView::FullscreenStateChanged() {
971 CHECK(!IsFullscreen());
972 ProcessFullscreen(false, FOR_DESKTOP, GURL(), FEB_TYPE_NONE);
973 }
974
970 void BrowserView::ToolbarSizeChanged(bool is_animating) { 975 void BrowserView::ToolbarSizeChanged(bool is_animating) {
971 // The call to InfoBarContainer::SetMaxTopArrowHeight() below can result in 976 // The call to InfoBarContainer::SetMaxTopArrowHeight() below can result in
972 // reentrancy; |call_state| tracks whether we're reentrant. We can't just 977 // reentrancy; |call_state| tracks whether we're reentrant. We can't just
973 // early-return in this case because we need to layout again so the infobar 978 // early-return in this case because we need to layout again so the infobar
974 // container's bounds are set correctly. 979 // container's bounds are set correctly.
975 static CallState call_state = NORMAL; 980 static CallState call_state = NORMAL;
976 981
977 // A reentrant call can (and should) use the fast resize path unless both it 982 // A reentrant call can (and should) use the fast resize path unless both it
978 // and the normal call are both non-animating. 983 // and the normal call are both non-animating.
979 bool use_fast_resize = 984 bool use_fast_resize =
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.h ('k') | chrome/browser/ui/views/frame/browser_view_layout_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698