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

Unified Diff: chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc

Issue 2690443002: cros-md: Remove the non-MD immersive mode code paths (Closed)
Patch Set: remove pre-md tabstrip related code and fix Tabstrip::GetPreferredSize Created 3 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
index 4f1024844a816b1c2c6af879403b6cfc281c11bf..d2d76650ff68bfe48e304dad1d22618c954e830f 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
@@ -137,11 +137,6 @@ gfx::Rect BrowserNonClientFrameViewAsh::GetBoundsForTabStrip(
if (!tabstrip)
return gfx::Rect();
- // When the tab strip is painted in the immersive fullscreen light bar style,
- // the caption buttons and the avatar button are not visible. However, their
- // bounds are still used to compute the tab strip bounds so that the tabs have
- // the same horizontal position when the tab strip is painted in the immersive
- // light bar style as when the top-of-window views are revealed.
const int left_inset = GetTabStripLeftInset();
return gfx::Rect(left_inset, GetTopInset(false),
std::max(0, width() - left_inset - GetTabStripRightInset()),
@@ -149,7 +144,7 @@ gfx::Rect BrowserNonClientFrameViewAsh::GetBoundsForTabStrip(
}
int BrowserNonClientFrameViewAsh::GetTopInset(bool restored) const {
- if (!ShouldPaint() || UseImmersiveLightbarHeaderStyle())
+ if (!ShouldPaint() || IsImmersiveFullscreenUnrevealed())
return 0;
if (!browser_view()->IsTabStripVisible()) {
@@ -216,12 +211,7 @@ void BrowserNonClientFrameViewAsh::GetWindowMask(const gfx::Size& size,
}
void BrowserNonClientFrameViewAsh::ResetWindowControls() {
- // Hide the caption buttons in immersive fullscreen when the tab light bar
- // is visible because it's confusing when the user hovers or clicks in the
- // top-right of the screen and hits one.
- // TODO(yiyix): Update |caption_button_container_|'s visibility calculation
- // when Chrome OS MD is enabled by default.
- caption_button_container_->SetVisible(!UseImmersiveLightbarHeaderStyle());
+ caption_button_container_->SetVisible(!IsImmersiveFullscreenUnrevealed());
caption_button_container_->ResetWindowControls();
}
@@ -245,14 +235,6 @@ void BrowserNonClientFrameViewAsh::OnPaint(gfx::Canvas* canvas) {
if (!ShouldPaint())
return;
- if (UseImmersiveLightbarHeaderStyle()) {
- // The light bar header is not themed because theming it does not look good.
- canvas->FillRect(
- gfx::Rect(width(), header_painter_->GetHeaderHeightForPainting()),
- SK_ColorBLACK);
- return;
- }
-
const bool should_paint_as_active = ShouldPaintAsActive();
caption_button_container_->SetPaintAsActive(should_paint_as_active);
@@ -274,15 +256,8 @@ void BrowserNonClientFrameViewAsh::Layout() {
header_painter_->LayoutHeader();
int painted_height = GetTopInset(false);
- if (browser_view()->IsTabStripVisible()) {
- const ImmersiveModeController* const immersive_controller =
- browser_view()->immersive_mode_controller();
- if (!immersive_controller->IsEnabled() ||
- immersive_controller->IsRevealed() ||
- !ash::MaterialDesignController::IsImmersiveModeMaterial()) {
- painted_height += browser_view()->tabstrip()->GetPreferredSize().height();
- }
- }
+ if (browser_view()->IsTabStripVisible())
+ painted_height += browser_view()->tabstrip()->GetPreferredSize().height();
header_painter_->SetHeaderHeightForPainting(painted_height);
@@ -402,15 +377,11 @@ int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const {
caption_button_container_->GetPreferredSize().width();
}
-bool BrowserNonClientFrameViewAsh::UseImmersiveLightbarHeaderStyle() const {
- if (ash::MaterialDesignController::IsImmersiveModeMaterial())
- return false;
-
+bool BrowserNonClientFrameViewAsh::IsImmersiveFullscreenUnrevealed() const {
const ImmersiveModeController* const immersive_controller =
browser_view()->immersive_mode_controller();
return immersive_controller->IsEnabled() &&
- !immersive_controller->IsRevealed() &&
- browser_view()->IsTabStripVisible();
+ !immersive_controller->IsRevealed();
}
bool BrowserNonClientFrameViewAsh::UsePackagedAppHeaderStyle() const {
@@ -433,10 +404,9 @@ void BrowserNonClientFrameViewAsh::LayoutProfileIndicatorIcon() {
kAvatarIconPadding;
int avatar_y = avatar_bottom - incognito_icon.height();
- // Hide the incognito icon in immersive fullscreen when the tab light bar is
- // visible because the header is too short for the icognito icon to be
- // recognizable.
- const bool avatar_visible = !UseImmersiveLightbarHeaderStyle();
+ // Hide the incognito icon in immersive fullscreen unrevealed state because
+ // the header height is zero for displaying the icon.
+ const bool avatar_visible = !IsImmersiveFullscreenUnrevealed();
const int avatar_height = avatar_visible ? (avatar_bottom - avatar_y) : 0;
profile_indicator_icon()->SetBounds(kAvatarIconPadding, avatar_y,
incognito_icon.width(), avatar_height);
@@ -447,14 +417,12 @@ bool BrowserNonClientFrameViewAsh::ShouldPaint() const {
if (!frame()->IsFullscreen())
return true;
- // We need to paint when in immersive fullscreen and either:
- // - The top-of-window views are revealed.
- // - The lightbar style tabstrip is visible.
+ // We need to paint when the top-of-window views are revealed in immersive
+ // fullscreen.
ImmersiveModeController* immersive_mode_controller =
browser_view()->immersive_mode_controller();
return immersive_mode_controller->IsEnabled() &&
- (immersive_mode_controller->IsRevealed() ||
- UseImmersiveLightbarHeaderStyle());
+ immersive_mode_controller->IsRevealed();
}
void BrowserNonClientFrameViewAsh::PaintToolbarBackground(gfx::Canvas* canvas) {

Powered by Google App Engine
This is Rietveld 408576698