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

Unified Diff: ash/wm/overview/window_selector_window.cc

Issue 231643002: Added labels under the windows in OverviewMode displaying their current name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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: ash/wm/overview/window_selector_window.cc
diff --git a/ash/wm/overview/window_selector_window.cc b/ash/wm/overview/window_selector_window.cc
index 942edf41efddcbb4e92a1f439d7e138dd449acaa..f446d22de0ec5dafcb2e3c35bb1cfd20f3347dda 100644
--- a/ash/wm/overview/window_selector_window.cc
+++ b/ash/wm/overview/window_selector_window.cc
@@ -20,6 +20,29 @@ namespace ash {
namespace {
+views::Widget* CreateWindowLabel(aura::Window* root_window,
+ const base::string16 title) {
+ views::Widget* widget = new views::Widget;
+ views::Widget::InitParams params;
+ params.type = views::Widget::InitParams::TYPE_POPUP;
+ params.can_activate = false;
+ params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
+ params.opacity = views::Widget::InitParams::OPAQUE_WINDOW;
+ params.parent =
+ Shell::GetContainer(root_window, ash::kShellWindowId_OverlayContainer);
+ widget->set_focus_on_creation(false);
+ widget->Init(params);
+ views::Label* label = new views::Label;
+ label->SetEnabledColor(WindowSelectorWindow::kLabelColor);
+ label->SetBackgroundColor(WindowSelectorWindow::kLabelBackground);
+ ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
+ label->SetFontList(bundle.GetFontList(ui::ResourceBundle::BoldFont));
+ label->SetText(title);
+ widget->SetContentsView(label);
+ widget->Show();
+ return widget;
+}
+
views::Widget* CreateCloseWindowButton(aura::Window* root_window,
views::ButtonListener* listener) {
views::Widget* widget = new views::Widget;
@@ -102,11 +125,14 @@ void WindowSelectorWindow::SetItemBounds(aura::Window* root_window,
const gfx::Rect& target_bounds,
bool animate) {
gfx::Rect src_rect = transform_window_.GetBoundsInScreen();
- set_bounds(ScopedTransformOverviewWindow::
- ShrinkRectToFitPreservingAspectRatio(src_rect, target_bounds));
+ const gfx::Rect window_bounds =
+ ScopedTransformOverviewWindow::
+ ShrinkRectToFitPreservingAspectRatio(src_rect, target_bounds);
+ set_bounds(window_bounds);
transform_window_.SetTransform(root_window,
ScopedTransformOverviewWindow::GetTransformForRect(src_rect, bounds()),
animate);
+ UpdateWindowLabels(window_bounds);
UpdateCloseButtonBounds();
}
@@ -116,6 +142,19 @@ void WindowSelectorWindow::ButtonPressed(views::Button* sender,
transform_window_.window())->Close();
}
+void WindowSelectorWindow::UpdateWindowLabels(const gfx::Rect& window_bounds) {
+ // TODO Animate the labels with some cute effects
+ base::string16 window_title = transform_window_.window()->title();
+ if (!window_label_)
+ window_label_.reset(CreateWindowLabel(GetRootWindow(), window_title));
+ // TODO use constant for box height? Calculate dynamically?
tdanderson 2014/04/09 20:35:17 I suspect that we'll eventually want to calculate
+ gfx::Rect label_bounds(window_bounds.x(),
+ window_bounds.y() + window_bounds.height(),
+ window_bounds.width(),
+ 40);
+ window_label_->GetNativeWindow()->SetBounds(label_bounds);
+}
+
void WindowSelectorWindow::UpdateCloseButtonBounds() {
aura::Window* root_window = GetRootWindow();
gfx::Rect align_bounds(bounds());
« ash/wm/overview/window_selector_window.h ('K') | « ash/wm/overview/window_selector_window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698