Chromium Code Reviews| 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..9354420fc8c2702579e4a7f9656de93df39f9ab5 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 |
| @@ -11,7 +11,6 @@ |
| #include "ash/common/frame/default_header_painter.h" |
| #include "ash/common/frame/frame_border_hit_test.h" |
| #include "ash/common/frame/header_painter_util.h" |
| -#include "ash/common/material_design/material_design_controller.h" |
| #include "ash/common/wm_lookup.h" |
| #include "ash/common/wm_shell.h" |
| #include "ash/common/wm_window.h" |
| @@ -137,11 +136,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 +143,7 @@ gfx::Rect BrowserNonClientFrameViewAsh::GetBoundsForTabStrip( |
| } |
| int BrowserNonClientFrameViewAsh::GetTopInset(bool restored) const { |
| - if (!ShouldPaint() || UseImmersiveLightbarHeaderStyle()) |
| + if (!ShouldPaint()) |
| return 0; |
| if (!browser_view()->IsTabStripVisible()) { |
| @@ -216,12 +210,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()); |
|
sky
2017/02/14 22:40:57
Is this still needed? If so, why? Prior to your ch
Qiang(Joe) Xu
2017/02/15 05:57:02
hmm.. sorry about this, we should not need this.
|
| caption_button_container_->ResetWindowControls(); |
| } |
| @@ -245,14 +234,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 +255,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 +376,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 +403,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 +416,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) { |