From d8748a3907d55ade9282b8cf4d0993ac9ee5ab66 Mon Sep 17 00:00:00 2001 From: varkha Date: Tue, 19 Jul 2016 09:03:45 -0700 Subject: [PATCH] [ash-md] Improves smoothness with many windows in overview Experimentally, most of the animation cost was coming from having window shapes (used to mask the window header) and from using rounded rectangle masks. This CL disables both those performance hogs when there are more than certain number of windows in the overview mode (controlled via flags). Default is set to hardcoded 10. It also makes sure that window controls (minimize / resize / close) are hidden when in overview mode for custom and panel frames. New flags are introduced: --ash-max-previews-to-use-mask= Maximum number of preview windows in overview mode that can use masks to hide window headers and use rounded corners. Use -1 to set to unlimited. --ash-max-previews-to-use-shape= Maximum number of preview windows in overview mode that can use shapes to hide window headers. Use -1 to set to unlimited. BUG=626851 BUG=624608 Review-Url: https://codereview.chromium.org/2146323004 Cr-Commit-Position: refs/heads/master@{#406286} --- ash/common/ash_switches.cc | 10 ++++ ash/common/ash_switches.h | 2 + .../scoped_transform_overview_window.cc | 40 +++++++++----- .../scoped_transform_overview_window.h | 7 ++- ash/common/wm/overview/window_grid.cc | 35 +++++++++++- .../wm/overview/window_selector_item.cc | 26 ++++++--- ash/common/wm/overview/window_selector_item.h | 14 +++++ ash/frame/custom_frame_view_ash.cc | 13 +++++ ash/wm/panels/panel_frame_view.cc | 38 +++++++++---- ash/wm/panels/panel_frame_view.h | 14 +++-- chrome/app/generated_resources.grd | 42 ++++++++++++++ chrome/browser/about_flags.cc | 55 ++++++++++++++++--- tools/metrics/histograms/histograms.xml | 2 + 13 files changed, 250 insertions(+), 48 deletions(-) diff --git a/ash/common/ash_switches.cc b/ash/common/ash_switches.cc index 6cf8ab45249e64..3211e2aa3e61af 100644 --- a/ash/common/ash_switches.cc +++ b/ash/common/ash_switches.cc @@ -98,6 +98,16 @@ const char kAshMaterialDesignDisabled[] = "disabled"; const char kAshMaterialDesignEnabled[] = "enabled"; const char kAshMaterialDesignExperimental[] = "experimental"; +// Specifies a maximum number of preview windows in overview mode that still +// allows using mask layers to hide the original window header and use rounded +// corners. +const char kAshMaxWindowsToUseMaskInOverview[] = "ash-max-previews-to-use-mask"; + +// Specifies a maximum number of preview windows in overview mode that still +// allows using alpha shapes to hide the original window header. +const char kAshMaxWindowsToUseShapeInOverview[] = + "ash-max-previews-to-use-shape"; + // Specifies the layout mode and offsets for the secondary display for // testing. The format is "," where t=TOP, r=RIGHT, // b=BOTTOM and L=LEFT. For example, 'r,-100' means the secondary display diff --git a/ash/common/ash_switches.h b/ash/common/ash_switches.h index 21540a99e9ef14..4c06f7ee858377 100644 --- a/ash/common/ash_switches.h +++ b/ash/common/ash_switches.h @@ -44,6 +44,8 @@ ASH_EXPORT extern const char kAshMaterialDesign[]; ASH_EXPORT extern const char kAshMaterialDesignDisabled[]; ASH_EXPORT extern const char kAshMaterialDesignEnabled[]; ASH_EXPORT extern const char kAshMaterialDesignExperimental[]; +ASH_EXPORT extern const char kAshMaxWindowsToUseMaskInOverview[]; +ASH_EXPORT extern const char kAshMaxWindowsToUseShapeInOverview[]; ASH_EXPORT extern const char kAshSecondaryDisplayLayout[]; ASH_EXPORT extern const char kAshTouchHud[]; ASH_EXPORT extern const char kAshUseFirstDisplayAsInternal[]; diff --git a/ash/common/wm/overview/scoped_transform_overview_window.cc b/ash/common/wm/overview/scoped_transform_overview_window.cc index a2abe5d0e1a77c..8e5cf5fdf7a326 100644 --- a/ash/common/wm/overview/scoped_transform_overview_window.cc +++ b/ash/common/wm/overview/scoped_transform_overview_window.cc @@ -180,10 +180,11 @@ TransientDescendantIteratorRange GetTransientTreeIterator(WmWindow* window) { class ScopedTransformOverviewWindow::OverviewContentMask : public ui::LayerDelegate { public: - explicit OverviewContentMask(float radius); + explicit OverviewContentMask(); ~OverviewContentMask() override; void set_radius(float radius) { radius_ = radius; } + void set_inset(int inset) { inset_ = inset; } ui::Layer* layer() { return &layer_; } // Overridden from LayerDelegate. @@ -195,13 +196,13 @@ class ScopedTransformOverviewWindow::OverviewContentMask private: ui::Layer layer_; float radius_; + int inset_; DISALLOW_COPY_AND_ASSIGN(OverviewContentMask); }; -ScopedTransformOverviewWindow::OverviewContentMask::OverviewContentMask( - float radius) - : layer_(ui::LAYER_TEXTURED), radius_(radius) { +ScopedTransformOverviewWindow::OverviewContentMask::OverviewContentMask() + : layer_(ui::LAYER_TEXTURED), radius_(0), inset_(0) { layer_.set_delegate(this); } @@ -213,6 +214,7 @@ void ScopedTransformOverviewWindow::OverviewContentMask::OnPaintLayer( const ui::PaintContext& context) { ui::PaintRecorder recorder(context, layer()->size()); gfx::Rect bounds(layer()->bounds().size()); + bounds.Inset(0, inset_, 0, 0); // Tile a window into an area, rounding the bottom corners. const SkRect rect = gfx::RectToSkRect(bounds); @@ -268,7 +270,8 @@ void ScopedTransformOverviewWindow::RestoreWindow() { ScopedAnimationSettings animation_settings_list; BeginScopedAnimation(OverviewAnimationType::OVERVIEW_ANIMATION_RESTORE_WINDOW, &animation_settings_list); - SetTransform(window()->GetRootWindow(), original_transform_, 0); + SetTransform(window()->GetRootWindow(), original_transform_, + false /* use_mask */, false /* use_shape */, 0); std::unique_ptr animation_settings = CreateScopedOverviewAnimationSettings( @@ -417,30 +420,39 @@ gfx::Transform ScopedTransformOverviewWindow::GetTransformForRect( void ScopedTransformOverviewWindow::SetTransform( WmWindow* root_window, const gfx::Transform& transform, + bool use_mask, + bool use_shape, float radius) { DCHECK(overview_started_); if (ash::MaterialDesignController::IsOverviewMaterial() && &transform != &original_transform_) { - if (!mask_) { - mask_.reset(new OverviewContentMask(radius)); + if (use_mask && !mask_) { + mask_.reset(new OverviewContentMask()); mask_->layer()->SetFillsBoundsOpaquely(false); window()->GetLayer()->SetMaskLayer(mask_->layer()); } - gfx::Rect bounds(GetTargetBoundsInScreen().size()); - mask_->layer()->SetBounds(bounds); - mask_->set_radius(radius); - window()->GetLayer()->SchedulePaint(bounds); - if (!determined_original_window_shape_) { determined_original_window_shape_ = true; SkRegion* window_shape = window()->GetLayer()->alpha_shape(); if (!original_window_shape_ && window_shape) original_window_shape_.reset(new SkRegion(*window_shape)); } + gfx::Rect bounds(GetTargetBoundsInScreen().size()); const int inset = - window()->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET); - if (inset > 0) { + (use_mask || use_shape) + ? window()->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET) + : 0; + if (mask_) { + // Mask layer is used both to hide the window header and to use rounded + // corners. Its layout needs to be update when setting a transform. + mask_->layer()->SetBounds(bounds); + mask_->set_inset(inset); + mask_->set_radius(radius); + window()->GetLayer()->SchedulePaint(bounds); + } else if (inset > 0) { + // Alpha shape is only used to to hide the window header and only when + // not using a mask layer. bounds.Inset(0, inset, 0, 0); SkRegion* region = new SkRegion; region->setRect(RectToSkIRect(bounds)); diff --git a/ash/common/wm/overview/scoped_transform_overview_window.h b/ash/common/wm/overview/scoped_transform_overview_window.h index a32974ad2824d9..6f8a904ae991e2 100644 --- a/ash/common/wm/overview/scoped_transform_overview_window.h +++ b/ash/common/wm/overview/scoped_transform_overview_window.h @@ -105,9 +105,14 @@ class ASH_EXPORT ScopedTransformOverviewWindow { // Applies the |transform| to the overview window and all of its transient // children. With Material Design creates a mask layer with the bottom edge - // using rounded corners of |radius|. + // using rounded corners of |radius|. When |use_mask| is set, hides the + // original window header and uses rounded rectangle mask which may be + // resource-intensive. When |use_shape| is set and |use_mask| is not, uses + // SetAlphaShape to mask the header. void SetTransform(WmWindow* root_window, const gfx::Transform& transform, + bool use_mask, + bool use_shape, float radius); // Set's the opacity of the managed windows. diff --git a/ash/common/wm/overview/window_grid.cc b/ash/common/wm/overview/window_grid.cc index d3b9265a260b46..9652e5deefc6fb 100644 --- a/ash/common/wm/overview/window_grid.cc +++ b/ash/common/wm/overview/window_grid.cc @@ -30,6 +30,7 @@ #include "base/command_line.h" #include "base/i18n/string_search.h" #include "base/memory/scoped_vector.h" +#include "base/strings/string_number_conversions.h" #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/pathops/SkPathOps.h" #include "ui/compositor/layer_animation_observer.h" @@ -73,6 +74,10 @@ const float kCardAspectRatio = 4.0f / 3.0f; // landscape orientation). const int kMinCardsMajor = 3; +// Hiding window headers can be resource intensive. Only hide the headers when +// the number of windows in this grid is less or equal than this number. +const int kMaxWindowsCountToHideHeader = 10; + const int kOverviewSelectorTransitionMilliseconds = 250; // The color and opacity of the screen shield in overview. @@ -452,6 +457,34 @@ void WindowGrid::PrepareForOverview() { void WindowGrid::PositionWindowsMD(bool animate) { if (window_list_.empty()) return; + + const int kUnlimited = -1; + const size_t windows_count = window_list_.size(); + const base::CommandLine* command_line = + base::CommandLine::ForCurrentProcess(); + int windows_to_use_masks = kMaxWindowsCountToHideHeader; + if (command_line->HasSwitch(switches::kAshMaxWindowsToUseMaskInOverview) && + (!base::StringToInt(command_line->GetSwitchValueASCII( + switches::kAshMaxWindowsToUseMaskInOverview), + &windows_to_use_masks) || + windows_to_use_masks <= kUnlimited)) { + windows_to_use_masks = kMaxWindowsCountToHideHeader; + } + int windows_to_use_shapes = kUnlimited; + if (command_line->HasSwitch(switches::kAshMaxWindowsToUseShapeInOverview) && + (!base::StringToInt(command_line->GetSwitchValueASCII( + switches::kAshMaxWindowsToUseShapeInOverview), + &windows_to_use_shapes) || + windows_to_use_shapes <= kUnlimited)) { + windows_to_use_shapes = kUnlimited; + } + WindowSelectorItem::set_use_mask(windows_to_use_masks <= kUnlimited || + static_cast(windows_count) <= + windows_to_use_masks); + WindowSelectorItem::set_use_shape(windows_to_use_shapes <= kUnlimited || + static_cast(windows_count) <= + windows_to_use_shapes); + gfx::Rect total_bounds = root_window_->ConvertRectToScreen(wm::GetDisplayWorkAreaBoundsInParent( root_window_->GetChildByShellWindowId( @@ -560,7 +593,7 @@ void WindowGrid::PositionWindowsMD(bool animate) { } // Position the windows centering the left-aligned rows vertically. gfx::Vector2d offset(0, (total_bounds.bottom() - max_bottom) / 2); - for (size_t i = 0; i < window_list_.size(); ++i) { + for (size_t i = 0; i < windows_count; ++i) { window_list_[i]->SetBounds( rects[i] + offset, animate diff --git a/ash/common/wm/overview/window_selector_item.cc b/ash/common/wm/overview/window_selector_item.cc index 83725e84a0d16f..3fb0ea6640e847 100644 --- a/ash/common/wm/overview/window_selector_item.cc +++ b/ash/common/wm/overview/window_selector_item.cc @@ -106,7 +106,7 @@ static const float kPreCloseScale = 0.02f; // Calculates the |window| bounds after being transformed to the selector's // space. The returned Rect is in virtual screen coordinates. -gfx::Rect GetTransformedBounds(WmWindow* window) { +gfx::Rect GetTransformedBounds(WmWindow* window, bool hide_header) { gfx::RectF bounds( window->GetRootWindow()->ConvertRectToScreen(window->GetTargetBounds())); gfx::Transform new_transform = TransformAboutPivot( @@ -116,7 +116,7 @@ gfx::Rect GetTransformedBounds(WmWindow* window) { // With Material Design the preview title is shown above the preview window. // Hide the window header for apps or browser windows with no tabs (web apps) // to avoid showing both the window header and the preview title. - if (ash::MaterialDesignController::IsOverviewMaterial()) { + if (ash::MaterialDesignController::IsOverviewMaterial() && hide_header) { gfx::RectF header_bounds(bounds); header_bounds.set_height( window->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET)); @@ -215,6 +215,9 @@ class RoundedContainerView : public views::View { } // namespace +bool WindowSelectorItem::use_mask_ = false; +bool WindowSelectorItem::use_shape_ = false; + WindowSelectorItem::OverviewLabelButton::OverviewLabelButton( views::ButtonListener* listener, const base::string16& text) @@ -457,9 +460,12 @@ void WindowSelectorItem::OnWindowTitleChanged(WmWindow* window) { float WindowSelectorItem::GetItemScale(const gfx::Size& size) { gfx::Size inset_size(size.width(), size.height() - 2 * kWindowMarginMD); + const int header_inset = + hide_header() + ? GetWindow()->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET) + : 0; return ScopedTransformOverviewWindow::GetItemScale( - GetWindow()->GetTargetBounds().size(), inset_size, - GetWindow()->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET), + GetWindow()->GetTargetBounds().size(), inset_size, header_inset, close_button_->GetPreferredSize().height()); } @@ -476,8 +482,10 @@ void WindowSelectorItem::SetItemBounds(const gfx::Rect& target_bounds, int top_view_inset = 0; int title_height = 0; if (ash::MaterialDesignController::IsOverviewMaterial()) { - top_view_inset = - GetWindow()->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET); + if (hide_header()) { + top_view_inset = + GetWindow()->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET); + } title_height = close_button_->GetPreferredSize().height(); } gfx::Rect selector_item_bounds = @@ -491,7 +499,7 @@ void WindowSelectorItem::SetItemBounds(const gfx::Rect& target_bounds, // before the transform. Dividing by scale factor obtains the corner radius // which when scaled will yield |kLabelBackgroundRadius|. transform_window_.SetTransform( - root_window_, transform, + root_window_, transform, use_mask_, use_shape_, (kLabelBackgroundRadius / GetItemScale(target_bounds.size()))); transform_window_.set_overview_transform(transform); } @@ -589,8 +597,8 @@ void WindowSelectorItem::CreateWindowLabel(const base::string16& title) { void WindowSelectorItem::UpdateHeaderLayout( OverviewAnimationType animation_type) { - gfx::Rect transformed_window_bounds = - root_window_->ConvertRectFromScreen(GetTransformedBounds(GetWindow())); + gfx::Rect transformed_window_bounds = root_window_->ConvertRectFromScreen( + GetTransformedBounds(GetWindow(), hide_header())); if (ash::MaterialDesignController::IsOverviewMaterial()) { gfx::Rect label_rect(close_button_->GetPreferredSize()); diff --git a/ash/common/wm/overview/window_selector_item.h b/ash/common/wm/overview/window_selector_item.h index a275e1f6996381..f533a4abe881af 100644 --- a/ash/common/wm/overview/window_selector_item.h +++ b/ash/common/wm/overview/window_selector_item.h @@ -114,6 +114,8 @@ class ASH_EXPORT WindowSelectorItem : public views::ButtonListener, bool dimmed() const { return dimmed_; } const gfx::Rect& target_bounds() const { return target_bounds_; } + static void set_use_mask(bool use_mask) { use_mask_ = use_mask; } + static void set_use_shape(bool use_shape) { use_shape_ = use_shape; } // views::ButtonListener: void ButtonPressed(views::Button* sender, const ui::Event& event) override; @@ -154,6 +156,8 @@ class ASH_EXPORT WindowSelectorItem : public views::ButtonListener, // Updates the close buttons accessibility name. void UpdateCloseButtonAccessibilityName(); + static bool hide_header() { return use_mask_ || use_shape_; } + // True if the item is being shown in the overview, false if it's being // filtered. bool dimmed_; @@ -203,6 +207,16 @@ class ASH_EXPORT WindowSelectorItem : public views::ButtonListener, // Guaranteed to be non-null for the lifetime of |this|. WindowSelector* window_selector_; + // 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. + static bool use_mask_; + + // If true, hide the original window header while in overview using alpha + // shape. This has performance implications so it can be disabled when there + // are many windows. + static bool use_shape_; + DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); }; diff --git a/ash/frame/custom_frame_view_ash.cc b/ash/frame/custom_frame_view_ash.cc index c188b9949faaac..c0f057c4f81e36 100644 --- a/ash/frame/custom_frame_view_ash.cc +++ b/ash/frame/custom_frame_view_ash.cc @@ -9,6 +9,7 @@ #include "ash/aura/wm_window_aura.h" #include "ash/common/ash_switches.h" +#include "ash/common/material_design/material_design_controller.h" #include "ash/common/session/session_state_delegate.h" #include "ash/common/shell_observer.h" #include "ash/common/wm/window_state.h" @@ -165,6 +166,8 @@ class CustomFrameViewAsh::HeaderView void ChildPreferredSizeChanged(views::View* child) override; // ShellObserver: + void OnOverviewModeStarting() override; + void OnOverviewModeEnded() override; void OnMaximizeModeStarted() override; void OnMaximizeModeEnded() override; @@ -310,6 +313,16 @@ void CustomFrameViewAsh::HeaderView::ChildPreferredSizeChanged( /////////////////////////////////////////////////////////////////////////////// // CustomFrameViewAsh::HeaderView, ShellObserver overrides: +void CustomFrameViewAsh::HeaderView::OnOverviewModeStarting() { + if (ash::MaterialDesignController::IsOverviewMaterial()) + caption_button_container_->SetVisible(false); +} + +void CustomFrameViewAsh::HeaderView::OnOverviewModeEnded() { + if (ash::MaterialDesignController::IsOverviewMaterial()) + caption_button_container_->SetVisible(true); +} + void CustomFrameViewAsh::HeaderView::OnMaximizeModeStarted() { caption_button_container_->UpdateSizeButtonVisibility(); parent()->Layout(); diff --git a/ash/wm/panels/panel_frame_view.cc b/ash/wm/panels/panel_frame_view.cc index 85846f490c70c8..129d9010bdeaa7 100644 --- a/ash/wm/panels/panel_frame_view.cc +++ b/ash/wm/panels/panel_frame_view.cc @@ -4,6 +4,8 @@ #include "ash/wm/panels/panel_frame_view.h" +#include "ash/common/material_design/material_design_controller.h" +#include "ash/common/wm_shell.h" #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" #include "ash/frame/default_header_painter.h" #include "ash/frame/frame_border_hit_test_controller.h" @@ -29,9 +31,12 @@ PanelFrameView::PanelFrameView(views::Widget* frame, FrameType frame_type) DCHECK(!frame_->widget_delegate()->CanMaximize()); if (frame_type != FRAME_NONE) InitHeaderPainter(); + WmShell::Get()->AddShellObserver(this); } -PanelFrameView::~PanelFrameView() {} +PanelFrameView::~PanelFrameView() { + WmShell::Get()->RemoveShellObserver(this); +} void PanelFrameView::SetFrameColors(SkColor active_frame_color, SkColor inactive_frame_color) { @@ -105,6 +110,19 @@ void PanelFrameView::UpdateWindowTitle() { void PanelFrameView::SizeConstraintsChanged() {} +gfx::Rect PanelFrameView::GetBoundsForClientView() const { + gfx::Rect client_bounds = bounds(); + client_bounds.Inset(0, NonClientTopBorderHeight(), 0, 0); + return client_bounds; +} + +gfx::Rect PanelFrameView::GetWindowBoundsForClientBounds( + const gfx::Rect& client_bounds) const { + gfx::Rect window_bounds = client_bounds; + window_bounds.Inset(0, -NonClientTopBorderHeight(), 0, 0); + return window_bounds; +} + int PanelFrameView::NonClientHitTest(const gfx::Point& point) { if (!header_painter_) return HTNOWHERE; @@ -124,17 +142,17 @@ void PanelFrameView::OnPaint(gfx::Canvas* canvas) { header_painter_->PaintHeader(canvas, header_mode); } -gfx::Rect PanelFrameView::GetBoundsForClientView() const { - gfx::Rect client_bounds = bounds(); - client_bounds.Inset(0, NonClientTopBorderHeight(), 0, 0); - return client_bounds; +/////////////////////////////////////////////////////////////////////////////// +// PanelFrameView, ShellObserver overrides: + +void PanelFrameView::OnOverviewModeStarting() { + if (ash::MaterialDesignController::IsOverviewMaterial()) + caption_button_container_->SetVisible(false); } -gfx::Rect PanelFrameView::GetWindowBoundsForClientBounds( - const gfx::Rect& client_bounds) const { - gfx::Rect window_bounds = client_bounds; - window_bounds.Inset(0, -NonClientTopBorderHeight(), 0, 0); - return window_bounds; +void PanelFrameView::OnOverviewModeEnded() { + if (ash::MaterialDesignController::IsOverviewMaterial()) + caption_button_container_->SetVisible(true); } } // namespace ash diff --git a/ash/wm/panels/panel_frame_view.h b/ash/wm/panels/panel_frame_view.h index 0ecd7e7db6c959..1c0547a2f51a56 100644 --- a/ash/wm/panels/panel_frame_view.h +++ b/ash/wm/panels/panel_frame_view.h @@ -8,6 +8,7 @@ #include #include "ash/ash_export.h" +#include "ash/common/shell_observer.h" #include "base/macros.h" #include "ui/views/window/non_client_view.h" @@ -20,7 +21,8 @@ class DefaultHeaderPainter; class FrameCaptionButtonContainerView; class FrameBorderHitTestController; -class ASH_EXPORT PanelFrameView : public views::NonClientFrameView { +class ASH_EXPORT PanelFrameView : public views::NonClientFrameView, + public ShellObserver { public: // Internal class name. static const char kViewClassName[]; @@ -34,7 +36,7 @@ class ASH_EXPORT PanelFrameView : public views::NonClientFrameView { // will have some transparency added when the frame is drawn. void SetFrameColors(SkColor active_frame_color, SkColor inactive_frame_color); - // Overridden from views::View: + // views::View: const char* GetClassName() const override; private: @@ -43,7 +45,7 @@ class ASH_EXPORT PanelFrameView : public views::NonClientFrameView { // Height from top of window to top of client area. int NonClientTopBorderHeight() const; - // Overridden from views::NonClientFrameView: + // views::NonClientFrameView: gfx::Rect GetBoundsForClientView() const override; gfx::Rect GetWindowBoundsForClientBounds( const gfx::Rect& client_bounds) const override; @@ -54,11 +56,15 @@ class ASH_EXPORT PanelFrameView : public views::NonClientFrameView { void UpdateWindowTitle() override; void SizeConstraintsChanged() override; - // Overridden from views::View: + // views::View: gfx::Size GetMinimumSize() const override; void Layout() override; void OnPaint(gfx::Canvas* canvas) override; + // ShellObserver: + void OnOverviewModeStarting() override; + void OnOverviewModeEnded() override; + // Child View class describing the panel's title bar behavior // and buttons, owned by the view hierarchy views::Widget* frame_; diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 4a6cc011d43ad7..ba4a90fcdcbe12 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -5703,6 +5703,48 @@ Keep your key file in a safe place. You will need it to create new versions of y Experimental + + Maximum number of windows in overview that can use masks. + + + Maximum number of preview windows in overview mode that can use masks to hide window headers and use rounded corners. + + + Unlimited + + + 0 + + + 5 + + + 10 + + + 15 + + + Maximum number of windows in overview that can use shapes. + + + Maximum number of preview windows in overview mode that can use shapes to hide window headers. + + + Unlimited + + + 0 + + + 5 + + + 10 + + + 15 + Window backdrops in TouchView diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 9a28fe4844405d..4e6d852c79022e 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -378,6 +378,34 @@ const FeatureEntry::Choice kAshMaterialDesignChoices[] = { ash::switches::kAshMaterialDesignExperimental}, }; +const FeatureEntry::Choice kAshMaxWindowsToUseMaskInOverviewChoices[] = { + {IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", ""}, + {IDS_FLAGS_ASH_MAX_PREVIEWS_TO_USE_MASK_UNLIMITED, + ash::switches::kAshMaxWindowsToUseMaskInOverview, "-1"}, + {IDS_FLAGS_ASH_MAX_PREVIEWS_TO_USE_MASK_ZERO, + ash::switches::kAshMaxWindowsToUseMaskInOverview, "0"}, + {IDS_FLAGS_ASH_MAX_PREVIEWS_TO_USE_MASK_FIVE, + ash::switches::kAshMaxWindowsToUseMaskInOverview, "5"}, + {IDS_FLAGS_ASH_MAX_PREVIEWS_TO_USE_MASK_TEN, + ash::switches::kAshMaxWindowsToUseMaskInOverview, "10"}, + {IDS_FLAGS_ASH_MAX_PREVIEWS_TO_USE_MASK_FIFTEEN, + ash::switches::kAshMaxWindowsToUseMaskInOverview, "15"}, +}; + +const FeatureEntry::Choice kAshMaxWindowsToUseShapeInOverviewChoices[] = { + {IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", ""}, + {IDS_FLAGS_ASH_MAX_PREVIEWS_TO_USE_SHAPE_UNLIMITED, + ash::switches::kAshMaxWindowsToUseShapeInOverview, "-1"}, + {IDS_FLAGS_ASH_MAX_PREVIEWS_TO_USE_SHAPE_ZERO, + ash::switches::kAshMaxWindowsToUseShapeInOverview, "0"}, + {IDS_FLAGS_ASH_MAX_PREVIEWS_TO_USE_SHAPE_FIVE, + ash::switches::kAshMaxWindowsToUseShapeInOverview, "5"}, + {IDS_FLAGS_ASH_MAX_PREVIEWS_TO_USE_SHAPE_TEN, + ash::switches::kAshMaxWindowsToUseShapeInOverview, "10"}, + {IDS_FLAGS_ASH_MAX_PREVIEWS_TO_USE_SHAPE_FIFTEEN, + ash::switches::kAshMaxWindowsToUseShapeInOverview, "15"}, +}; + const FeatureEntry::Choice kAshMaterialDesignInkDropAnimationSpeed[] = { {IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", ""}, {IDS_FLAGS_MATERIAL_DESIGN_INK_DROP_ANIMATION_FAST, @@ -777,9 +805,8 @@ const FeatureEntry kFeatureEntries[] = { IDS_FLAGS_EXPERIMENTAL_WEB_PLATFORM_FEATURES_NAME, IDS_FLAGS_EXPERIMENTAL_WEB_PLATFORM_FEATURES_DESCRIPTION, kOsAll, SINGLE_VALUE_TYPE(switches::kEnableExperimentalWebPlatformFeatures)}, - {"enable-web-bluetooth", // FLAGS:RECORD_UMA - IDS_FLAGS_WEB_BLUETOOTH_NAME, - IDS_FLAGS_WEB_BLUETOOTH_DESCRIPTION, + {"enable-web-bluetooth", // FLAGS:RECORD_UMA + IDS_FLAGS_WEB_BLUETOOTH_NAME, IDS_FLAGS_WEB_BLUETOOTH_DESCRIPTION, kOsCrOS | kOsMac | kOsAndroid | kOsLinux, SINGLE_VALUE_TYPE(switches::kEnableWebBluetooth)}, #if defined(ENABLE_EXTENSIONS) @@ -953,6 +980,18 @@ const FeatureEntry kFeatureEntries[] = { ash::switches::kAshEnableStableOverviewOrder, ash::switches::kAshDisableStableOverviewOrder), }, + { + "ash-max-previews-to-use-mask", + IDS_FLAGS_ASH_MAX_PREVIEWS_TO_USE_MASK_NAME, + IDS_FLAGS_ASH_MAX_PREVIEWS_TO_USE_MASK_DESCRIPTION, kOsCrOS, + MULTI_VALUE_TYPE(kAshMaxWindowsToUseMaskInOverviewChoices), + }, + { + "ash-max-previews-to-use-shape", + IDS_FLAGS_ASH_MAX_PREVIEWS_TO_USE_SHAPE_NAME, + IDS_FLAGS_ASH_MAX_PREVIEWS_TO_USE_SHAPE_DESCRIPTION, kOsCrOS, + MULTI_VALUE_TYPE(kAshMaxWindowsToUseShapeInOverviewChoices), + }, #endif // defined(USE_ASH) #if defined(OS_CHROMEOS) {"material-design-ink-drop-animation-speed", @@ -1814,8 +1853,7 @@ const FeatureEntry kFeatureEntries[] = { #if defined(ENABLE_EXTENSIONS) {"tab-for-desktop-share", IDS_FLAG_DISABLE_TAB_FOR_DESKTOP_SHARE, IDS_FLAG_DISABLE_TAB_FOR_DESKTOP_SHARE_DESCRIPTION, kOsAll, - SINGLE_VALUE_TYPE( - extensions::switches::kDisableTabForDesktopShare)}, + SINGLE_VALUE_TYPE(extensions::switches::kDisableTabForDesktopShare)}, {"disable-desktop-capture-picker-new-ui", IDS_FLAG_DISABLE_DESKTOP_CAPTURE_PICKER_NEW_UI, IDS_FLAG_DISABLE_DESKTOP_CAPTURE_PICKER_NEW_UI_DESCRIPTION, kOsAll, @@ -1909,8 +1947,7 @@ const FeatureEntry kFeatureEntries[] = { {"important-sites-in-cbd", IDS_FLAGS_IMPORTANT_SITES_IN_CBD_NAME, IDS_FLAGS_IMPORTANT_SITES_IN_CBD_DESCRIPTION, kOsAndroid, FEATURE_VALUE_TYPE(chrome::android::kImportantSitesInCBD)}, - {"autoplay-muted-videos", - IDS_FLAGS_ENABLE_AUTOPLAY_MUTED_VIDEOS_NAME, + {"autoplay-muted-videos", IDS_FLAGS_ENABLE_AUTOPLAY_MUTED_VIDEOS_NAME, IDS_FLAGS_ENABLE_AUTOPLAY_MUTED_VIDEOS_DESCRIPTION, kOsAndroid, FEATURE_VALUE_TYPE(features::kAutoplayMutedVideos)}, #endif @@ -1968,8 +2005,8 @@ const FeatureEntry kFeatureEntries[] = { ENABLE_DISABLE_VALUE_TYPE(chromeos::switches::kEnableFilesQuickView, chromeos::switches::kDisableFilesQuickView)}, #endif // defined(OS_CHROMEOS) - // NOTE: Adding new command-line switches requires adding corresponding - // entries to enum "LoginCustomFlags" in histograms.xml. See note in + // NOTE: Adding new command-line switches requires adding corresponding + // entries to enum "LoginCustomFlags" in histograms.xml. See note in // histograms.xml and don't forget to run AboutFlagsHistogramTest unit test. }; diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 2e4e1b665d4b5c..db30d0bc34423e 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -81726,6 +81726,7 @@ To add a new entry, add it with any value and run test to compute valid value. + @@ -81746,6 +81747,7 @@ To add a new entry, add it with any value and run test to compute valid value. +