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

Unified Diff: ash/common/wm/maximize_mode/workspace_backdrop_delegate.cc

Issue 2792773002: Fullscreen backdrop window for maximize mode (Closed)
Patch Set: updated the test Created 3 years, 9 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/common/wm/maximize_mode/workspace_backdrop_delegate.cc
diff --git a/ash/common/wm/maximize_mode/workspace_backdrop_delegate.cc b/ash/common/wm/maximize_mode/workspace_backdrop_delegate.cc
index ccf3c4f66c003b5dcca39a939d1a51c8da0693cd..6962ce59b2915b5d4a692a2d100a825d74b47f15 100644
--- a/ash/common/wm/maximize_mode/workspace_backdrop_delegate.cc
+++ b/ash/common/wm/maximize_mode/workspace_backdrop_delegate.cc
@@ -9,7 +9,6 @@
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/root_window_controller.h"
#include "base/auto_reset.h"
-#include "ui/aura/window_observer.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/views/background.h"
@@ -25,31 +24,8 @@ const float kBackdropOpacity = 1.0f;
} // namespace
-class WorkspaceBackdropDelegate::WindowObserverImpl
- : public aura::WindowObserver {
- public:
- explicit WindowObserverImpl(WorkspaceBackdropDelegate* delegate)
- : delegate_(delegate) {}
- ~WindowObserverImpl() override {}
-
- private:
- // aura::WindowObserver overrides:
- void OnWindowBoundsChanged(aura::Window* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) override {
- // The container size has changed and the layer needs to be adapt to it.
- delegate_->AdjustToContainerBounds();
- }
-
- WorkspaceBackdropDelegate* delegate_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowObserverImpl);
-};
-
WorkspaceBackdropDelegate::WorkspaceBackdropDelegate(WmWindow* container)
- : container_observer_(new WindowObserverImpl(this)),
- container_(container),
- in_restacking_(false) {
+ : container_(container), in_restacking_(false) {
background_ = new views::Widget;
views::Widget::InitParams params(
views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
@@ -73,11 +49,9 @@ WorkspaceBackdropDelegate::WorkspaceBackdropDelegate(WmWindow* container)
DCHECK(background_window_->GetBounds() == params.bounds);
Show();
RestackBackdrop();
- container_->aura_window()->AddObserver(container_observer_.get());
}
WorkspaceBackdropDelegate::~WorkspaceBackdropDelegate() {
- container_->aura_window()->RemoveObserver(container_observer_.get());
// TODO: animations won't work right with mus: http://crbug.com/548396.
::wm::ScopedHidingAnimationSettings hiding_settings(
background_->GetNativeView());
@@ -108,10 +82,6 @@ void WorkspaceBackdropDelegate::OnPostWindowStateTypeChange(
RestackBackdrop();
}
-void WorkspaceBackdropDelegate::OnDisplayWorkAreaInsetsChanged() {
- AdjustToContainerBounds();
-}
-
void WorkspaceBackdropDelegate::RestackBackdrop() {
// Avoid recursive calls.
if (in_restacking_)
@@ -151,24 +121,10 @@ WmWindow* WorkspaceBackdropDelegate::GetCurrentTopWindow() {
return nullptr;
}
-void WorkspaceBackdropDelegate::AdjustToContainerBounds() {
- // Cover the entire container window.
- gfx::Rect target_rect(gfx::Point(0, 0), container_->GetBounds().size());
- if (target_rect != background_window_->GetBounds()) {
- // TODO: this won't work right with mus: http://crbug.com/548396.
- // This needs to be instant.
- ui::ScopedLayerAnimationSettings settings(
- background_window_->GetLayer()->GetAnimator());
- settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds(0));
- background_window_->SetBounds(target_rect);
- if (!background_->IsVisible())
- background_window_->GetLayer()->SetOpacity(kBackdropOpacity);
- }
-}
-
void WorkspaceBackdropDelegate::Show() {
background_window_->GetLayer()->SetOpacity(0.0f);
background_->Show();
+ background_->SetFullscreen(true);
ui::ScopedLayerAnimationSettings settings(
background_window_->GetLayer()->GetAnimator());
background_window_->GetLayer()->SetOpacity(kBackdropOpacity);
« no previous file with comments | « ash/common/wm/maximize_mode/workspace_backdrop_delegate.h ('k') | ash/common/wm/workspace/workspace_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698