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

Unified Diff: chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.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_mus.cc
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.cc
index 3fa2a16a7e8d32770cc9046255e4b04bdd1c3cf6..95390efd24734dde7230dbc45dcb0165335d3330 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.cc
@@ -135,11 +135,6 @@ gfx::Rect BrowserNonClientFrameViewMus::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.
int left_inset = GetTabStripLeftInset();
int right_inset = GetTabStripRightInset();
return gfx::Rect(left_inset, GetTopInset(false),
@@ -148,8 +143,17 @@ gfx::Rect BrowserNonClientFrameViewMus::GetBoundsForTabStrip(
}
int BrowserNonClientFrameViewMus::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 ((frame()->IsMaximized() || frame()->IsFullscreen()) && !restored)
@@ -296,13 +300,6 @@ void BrowserNonClientFrameViewMus::OnPaint(gfx::Canvas* canvas) {
if (!ShouldPaint())
return;
- // TODO(sky): get immersive mode working.
-
- if (UseImmersiveLightbarHeaderStyle()) {
- PaintImmersiveLightbarStyleHeader(canvas);
- return;
- }
-
if (browser_view()->IsToolbarVisible())
PaintToolbarBackground(canvas);
else if (!UsePackagedAppHeaderStyle())
@@ -416,14 +413,6 @@ int BrowserNonClientFrameViewMus::GetTabStripRightInset() const {
return right_inset;
}
-bool BrowserNonClientFrameViewMus::UseImmersiveLightbarHeaderStyle() const {
- ImmersiveModeController* immersive_controller =
- browser_view()->immersive_mode_controller();
- return immersive_controller->IsEnabled() &&
- !immersive_controller->IsRevealed() &&
- browser_view()->IsTabStripVisible();
-}
-
bool BrowserNonClientFrameViewMus::UsePackagedAppHeaderStyle() const {
// Use for non tabbed trusted source windows, e.g. Settings, as well as apps.
const Browser* const browser = browser_view()->browser();
@@ -441,17 +430,12 @@ void BrowserNonClientFrameViewMus::LayoutIncognitoButton() {
int avatar_bottom = GetTopInset(false) + browser_view()->GetTabStripHeight() -
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.
- bool avatar_visible = !UseImmersiveLightbarHeaderStyle();
- int avatar_height = avatar_visible ? incognito_icon.height() : 0;
+ int avatar_height = incognito_icon.height();
gfx::Rect avatar_bounds(kAvatarIconPadding, avatar_y, incognito_icon.width(),
avatar_height);
profile_indicator_icon()->SetBoundsRect(avatar_bounds);
- profile_indicator_icon()->SetVisible(avatar_visible);
+ profile_indicator_icon()->SetVisible(true);
}
void BrowserNonClientFrameViewMus::LayoutProfileSwitcher() {
@@ -467,19 +451,14 @@ bool BrowserNonClientFrameViewMus::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 BrowserNonClientFrameViewMus::PaintImmersiveLightbarStyleHeader(
- gfx::Canvas* canvas) {}
-
void BrowserNonClientFrameViewMus::PaintToolbarBackground(gfx::Canvas* canvas) {
gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds());
if (toolbar_bounds.IsEmpty())

Powered by Google App Engine
This is Rietveld 408576698