Commit e77165bd authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

ash: removes EnvObserver from WindowMirrorView

This code was necessary to avoid forcing a remote client to be visible
until occlusion tracking was enabled. Now that mash is no more, there are no
remote clients and this can be removed.

BUG=961763
TEST=none

Change-Id: I05d9603b82a14a1b394287540747e6b84269cb28
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1635292
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#665553}
parent 1a72f136
......@@ -102,17 +102,14 @@ void WindowMirrorView::AddedToWidget() {
target_ = GetWidget()->GetNativeWindow();
target_->TrackOcclusionState();
force_occlusion_tracker_visible_.reset();
env_observer_.RemoveAll();
// Wait for window-occlusion tracker to be running before forcing visibility.
// This is done to minimize the amount of work during the initial animation
// when entering overview. In particular, telling the remote client it is
// visible is likely to result in a fair amount of work.
if (aura::Env::GetInstance()->GetWindowOcclusionTracker()->IsPaused())
env_observer_.Add(aura::Env::GetInstance());
else
ForceVisibilityAndOcclusion();
if (source_) {
// Force the occlusion tracker to treat the source as visible.
force_occlusion_tracker_visible_ =
std::make_unique<aura::WindowOcclusionTracker::ScopedForceVisible>(
source_);
} else {
force_occlusion_tracker_visible_.reset();
}
}
void WindowMirrorView::RemovedFromWidget() {
......@@ -163,26 +160,5 @@ gfx::Rect WindowMirrorView::GetClientAreaBounds() const {
return client_view->ConvertRectToWidget(client_view->GetLocalBounds());
}
void WindowMirrorView::ForceVisibilityAndOcclusion() {
// Force the occlusion tracker to treat the source (or the desk container if
// source_ is on an inactive desk) as visible.
aura::Window* window_to_force_visible = source_;
aura::Window* desk_container =
desks_util::GetDeskContainerForContext(source_);
if (desk_container && !desks_util::IsActiveDeskContainer(desk_container))
window_to_force_visible = desk_container;
force_occlusion_tracker_visible_ =
std::make_unique<aura::WindowOcclusionTracker::ScopedForceVisible>(
window_to_force_visible);
}
void WindowMirrorView::OnWindowOcclusionTrackingResumed() {
// Skip if the source_ has already been removed.
if (source_)
ForceVisibilityAndOcclusion();
env_observer_.RemoveAll();
}
} // namespace wm
} // namespace ash
......@@ -9,9 +9,6 @@
#include "ash/ash_export.h"
#include "base/macros.h"
#include "base/scoped_observer.h"
#include "ui/aura/env.h"
#include "ui/aura/env_observer.h"
#include "ui/aura/window_observer.h"
#include "ui/aura/window_occlusion_tracker.h"
#include "ui/views/view.h"
......@@ -29,8 +26,7 @@ namespace wm {
// A view that mirrors the client area of a single (source) window.
class ASH_EXPORT WindowMirrorView : public views::View,
public aura::WindowObserver,
public aura::EnvObserver {
public aura::WindowObserver {
public:
WindowMirrorView(aura::Window* source, bool trilinear_filtering_on_init);
~WindowMirrorView() override;
......@@ -63,11 +59,6 @@ class ASH_EXPORT WindowMirrorView : public views::View,
// coordinate space.
gfx::Rect GetClientAreaBounds() const;
void ForceVisibilityAndOcclusion();
// aura::EnvObserver:
void OnWindowOcclusionTrackingResumed() override;
// The original window that is being represented by |this|.
aura::Window* source_;
......@@ -85,8 +76,6 @@ class ASH_EXPORT WindowMirrorView : public views::View,
std::unique_ptr<aura::WindowOcclusionTracker::ScopedForceVisible>
force_occlusion_tracker_visible_;
ScopedObserver<aura::Env, aura::EnvObserver> env_observer_{this};
DISALLOW_COPY_AND_ASSIGN(WindowMirrorView);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment