Commit 5aee8c7f authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

wm: Display title and icon of transient root window for alttab/overview.

Test: manual
Change-Id: I6631d68eace73d0a3a783cc81a9dacd64a3060bb
Fixed: 1005180
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1927009Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#717271}
parent e3319087
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "ui/views/controls/image_view.h" #include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h" #include "ui/views/controls/label.h"
#include "ui/views/layout/box_layout.h" #include "ui/views/layout/box_layout.h"
#include "ui/wm/core/window_util.h"
namespace ash { namespace ash {
namespace { namespace {
...@@ -98,10 +99,13 @@ WindowMiniView::WindowMiniView(aura::Window* source_window, ...@@ -98,10 +99,13 @@ WindowMiniView::WindowMiniView(aura::Window* source_window,
kHorizontalLabelPaddingDp)); kHorizontalLabelPaddingDp));
AddChildViewOf(this, header_view_); AddChildViewOf(this, header_view_);
// Display the icon and title of the transient root.
aura::Window* transient_root = wm::GetTransientRoot(source_window);
// Prefer kAppIconKey over kWindowIconKey as the app icon is typically larger. // Prefer kAppIconKey over kWindowIconKey as the app icon is typically larger.
gfx::ImageSkia* icon = source_window->GetProperty(aura::client::kAppIconKey); gfx::ImageSkia* icon = transient_root->GetProperty(aura::client::kAppIconKey);
if (!icon || icon->size().IsEmpty()) if (!icon || icon->size().IsEmpty())
icon = source_window->GetProperty(aura::client::kWindowIconKey); icon = transient_root->GetProperty(aura::client::kWindowIconKey);
if (icon && !icon->size().IsEmpty()) { if (icon && !icon->size().IsEmpty()) {
image_view_ = new views::ImageView(); image_view_ = new views::ImageView();
image_view_->SetImage(gfx::ImageSkiaOperations::CreateResizedImage( image_view_->SetImage(gfx::ImageSkiaOperations::CreateResizedImage(
...@@ -110,7 +114,7 @@ WindowMiniView::WindowMiniView(aura::Window* source_window, ...@@ -110,7 +114,7 @@ WindowMiniView::WindowMiniView(aura::Window* source_window,
AddChildViewOf(header_view_, image_view_); AddChildViewOf(header_view_, image_view_);
} }
title_label_ = new views::Label(source_window->GetTitle()); title_label_ = new views::Label(transient_root->GetTitle());
title_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); title_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
title_label_->SetAutoColorReadabilityEnabled(false); title_label_->SetAutoColorReadabilityEnabled(false);
title_label_->SetEnabledColor(kLabelColor); title_label_->SetEnabledColor(kLabelColor);
...@@ -165,7 +169,7 @@ void WindowMiniView::OnWindowDestroying(aura::Window* window) { ...@@ -165,7 +169,7 @@ void WindowMiniView::OnWindowDestroying(aura::Window* window) {
} }
void WindowMiniView::OnWindowTitleChanged(aura::Window* window) { void WindowMiniView::OnWindowTitleChanged(aura::Window* window) {
title_label_->SetText(window->GetTitle()); title_label_->SetText(wm::GetTransientRoot(window)->GetTitle());
} }
} // namespace ash } // namespace ash
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment