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

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

Issue 793783003: Move infobar constants and the code that uses them from components/ to chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NULL -> nullptr Created 6 years 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
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 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 if (selected_web_contents) 950 if (selected_web_contents)
951 selected_web_contents->RestoreFocus(); 951 selected_web_contents->RestoreFocus();
952 } 952 }
953 953
954 void BrowserView::FullscreenStateChanged() { 954 void BrowserView::FullscreenStateChanged() {
955 CHECK(!IsFullscreen()); 955 CHECK(!IsFullscreen());
956 ProcessFullscreen(false, NORMAL_FULLSCREEN, GURL(), FEB_TYPE_NONE); 956 ProcessFullscreen(false, NORMAL_FULLSCREEN, GURL(), FEB_TYPE_NONE);
957 } 957 }
958 958
959 void BrowserView::ToolbarSizeChanged(bool is_animating) { 959 void BrowserView::ToolbarSizeChanged(bool is_animating) {
960 // The call to InfoBarContainer::SetMaxTopArrowHeight() below can result in 960 // The call to SetMaxTopArrowHeight() below can result in reentrancy;
961 // reentrancy; |call_state| tracks whether we're reentrant. We can't just 961 // |call_state| tracks whether we're reentrant. We can't just early-return in
962 // early-return in this case because we need to layout again so the infobar 962 // this case because we need to layout again so the infobar container's bounds
963 // container's bounds are set correctly. 963 // are set correctly.
964 static CallState call_state = NORMAL; 964 static CallState call_state = NORMAL;
965 965
966 // A reentrant call can (and should) use the fast resize path unless both it 966 // A reentrant call can (and should) use the fast resize path unless both it
967 // and the normal call are both non-animating. 967 // and the normal call are both non-animating.
968 bool use_fast_resize = 968 bool use_fast_resize =
969 is_animating || (call_state == REENTRANT_FORCE_FAST_RESIZE); 969 is_animating || (call_state == REENTRANT_FORCE_FAST_RESIZE);
970 if (use_fast_resize) 970 if (use_fast_resize)
971 contents_web_view_->SetFastResize(true); 971 contents_web_view_->SetFastResize(true);
972 UpdateUIForContents(GetActiveWebContents()); 972 UpdateUIForContents(GetActiveWebContents());
973 if (use_fast_resize) 973 if (use_fast_resize)
974 contents_web_view_->SetFastResize(false); 974 contents_web_view_->SetFastResize(false);
975 975
976 // Inform the InfoBarContainer that the distance to the location icon may have 976 // Inform the InfoBarContainer that the distance to the location icon may have
977 // changed. We have to do this after the block above so that the toolbars are 977 // changed. We have to do this after the block above so that the toolbars are
978 // laid out correctly for calculating the maximum arrow height below. 978 // laid out correctly for calculating the maximum arrow height below.
979 { 979 {
980 base::AutoReset<CallState> resetter(&call_state, 980 base::AutoReset<CallState> resetter(&call_state,
981 is_animating ? REENTRANT_FORCE_FAST_RESIZE : REENTRANT); 981 is_animating ? REENTRANT_FORCE_FAST_RESIZE : REENTRANT);
982 infobar_container_->SetMaxTopArrowHeight(GetMaxTopInfoBarArrowHeight()); 982 SetMaxTopArrowHeight(GetMaxTopInfoBarArrowHeight(), infobar_container_);
983 } 983 }
984 984
985 // When transitioning from animating to not animating we need to make sure the 985 // When transitioning from animating to not animating we need to make sure the
986 // contents_container_ gets layed out. If we don't do this and the bounds 986 // contents_container_ gets layed out. If we don't do this and the bounds
987 // haven't changed contents_container_ won't get a Layout out and we'll end up 987 // haven't changed contents_container_ won't get a Layout out and we'll end up
988 // with a gray rect because the clip wasn't updated. Note that a reentrant 988 // with a gray rect because the clip wasn't updated. Note that a reentrant
989 // call never needs to do this, because after it returns, the normal call 989 // call never needs to do this, because after it returns, the normal call
990 // wrapping it will do it. 990 // wrapping it will do it.
991 if ((call_state == NORMAL) && !is_animating) { 991 if ((call_state == NORMAL) && !is_animating) {
992 contents_web_view_->InvalidateLayout(); 992 contents_web_view_->InvalidateLayout();
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
1892 1892
1893 chrome::BrowserCommandController* controller = browser_->command_controller(); 1893 chrome::BrowserCommandController* controller = browser_->command_controller();
1894 if (!controller->block_command_execution()) 1894 if (!controller->block_command_execution())
1895 UpdateAcceleratorMetrics(accelerator, command_id); 1895 UpdateAcceleratorMetrics(accelerator, command_id);
1896 return chrome::ExecuteCommand(browser_.get(), command_id); 1896 return chrome::ExecuteCommand(browser_.get(), command_id);
1897 } 1897 }
1898 1898
1899 /////////////////////////////////////////////////////////////////////////////// 1899 ///////////////////////////////////////////////////////////////////////////////
1900 // BrowserView, OmniboxPopupModelObserver overrides: 1900 // BrowserView, OmniboxPopupModelObserver overrides:
1901 void BrowserView::OnOmniboxPopupShownOrHidden() { 1901 void BrowserView::OnOmniboxPopupShownOrHidden() {
1902 infobar_container_->SetMaxTopArrowHeight(GetMaxTopInfoBarArrowHeight()); 1902 SetMaxTopArrowHeight(GetMaxTopInfoBarArrowHeight(), infobar_container_);
1903 } 1903 }
1904 1904
1905 /////////////////////////////////////////////////////////////////////////////// 1905 ///////////////////////////////////////////////////////////////////////////////
1906 // BrowserView, InfoBarContainer::Delegate overrides: 1906 // BrowserView, InfoBarContainerDelegate overrides:
1907
1908 const int InfoBarContainerDelegate::kSeparatorLineHeight =
1909 views::NonClientFrameView::kClientEdgeThickness;
1910 const int InfoBarContainerDelegate::kDefaultArrowTargetHeight = 9;
1907 1911
1908 SkColor BrowserView::GetInfoBarSeparatorColor() const { 1912 SkColor BrowserView::GetInfoBarSeparatorColor() const {
1909 // NOTE: Keep this in sync with ToolbarView::OnPaint()! 1913 // NOTE: Keep this in sync with ToolbarView::OnPaint()!
1910 return (IsTabStripVisible() || !frame_->ShouldUseNativeFrame()) ? 1914 return (IsTabStripVisible() || !frame_->ShouldUseNativeFrame()) ?
1911 ThemeProperties::GetDefaultColor( 1915 ThemeProperties::GetDefaultColor(
1912 ThemeProperties::COLOR_TOOLBAR_SEPARATOR) : 1916 ThemeProperties::COLOR_TOOLBAR_SEPARATOR) :
1913 SK_ColorBLACK; 1917 SK_ColorBLACK;
1914 } 1918 }
1915 1919
1916 void BrowserView::InfoBarContainerStateChanged(bool is_animating) { 1920 void BrowserView::InfoBarContainerStateChanged(bool is_animating) {
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
2524 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { 2528 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) {
2525 gfx::Point icon_bottom( 2529 gfx::Point icon_bottom(
2526 toolbar_->location_bar()->GetLocationBarAnchorPoint()); 2530 toolbar_->location_bar()->GetLocationBarAnchorPoint());
2527 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); 2531 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom);
2528 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(nullptr)); 2532 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(nullptr));
2529 ConvertPointToTarget(infobar_container_, this, &infobar_top); 2533 ConvertPointToTarget(infobar_container_, this, &infobar_top);
2530 top_arrow_height = infobar_top.y() - icon_bottom.y(); 2534 top_arrow_height = infobar_top.y() - icon_bottom.y();
2531 } 2535 }
2532 return top_arrow_height; 2536 return top_arrow_height;
2533 } 2537 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698