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

Unified Diff: ash/common/wm/overview/window_selector_item.h

Issue 2239233002: [ash-md] Fades overview header in and out (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [ash-md] Fades overview header in and out (fixed a new test assertion) Created 4 years, 3 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
« no previous file with comments | « ash/common/wm/overview/window_grid.cc ('k') | ash/common/wm/overview/window_selector_item.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/wm/overview/window_selector_item.h
diff --git a/ash/common/wm/overview/window_selector_item.h b/ash/common/wm/overview/window_selector_item.h
index d3467685e639fd637ca260f2d90830debf0eee42..510690efa1c8c62e7756749a8c4ddd96f334a985 100644
--- a/ash/common/wm/overview/window_selector_item.h
+++ b/ash/common/wm/overview/window_selector_item.h
@@ -14,6 +14,7 @@
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/views/controls/button/button.h"
+#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/widget/widget.h"
@@ -44,6 +45,9 @@ class ASH_EXPORT WindowSelectorItem : public views::ButtonListener,
// Makes sure that text is readable with |background_color|.
void SetBackgroundColorHint(SkColor background_color);
+ // Resets the listener so that the listener can go out of scope.
+ void ResetListener() { listener_ = nullptr; }
+
void set_padding(const gfx::Insets& padding) { padding_ = padding; }
protected:
@@ -57,6 +61,21 @@ class ASH_EXPORT WindowSelectorItem : public views::ButtonListener,
DISALLOW_COPY_AND_ASSIGN(OverviewLabelButton);
};
+ // An image button with a close window icon.
+ class OverviewCloseButton : public views::ImageButton {
+ public:
+ explicit OverviewCloseButton(views::ButtonListener* listener);
+ ~OverviewCloseButton() override;
+
+ // Resets the listener so that the listener can go out of scope.
+ void ResetListener() { listener_ = nullptr; }
+
+ private:
+ gfx::ImageSkia icon_image_;
+
+ DISALLOW_COPY_AND_ASSIGN(OverviewCloseButton);
+ };
+
WindowSelectorItem(WmWindow* window, WindowSelector* window_selector);
~WindowSelectorItem() override;
@@ -68,9 +87,12 @@ class ASH_EXPORT WindowSelectorItem : public views::ButtonListener,
// Returns true if |target| is contained in this WindowSelectorItem.
bool Contains(const WmWindow* target) const;
- // Restores and animates the managed window to it's non overview mode state.
+ // Restores and animates the managed window to its non overview mode state.
void RestoreWindow();
+ // Restores stacking of window captions above the windows, then fades out.
+ void Shutdown();
+
// Forces the managed window to be shown (ie not hidden or minimized) when
// calling RestoreWindow().
void ShowWindowOnExit();
@@ -113,6 +135,11 @@ class ASH_EXPORT WindowSelectorItem : public views::ButtonListener,
// Closes |transform_window_|.
void CloseWindow();
+ // Hides the original window header and sets shape or mask on a window.
+ // When masks are used, rounded corner |radius| can be specified.
+ // TODO(varkha): remove |radius|.
+ void HideHeaderAndSetShape(int radius);
+
// Sets if the item is dimmed in the overview. Changing the value will also
// change the visibility of the transform windows.
void SetDimmed(bool dimmed);
@@ -131,8 +158,15 @@ class ASH_EXPORT WindowSelectorItem : public views::ButtonListener,
private:
class CaptionContainerView;
+ class RoundedContainerView;
friend class WindowSelectorTest;
+ enum class HeaderFadeInMode {
+ ENTER,
+ UPDATE,
+ EXIT,
+ };
+
// Sets the bounds of this selector's items to |target_bounds| in
// |root_window_|. The bounds change will be animated as specified
// by |animation_type|.
@@ -151,8 +185,11 @@ class ASH_EXPORT WindowSelectorItem : public views::ButtonListener,
// Updates the close button's and title label's bounds. Any change in bounds
// will be animated from the current bounds to the new bounds as per the
- // |animation_type|.
- void UpdateHeaderLayout(OverviewAnimationType animation_type);
+ // |animation_type|. |mode| allows distinguishing the first time update which
+ // allows setting the initial bounds properly or exiting overview to fade out
+ // gradually.
+ void UpdateHeaderLayout(HeaderFadeInMode mode,
+ OverviewAnimationType animation_type);
// Animates opacity of the |transform_window_| and its caption to |opacity|
// using |animation_type|.
@@ -161,6 +198,9 @@ class ASH_EXPORT WindowSelectorItem : public views::ButtonListener,
// Updates the close buttons accessibility name.
void UpdateCloseButtonAccessibilityName();
+ // Fades out a window caption when exiting overview mode.
+ void FadeOut(std::unique_ptr<views::Widget> widget);
+
static bool hide_header() { return use_mask_ || use_shape_; }
// True if the item is being shown in the overview, false if it's being
@@ -181,6 +221,10 @@ class ASH_EXPORT WindowSelectorItem : public views::ButtonListener,
// a window layer for display on another monitor.
bool in_bounds_update_;
+ // True when |this| item is visually selected. Item header is made transparent
+ // when the item is selected.
+ bool selected_;
+
// Label displaying its name (active tab for tabbed windows).
// With Material Design this Widget owns |caption_container_view_| and is
// shown above the |transform_window_|.
@@ -190,9 +234,6 @@ class ASH_EXPORT WindowSelectorItem : public views::ButtonListener,
// Shadow around the item in overview.
std::unique_ptr<::wm::Shadow> shadow_;
- // Label background widget used to fade in opacity when moving selection.
- std::unique_ptr<views::Widget> window_label_selector_;
-
// Container view that owns |window_label_button_view_| and |close_button_|.
// Only used with Material Design.
CaptionContainerView* caption_container_view_;
@@ -206,12 +247,16 @@ class ASH_EXPORT WindowSelectorItem : public views::ButtonListener,
// A close button for the window in this item. Owned by the
// |caption_container_view_| with Material Design or by |close_button_widget_|
// otherwise.
- views::ImageButton* close_button_;
+ OverviewCloseButton* close_button_;
// Pointer to the WindowSelector that owns the WindowGrid containing |this|.
// Guaranteed to be non-null for the lifetime of |this|.
WindowSelector* window_selector_;
+ // Pointer to a view that covers the original header and has rounded top
+ // corners. This view can have its color and opacity animated.
+ RoundedContainerView* background_view_;
+
// If true, mask the original window header while in overview and make corners
// rounded using a mask layer. This has performance implications so it can be
// disabled when there are many windows.
« no previous file with comments | « ash/common/wm/overview/window_grid.cc ('k') | ash/common/wm/overview/window_selector_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698