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

Issue 231643002: Added labels under the windows in OverviewMode displaying their current name. (Closed)

Created:
6 years, 8 months ago by Nina
Modified:
6 years, 8 months ago
Reviewers:
flackr, tdanderson, sadrul
CC:
chromium-reviews, kalyank, ben+ash_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

Added labels under the windows in OverviewMode displaying their current name. Labels will show the title of the active tab or selected panel. They have a blurred shadow and are animated similarly to the close buttons. See the bug for some screenshots. BUG=361181 TEST=WindowSelectorTest.CreateLabelUnderWindow,WindowSelectorTest.CreateLabelUnderPanel Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=264602

Patch Set 1 #

Total comments: 3

Patch Set 2 : Fixed some issues regarding code style #

Total comments: 7

Patch Set 3 : Upgrade to label aesthetics, now also working on panels, code cleanup #

Patch Set 4 : Added animations to labels :) #

Total comments: 24

Patch Set 5 : Fixed aspect ratio issue when animating label movement #

Patch Set 6 : Code cleanup according to latest feedback #

Patch Set 7 : Added relevant tests #

Patch Set 8 : Added blurred shadows to labels #

Total comments: 18

Patch Set 9 : Fixed nits, added transparency #

Total comments: 31

Patch Set 10 : Refactored the code to take advantage of blur mechanics, minor fixes #

Total comments: 8

Patch Set 11 : Follow-up fixes #

Total comments: 1

Patch Set 12 : Fixed tests, code polishing #

Total comments: 22

Patch Set 13 : Fixed latest issues #

Total comments: 2

Patch Set 14 : Fixed nits #

Unified diffs Side-by-side diffs Delta from patch set Stats (+206 lines, -9 lines) Patch
M ash/wm/overview/window_selector_item.h View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +19 lines, -0 lines 0 comments Download
M ash/wm/overview/window_selector_item.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +118 lines, -0 lines 0 comments Download
M ash/wm/overview/window_selector_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 5 chunks +57 lines, -0 lines 0 comments Download
M ash/wm/overview/window_selector_window.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +0 lines, -2 lines 0 comments Download
M ash/wm/overview/window_selector_window.cc View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +5 lines, -6 lines 0 comments Download
M ui/views/controls/label.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +5 lines, -0 lines 0 comments Download
M ui/views/controls/label.cc View 1 2 3 4 5 6 7 8 9 2 chunks +2 lines, -1 line 0 comments Download

Messages

Total messages: 35 (0 generated)
Nina
Terry, can you please take a look at this? Thanks!
6 years, 8 months ago (2014-04-09 19:54:09 UTC) #1
tdanderson
Looks great so far! I've left a few comments inline. (If anyone else is following ...
6 years, 8 months ago (2014-04-09 20:35:17 UTC) #2
Nina
Thanks for the quick feedback! I did a code cleanup with the proposed changes.
6 years, 8 months ago (2014-04-09 20:51:34 UTC) #3
flackr
https://codereview.chromium.org/231643002/diff/20001/ash/wm/overview/window_selector_window.cc File ash/wm/overview/window_selector_window.cc (right): https://codereview.chromium.org/231643002/diff/20001/ash/wm/overview/window_selector_window.cc#newcode25 ash/wm/overview/window_selector_window.cc:25: static const int kLabelColor = 0xFFFFFFFF; Use SK_ColorWHITE, the ...
6 years, 8 months ago (2014-04-10 15:03:04 UTC) #4
Nina
OK I moved forward and added the transitions. If everything looks good, I'll start working ...
6 years, 8 months ago (2014-04-10 21:28:05 UTC) #5
tdanderson
Some more comments, mostly nits: https://codereview.chromium.org/231643002/diff/60001/ash/wm/overview/scoped_transform_overview_window.cc File ash/wm/overview/scoped_transform_overview_window.cc (right): https://codereview.chromium.org/231643002/diff/60001/ash/wm/overview/scoped_transform_overview_window.cc#newcode90 ash/wm/overview/scoped_transform_overview_window.cc:90: nit: No blank line ...
6 years, 8 months ago (2014-04-10 22:37:12 UTC) #6
Nina
Hi Terry, can you please look at the new update? Thanks! https://codereview.chromium.org/231643002/diff/60001/ash/wm/overview/scoped_transform_overview_window.cc File ash/wm/overview/scoped_transform_overview_window.cc (right): ...
6 years, 8 months ago (2014-04-14 16:24:04 UTC) #7
tdanderson
LGTM with the nits addressed below. Good job! Also be sure to update the issue ...
6 years, 8 months ago (2014-04-14 16:58:38 UTC) #8
Nina
Hello, Please review the CL. I've addressed all nits. You can see a screenshot at ...
6 years, 8 months ago (2014-04-14 17:59:17 UTC) #9
flackr
https://codereview.chromium.org/231643002/diff/160001/ash/wm/overview/window_selector_item.cc File ash/wm/overview/window_selector_item.cc (right): https://codereview.chromium.org/231643002/diff/160001/ash/wm/overview/window_selector_item.cc#newcode34 ash/wm/overview/window_selector_item.cc:34: // Label height, ie. distance from the border of ...
6 years, 8 months ago (2014-04-14 20:31:17 UTC) #10
Nina
Thanks for the feedback, although I need some more information regarding the test fixes (as ...
6 years, 8 months ago (2014-04-15 15:15:03 UTC) #11
flackr
https://codereview.chromium.org/231643002/diff/160001/ash/wm/overview/window_selector_unittest.cc File ash/wm/overview/window_selector_unittest.cc (right): https://codereview.chromium.org/231643002/diff/160001/ash/wm/overview/window_selector_unittest.cc#newcode1097 ash/wm/overview/window_selector_unittest.cc:1097: aura::Window* root_window = Shell::GetContainer( On 2014/04/15 15:15:03, nsatragno wrote: ...
6 years, 8 months ago (2014-04-16 02:37:10 UTC) #12
flackr
https://codereview.chromium.org/231643002/diff/180001/ash/wm/overview/window_selector_unittest.cc File ash/wm/overview/window_selector_unittest.cc (right): https://codereview.chromium.org/231643002/diff/180001/ash/wm/overview/window_selector_unittest.cc#newcode14 ash/wm/overview/window_selector_unittest.cc:14: #include "ash/test/shelf_view_test_api.h" You're getting the compile error because you ...
6 years, 8 months ago (2014-04-16 17:24:54 UTC) #13
Nina
I fixed most of the issues detailed, except for the tests (which'll come in the ...
6 years, 8 months ago (2014-04-16 18:19:11 UTC) #14
sadrul
https://codereview.chromium.org/231643002/diff/200001/ui/views/controls/label.h File ui/views/controls/label.h (right): https://codereview.chromium.org/231643002/diff/200001/ui/views/controls/label.h#newcode98 ui/views/controls/label.h:98: double shadow_blur() const { return shadow_blur_; } Doesn't look ...
6 years, 8 months ago (2014-04-16 21:18:33 UTC) #15
Nina
On 2014/04/16 21:18:33, sadrul wrote: > https://codereview.chromium.org/231643002/diff/200001/ui/views/controls/label.h > File ui/views/controls/label.h (right): > > https://codereview.chromium.org/231643002/diff/200001/ui/views/controls/label.h#newcode98 > ...
6 years, 8 months ago (2014-04-16 21:46:30 UTC) #16
sadrul
On 2014/04/16 21:46:30, nsatragno wrote: > On 2014/04/16 21:18:33, sadrul wrote: > > > https://codereview.chromium.org/231643002/diff/200001/ui/views/controls/label.h ...
6 years, 8 months ago (2014-04-16 21:48:27 UTC) #17
Nina
Okay, theoretically this should be it. I hope took care of all the issues, and ...
6 years, 8 months ago (2014-04-16 22:08:30 UTC) #18
flackr
https://codereview.chromium.org/231643002/diff/220001/ash/wm/overview/window_selector_item.cc File ash/wm/overview/window_selector_item.cc (right): https://codereview.chromium.org/231643002/diff/220001/ash/wm/overview/window_selector_item.cc#newcode10 ash/wm/overview/window_selector_item.cc:10: #include "ash/wm/overview/scoped_transform_overview_window.h" Don't think you need this anymore. https://codereview.chromium.org/231643002/diff/220001/ash/wm/overview/window_selector_item.cc#newcode12 ...
6 years, 8 months ago (2014-04-17 03:44:28 UTC) #19
Nina
Hi Rob, Thanks for the feedback, I took care of the issues. No features were ...
6 years, 8 months ago (2014-04-17 15:02:18 UTC) #20
flackr
LGTM with nits. https://codereview.chromium.org/231643002/diff/220001/ash/wm/overview/window_selector_item.cc File ash/wm/overview/window_selector_item.cc (right): https://codereview.chromium.org/231643002/diff/220001/ash/wm/overview/window_selector_item.cc#newcode10 ash/wm/overview/window_selector_item.cc:10: #include "ash/wm/overview/scoped_transform_overview_window.h" On 2014/04/17 15:02:19, nsatragno ...
6 years, 8 months ago (2014-04-17 15:08:32 UTC) #21
Nina
Nits taken care of. Sadrul, can you take a look? Thanks!
6 years, 8 months ago (2014-04-17 15:15:14 UTC) #22
sadrul
lgtm
6 years, 8 months ago (2014-04-17 15:34:29 UTC) #23
tdanderson
The CQ bit was checked by tdanderson@chromium.org
6 years, 8 months ago (2014-04-17 15:37:11 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/nsatragno@chromium.org/231643002/250001
6 years, 8 months ago (2014-04-17 15:37:18 UTC) #25
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 8 months ago (2014-04-17 16:14:50 UTC) #26
commit-bot: I haz the power
Retried try job too often on ios_dbg_simulator for step(s) base_unittests, compile, components_unittests, content_unittests, crypto_unittests, net_unittests, ...
6 years, 8 months ago (2014-04-17 16:14:51 UTC) #27
tdanderson
The CQ bit was checked by tdanderson@chromium.org
6 years, 8 months ago (2014-04-17 16:20:39 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/nsatragno@chromium.org/231643002/250001
6 years, 8 months ago (2014-04-17 16:20:53 UTC) #29
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 8 months ago (2014-04-17 16:36:06 UTC) #30
commit-bot: I haz the power
Retried try job too often on ios_dbg_simulator for step(s) base_unittests, compile, components_unittests, content_unittests, crypto_unittests, net_unittests, ...
6 years, 8 months ago (2014-04-17 16:36:08 UTC) #31
tdanderson
The CQ bit was checked by tdanderson@chromium.org
6 years, 8 months ago (2014-04-17 17:32:51 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/nsatragno@chromium.org/231643002/250001
6 years, 8 months ago (2014-04-17 17:33:36 UTC) #33
commit-bot: I haz the power
Change committed as 264602
6 years, 8 months ago (2014-04-17 19:01:54 UTC) #34
commit-bot: I haz the power
6 years, 8 months ago (2014-04-17 19:02:26 UTC) #35
Message was sent while issue was closed.
Failed to apply patch for ash/wm/overview/window_selector_item.cc:
While running patch -p1 --forward --force --no-backup-if-mismatch;
  patching file ash/wm/overview/window_selector_item.cc
  Hunk #1 FAILED at 3.
  Hunk #2 FAILED at 24.
  Hunk #3 succeeded at 152 with fuzz 1 (offset 118 lines).
  2 out of 3 hunks FAILED -- saving rejects to file
ash/wm/overview/window_selector_item.cc.rej

Patch:       ash/wm/overview/window_selector_item.cc
Index: ash/wm/overview/window_selector_item.cc
diff --git a/ash/wm/overview/window_selector_item.cc
b/ash/wm/overview/window_selector_item.cc
index
a2c25b617e9c872b1c2849209cc383ff59a14657..9866185cd9ca4487170bd80234c3fa7e483f7cc0
100644
--- a/ash/wm/overview/window_selector_item.cc
+++ b/ash/wm/overview/window_selector_item.cc
@@ -3,11 +3,75 @@
 // found in the LICENSE file.
 
 #include "ash/wm/overview/window_selector_item.h"
+
+#include "ash/screen_util.h"
+#include "ash/shell.h"
+#include "ash/shell_window_ids.h"
+#include "ash/wm/overview/scoped_transform_overview_window.h"
 #include "base/auto_reset.h"
+#include "third_party/skia/include/core/SkColor.h"
 #include "ui/aura/window.h"
+#include "ui/base/resource/resource_bundle.h"
+#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/views/controls/label.h"
+#include "ui/views/layout/box_layout.h"
+#include "ui/views/widget/widget.h"
 
 namespace ash {
 
+// Foreground label color.
+static const SkColor kLabelColor = SK_ColorWHITE;
+
+// Background label color.
+static const SkColor kLabelBackground = SK_ColorTRANSPARENT;
+
+// Label shadow color.
+static const SkColor kLabelShadow = 0xB0000000;
+
+// Vertical padding for the label, both over and beneath it.
+static const int kVerticalLabelPadding = 20;
+
+// Solid shadow length from the label
+static const int kVerticalShadowOffset = 1;
+
+// Amount of blur applied to the label shadow
+static const int kShadowBlur = 10;
+
+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::TRANSLUCENT_WINDOW;
+  params.parent =
+      Shell::GetContainer(root_window, ash::kShellWindowId_OverlayContainer);
+  params.accept_events = false;
+  params.visible_on_all_workspaces = true;
+  widget->set_focus_on_creation(false);
+  widget->Init(params);
+  views::Label* label = new views::Label;
+  label->SetEnabledColor(kLabelColor);
+  label->SetBackgroundColor(kLabelBackground);
+  label->SetShadowColors(kLabelShadow, kLabelShadow);
+  label->SetShadowOffset(0, kVerticalShadowOffset);
+  label->set_shadow_blur(kShadowBlur);
+  ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
+  label->SetFontList(bundle.GetFontList(ui::ResourceBundle::BoldFont));
+  label->SetText(title);
+  views::BoxLayout* layout = new views::BoxLayout(views::BoxLayout::kVertical,
+                                                  0,
+                                                  kVerticalLabelPadding,
+                                                  0);
+  label->SetLayoutManager(layout);
+  widget->SetContentsView(label);
+  widget->Show();
+  return widget;
+}
+
+const int WindowSelectorItem::kFadeInMilliseconds = 80;
+
 WindowSelectorItem::WindowSelectorItem()
     : root_window_(NULL),
       in_bounds_update_(false) {
@@ -24,6 +88,8 @@ void WindowSelectorItem::SetBounds(aura::Window* root_window,
   root_window_ = root_window;
   target_bounds_ = target_bounds;
   SetItemBounds(root_window, target_bounds, true);
+  // TODO(nsatragno): Handle window title updates.
+  UpdateWindowLabels(target_bounds, root_window);
 }
 
 void WindowSelectorItem::RecomputeWindowTransforms() {
@@ -34,4 +100,56 @@ void WindowSelectorItem::RecomputeWindowTransforms() {
   SetItemBounds(root_window_, target_bounds_, false);
 }
 
+void WindowSelectorItem::UpdateWindowLabels(const gfx::Rect& window_bounds,
+                                            aura::Window* root_window) {
+  gfx::Rect converted_bounds = ScreenUtil::ConvertRectFromScreen(root_window,
+                                                                
window_bounds);
+  gfx::Rect label_bounds(converted_bounds.x(),
+                         converted_bounds.bottom(),
+                         converted_bounds.width(),
+                         0);
+
+  // If the root window has changed, force the window label to be recreated
+  // and faded in on the new root window.
+  if (window_label_ &&
+      window_label_->GetNativeWindow()->GetRootWindow() != root_window) {
+    window_label_.reset();
+  }
+
+  if (!window_label_) {
+    window_label_.reset(CreateWindowLabel(root_window,
+                                          SelectionWindow()->title()));
+    label_bounds.set_height(window_label_->
+                            GetContentsView()->GetPreferredSize().height());
+    window_label_->GetNativeWindow()->SetBounds(label_bounds);
+    ui::Layer* layer = window_label_->GetNativeWindow()->layer();
+
+    layer->SetOpacity(0);
+    layer->GetAnimator()->StopAnimating();
+
+    layer->GetAnimator()->SchedulePauseForProperties(
+        base::TimeDelta::FromMilliseconds(
+            ScopedTransformOverviewWindow::kTransitionMilliseconds),
+        ui::LayerAnimationElement::OPACITY);
+
+    ui::ScopedLayerAnimationSettings settings(layer->GetAnimator());
+    settings.SetPreemptionStrategy(
+        ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
+    settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds(
+        kFadeInMilliseconds));
+    layer->SetOpacity(1);
+  } else {
+    ui::ScopedLayerAnimationSettings settings(
+        window_label_->GetNativeWindow()->layer()->GetAnimator());
+    settings.SetPreemptionStrategy(
+        ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
+    settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds(
+        ScopedTransformOverviewWindow::kTransitionMilliseconds));
+    label_bounds.set_height(window_label_->
+                            GetContentsView()->GetPreferredSize().height());
+    window_label_->GetNativeWindow()->SetBounds(label_bounds);
+  }
+
+}
+
 }  // namespace ash

Powered by Google App Engine
This is Rietveld 408576698