Chromium Code Reviews| Index: ash/common/shelf/shelf_widget.cc |
| diff --git a/ash/common/shelf/shelf_widget.cc b/ash/common/shelf/shelf_widget.cc |
| index 3c4b94750d8462049d876c6cc028bcb26639ece9..4ebc52eec6e2f401e9dc2457ebc6ad257f9642a1 100644 |
| --- a/ash/common/shelf/shelf_widget.cc |
| +++ b/ash/common/shelf/shelf_widget.cc |
| @@ -13,7 +13,6 @@ |
| #include "ash/common/shelf/shelf_delegate.h" |
| #include "ash/common/shelf/shelf_layout_manager.h" |
| #include "ash/common/shelf/shelf_view.h" |
| -#include "ash/common/shelf/wm_dimmer_view.h" |
| #include "ash/common/shelf/wm_shelf.h" |
| #include "ash/common/shelf/wm_shelf_util.h" |
| #include "ash/common/system/status_area_layout_manager.h" |
| @@ -63,10 +62,6 @@ class ShelfWidget::DelegateView : public views::WidgetDelegate, |
| ui::Layer* opaque_background() { return &opaque_background_; } |
| ui::Layer* opaque_foreground() { return &opaque_foreground_; } |
| - // Set if the shelf area is dimmed (eg when a window is maximized). |
| - void SetDimmed(bool dimmed); |
| - bool GetDimmed() const; |
| - |
| void SetParentLayer(ui::Layer* layer); |
| // views::View overrides: |
| @@ -85,23 +80,6 @@ class ShelfWidget::DelegateView : public views::WidgetDelegate, |
| void UpdateShelfOpaqueBackground(int alpha) override; |
| void UpdateShelfAssetBackground(int alpha) override; |
| - // Force the shelf to be presented in an undimmed state. |
| - void ForceUndimming(bool force); |
| - |
| - // A function to test the current alpha used by the dimming bar. If there is |
| - // no dimmer active, the function will return -1. |
| - int GetDimmingAlphaForTest(); |
| - |
| - // A function to test the bounds of the dimming bar. Returns gfx::Rect() if |
| - // the dimmer is inactive. |
| - gfx::Rect GetDimmerBoundsForTest(); |
| - |
| - // Disable dimming animations for running tests. This needs to be called |
| - // prior to the creation of of the dimmer. |
| - void disable_dimming_animations_for_test() { |
| - disable_dimming_animations_for_test_ = true; |
| - } |
| - |
| private: |
| WmShelf* wm_shelf_; |
| ShelfWidget* shelf_widget_; |
| @@ -115,13 +93,6 @@ class ShelfWidget::DelegateView : public views::WidgetDelegate, |
| // can be used simultaneously - so no repurposing possible. |
| ui::Layer opaque_foreground_; |
| - // The interface for the view which does the dimming. Null if the shelf is not |
| - // being dimmed, or if dimming is not supported (e.g. for mus). |
| - WmDimmerView* dimmer_view_; |
| - |
| - // True if dimming animations should be turned off. |
| - bool disable_dimming_animations_for_test_; |
| - |
| DISALLOW_COPY_AND_ASSIGN(DelegateView); |
| }; |
| @@ -132,9 +103,7 @@ ShelfWidget::DelegateView::DelegateView(WmShelf* wm_shelf, |
| focus_cycler_(nullptr), |
| asset_background_alpha_(0), |
| opaque_background_(ui::LAYER_SOLID_COLOR), |
| - opaque_foreground_(ui::LAYER_SOLID_COLOR), |
| - dimmer_view_(nullptr), |
| - disable_dimming_animations_for_test_(false) { |
| + opaque_foreground_(ui::LAYER_SOLID_COLOR) { |
| DCHECK(wm_shelf_); |
| DCHECK(shelf_widget_); |
| SetLayoutManager(new views::FillLayout()); |
| @@ -147,31 +116,7 @@ ShelfWidget::DelegateView::DelegateView(WmShelf* wm_shelf, |
| opaque_foreground_.SetOpacity(0.0f); |
| } |
| -ShelfWidget::DelegateView::~DelegateView() { |
| - // Make sure that the dimmer goes away since it might have set an observer. |
| - SetDimmed(false); |
| -} |
| - |
| -void ShelfWidget::DelegateView::SetDimmed(bool dimmed) { |
| - // When starting dimming, attempt to create a dimmer view. |
| - if (dimmed) { |
| - if (!dimmer_view_) { |
| - dimmer_view_ = |
| - wm_shelf_->CreateDimmerView(disable_dimming_animations_for_test_); |
| - } |
| - return; |
| - } |
| - |
| - // Close the dimmer widget when stopping dimming. |
| - if (dimmer_view_) { |
| - dimmer_view_->GetDimmerWidget()->CloseNow(); |
| - dimmer_view_ = nullptr; |
| - } |
| -} |
| - |
| -bool ShelfWidget::DelegateView::GetDimmed() const { |
| - return dimmer_view_ && dimmer_view_->GetDimmerWidget()->IsVisible(); |
| -} |
| +ShelfWidget::DelegateView::~DelegateView() {} |
| void ShelfWidget::DelegateView::SetParentLayer(ui::Layer* layer) { |
| layer->Add(&opaque_background_); |
| @@ -256,25 +201,6 @@ void ShelfWidget::DelegateView::ReorderChildLayers(ui::Layer* parent_layer) { |
| void ShelfWidget::DelegateView::OnBoundsChanged(const gfx::Rect& old_bounds) { |
| opaque_background_.SetBounds(GetLocalBounds()); |
| opaque_foreground_.SetBounds(GetLocalBounds()); |
| - if (dimmer_view_) |
| - dimmer_view_->GetDimmerWidget()->SetBounds(GetBoundsInScreen()); |
| -} |
| - |
| -void ShelfWidget::DelegateView::ForceUndimming(bool force) { |
| - if (GetDimmed()) |
| - dimmer_view_->ForceUndimming(force); |
| -} |
| - |
| -int ShelfWidget::DelegateView::GetDimmingAlphaForTest() { |
| - if (GetDimmed()) |
| - return dimmer_view_->GetDimmingAlphaForTest(); |
| - return -1; |
| -} |
| - |
| -gfx::Rect ShelfWidget::DelegateView::GetDimmerBoundsForTest() { |
| - if (GetDimmed()) |
| - return dimmer_view_->GetDimmerWidget()->GetWindowBoundsInScreen(); |
| - return gfx::Rect(); |
| } |
| void ShelfWidget::DelegateView::UpdateShelfOpaqueBackground(int alpha) { |
| @@ -388,19 +314,6 @@ void ShelfWidget::OnShelfAlignmentChanged() { |
| delegate_view_->SchedulePaint(); |
| } |
| -void ShelfWidget::SetDimsShelf(bool dimming) { |
| - delegate_view_->SetDimmed(dimming); |
| - // Repaint all children, allowing updates to reflect dimmed state eg: |
| - // status area background, app list button and overflow button. |
| - if (shelf_view_) |
| - shelf_view_->SchedulePaintForAllButtons(); |
|
James Cook
2016/12/08 01:26:43
I think this is the only caller of SchedulePaintFo
Evan Stade
2016/12/08 17:13:38
Done.
|
| - status_area_widget_->SchedulePaint(); |
| -} |
| - |
| -bool ShelfWidget::GetDimsShelf() const { |
| - return delegate_view_->GetDimmed(); |
| -} |
| - |
| ShelfView* ShelfWidget::CreateShelfView() { |
| DCHECK(!shelf_view_); |
| @@ -457,10 +370,6 @@ FocusCycler* ShelfWidget::GetFocusCycler() { |
| } |
| void ShelfWidget::Shutdown() { |
| - // Tear down the dimmer before |shelf_layout_manager_|, since the dimmer uses |
| - // |shelf_layout_manager_| to get the shelf's WmWindow, via WmShelf. |
| - delegate_view_->SetDimmed(false); |
| - |
| // Shutting down the status area widget may cause some widgets (e.g. bubbles) |
| // to close, so uninstall the ShelfLayoutManager event filters first. Don't |
| // reset the pointer until later because other widgets (e.g. app list) may |
| @@ -478,10 +387,6 @@ void ShelfWidget::Shutdown() { |
| CloseNow(); |
| } |
| -void ShelfWidget::ForceUndimming(bool force) { |
| - delegate_view_->ForceUndimming(force); |
| -} |
| - |
| void ShelfWidget::UpdateIconPositionForPanel(WmWindow* panel) { |
| WmWindow* shelf_window = WmLookup::Get()->GetWindowForWidget(this); |
| shelf_view_->UpdatePanelIconPosition( |
| @@ -518,23 +423,6 @@ void ShelfWidget::OnWidgetActivationChanged(views::Widget* widget, |
| delegate_view_->GetFocusManager()->ClearFocus(); |
| } |
| -int ShelfWidget::GetDimmingAlphaForTest() { |
| - if (delegate_view_) |
| - return delegate_view_->GetDimmingAlphaForTest(); |
| - return -1; |
| -} |
| - |
| -gfx::Rect ShelfWidget::GetDimmerBoundsForTest() { |
| - if (delegate_view_) |
| - return delegate_view_->GetDimmerBoundsForTest(); |
| - return gfx::Rect(); |
| -} |
| - |
| -void ShelfWidget::DisableDimmingAnimationsForTest() { |
| - DCHECK(delegate_view_); |
| - delegate_view_->disable_dimming_animations_for_test(); |
| -} |
| - |
| void ShelfWidget::UpdateShelfItemBackground(int alpha) { |
| if (shelf_view_) |
| shelf_view_->UpdateShelfItemBackground(alpha); |