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

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: rebase & code comments 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..abb34d15682aeacfa6f0e8cc95567d99e8a35847 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,8 +143,17 @@ gfx::Rect BrowserNonClientFrameViewAsh::GetBoundsForTabStrip(
}
int BrowserNonClientFrameViewAsh::GetTopInset(bool restored) const {
- if (!ShouldPaint() || UseImmersiveLightbarHeaderStyle())
+ if (!ShouldPaint()) {
+ // When immersive fullscreen unrevealed, tabstrip is offscreen with normal
+ // tapstrip bounds, the top inset should reach this topmost edge.
+ const ImmersiveModeController* const immersive_controller =
+ browser_view()->immersive_mode_controller();
+ if (immersive_controller->IsEnabled() &&
+ !immersive_controller->IsRevealed()) {
+ return (-1) * browser_view()->GetTabStripHeight();
+ }
return 0;
+ }
if (!browser_view()->IsTabStripVisible()) {
return (UsePackagedAppHeaderStyle())
@@ -216,12 +219,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(true);
caption_button_container_->ResetWindowControls();
}
@@ -245,14 +243,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 +264,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,17 +385,6 @@ int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const {
caption_button_container_->GetPreferredSize().width();
}
-bool BrowserNonClientFrameViewAsh::UseImmersiveLightbarHeaderStyle() const {
- if (ash::MaterialDesignController::IsImmersiveModeMaterial())
- return false;
-
- const ImmersiveModeController* const immersive_controller =
- browser_view()->immersive_mode_controller();
- return immersive_controller->IsEnabled() &&
- !immersive_controller->IsRevealed() &&
- browser_view()->IsTabStripVisible();
-}
-
bool BrowserNonClientFrameViewAsh::UsePackagedAppHeaderStyle() const {
// Use for non tabbed trusted source windows, e.g. Settings, as well as apps.
const Browser* const browser = browser_view()->browser();
@@ -433,28 +405,22 @@ 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();
- const int avatar_height = avatar_visible ? (avatar_bottom - avatar_y) : 0;
+ const int avatar_height = avatar_bottom - avatar_y;
profile_indicator_icon()->SetBounds(kAvatarIconPadding, avatar_y,
incognito_icon.width(), avatar_height);
- profile_indicator_icon()->SetVisible(avatar_visible);
+ profile_indicator_icon()->SetVisible(true);
}
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