Skip to content

Commit

Permalink
Add ui::PropertyChangeReason argument to aura::WindowObserver methods.
Browse files Browse the repository at this point in the history
With this CL, aura::WindowObserver::OnWindow(Bounds|Opacity)Changed()
have a new argument that indicates whether the property was set
directly or by an animation.

The goal is to allow the upcoming aura::WindowOcclusionTracker to
know when animations start without calling
ui::LayerAnimator::IsAnimatingOnePropertyOf().

TBR=sky@chromium.org

Bug: 738387
Change-Id: I91634a61f3abe99bb2240d4039c9f9fc5affbc65
Reviewed-on: https://chromium-review.googlesource.com/753706
Commit-Queue: François Doray <fdoray@chromium.org>
Reviewed-by: Sadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: David Reveman <reveman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#515729}
  • Loading branch information
fdoray authored and Commit Bot committed Nov 10, 2017
1 parent ed3d368 commit f935b87
Show file tree
Hide file tree
Showing 56 changed files with 262 additions and 80 deletions.
3 changes: 2 additions & 1 deletion ash/display/window_tree_host_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1489,7 +1489,8 @@ class RootWindowTestObserver : public aura::WindowObserver {

void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override {
shelf_display_bounds_ = ScreenUtil::GetDisplayBoundsWithShelf(window);
}

Expand Down
6 changes: 4 additions & 2 deletions ash/magnifier/magnification_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ class MagnificationControllerImpl : public MagnificationController,
void OnWindowDestroying(aura::Window* root_window) override;
void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override;
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override;

// Redraws the magnification window with the given origin position and the
// given scale. Returns true if the window is changed; otherwise, false.
Expand Down Expand Up @@ -566,7 +567,8 @@ void MagnificationControllerImpl::OnWindowDestroying(
void MagnificationControllerImpl::OnWindowBoundsChanged(
aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) {
// TODO(yoshiki): implement here. crbug.com/230979
}

Expand Down
3 changes: 2 additions & 1 deletion ash/wallpaper/wallpaper_widget_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ void WallpaperWidgetController::RemoveObservers() {
void WallpaperWidgetController::OnWindowBoundsChanged(
aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) {
SetBounds(new_bounds);
}

Expand Down
3 changes: 2 additions & 1 deletion ash/wallpaper/wallpaper_widget_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ class ASH_EXPORT WallpaperWidgetController : public views::WidgetObserver,
// aura::WindowObserver:
void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override;
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override;

views::Widget* widget_;

Expand Down
3 changes: 2 additions & 1 deletion ash/wm/lock_layout_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ void LockLayoutManager::OnWindowDestroying(aura::Window* window) {

void LockLayoutManager::OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) {
if (root_window_ == window) {
const wm::WMEvent wm_event(wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED);
AdjustWindowsForWorkAreaChange(&wm_event);
Expand Down
3 changes: 2 additions & 1 deletion ash/wm/lock_layout_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ class ASH_EXPORT LockLayoutManager
void OnWindowDestroying(aura::Window* window) override;
void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override;
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override;

// ShellObserver:
void OnVirtualKeyboardStateChanged(bool activated,
Expand Down
3 changes: 2 additions & 1 deletion ash/wm/overview/window_grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,8 @@ void WindowGrid::OnWindowDestroying(aura::Window* window) {

void WindowGrid::OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) {
// During preparation, window bounds can change. Ignore bounds
// change notifications in this case; we'll reposition soon.
if (!prepared_for_overview_)
Expand Down
3 changes: 2 additions & 1 deletion ash/wm/overview/window_grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ class ASH_EXPORT WindowGrid : public aura::WindowObserver,
// TODO(flackr): Handle window bounds changed in WindowSelectorItem.
void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override;
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override;

// wm::WindowStateObserver:
void OnPostWindowStateTypeChange(wm::WindowState* window_state,
Expand Down
3 changes: 2 additions & 1 deletion ash/wm/resize_shadow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ ResizeShadow::~ResizeShadow() {

void ResizeShadow::OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) {
UpdateBoundsAndVisibility();
}

Expand Down
3 changes: 2 additions & 1 deletion ash/wm/resize_shadow.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class ResizeShadow : public aura::WindowObserver {
// aura::WindowObserver:
void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override;
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override;
void OnWindowHierarchyChanged(const HierarchyChangeParams& params) override;
void OnWindowStackingChanged(aura::Window* window) override;

Expand Down
3 changes: 2 additions & 1 deletion ash/wm/root_window_layout_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class WindowDeleter : public aura::WindowObserver {
// aura::WindowObserver::
void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override {
delete target_;
}

Expand Down
3 changes: 2 additions & 1 deletion ash/wm/system_wallpaper_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ void SystemWallpaperController::SetColor(SkColor color) {
void SystemWallpaperController::OnWindowBoundsChanged(
aura::Window* root,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) {
DCHECK_EQ(root_window_, root);
layer_->SetBounds(gfx::Rect(root_window_->layer()->bounds().size()));
}
Expand Down
3 changes: 2 additions & 1 deletion ash/wm/system_wallpaper_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class SystemWallpaperController : public aura::WindowObserver {
// aura::WindowObserver overrides:
void OnWindowBoundsChanged(aura::Window* root,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override;
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override;

private:
class HostContentLayerDelegate;
Expand Down
3 changes: 2 additions & 1 deletion ash/wm/tablet_mode/tablet_mode_window_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ void TabletModeWindowManager::OnWindowPropertyChanged(aura::Window* window,
void TabletModeWindowManager::OnWindowBoundsChanged(
aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) {
if (!IsContainerWindow(window))
return;
// Reposition all non maximizeable windows.
Expand Down
3 changes: 2 additions & 1 deletion ash/wm/tablet_mode/tablet_mode_window_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ class ASH_EXPORT TabletModeWindowManager
intptr_t old) override;
void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override;
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override;
void OnWindowVisibilityChanged(aura::Window* window, bool visible) override;

// display::DisplayObserver:
Expand Down
3 changes: 2 additions & 1 deletion ash/wm/window_dimmer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ void WindowDimmer::SetDimOpacity(float target_opacity) {

void WindowDimmer::OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) {
if (window == parent_)
window_->SetBounds(gfx::Rect(new_bounds.size()));
}
Expand Down
3 changes: 2 additions & 1 deletion ash/wm/window_dimmer.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class ASH_EXPORT WindowDimmer : public aura::WindowObserver {
// aura::WindowObserver:
void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override;
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override;
void OnWindowDestroying(aura::Window* window) override;
void OnWindowHierarchyChanging(const HierarchyChangeParams& params) override;

Expand Down
3 changes: 2 additions & 1 deletion ash/wm/workspace/workspace_layout_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ void WorkspaceLayoutManager::OnWindowDestroying(aura::Window* window) {
void WorkspaceLayoutManager::OnWindowBoundsChanged(
aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) {
if (root_window_ == window) {
const wm::WMEvent wm_event(wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED);
AdjustAllWindowsBoundsForWorkAreaChange(&wm_event);
Expand Down
3 changes: 2 additions & 1 deletion ash/wm/workspace/workspace_layout_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ class ASH_EXPORT WorkspaceLayoutManager
void OnWindowDestroying(aura::Window* window) override;
void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override;
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override;

// wm::ActivationChangeObserver overrides:
void OnWindowActivating(ActivationReason reason,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ void FirstAppRunToastManager::OnAppWindowActivated(
void FirstAppRunToastManager::OnWindowBoundsChanged(
aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) {
if (toast_widget_ && window == app_window_->GetNativeWindow())
AdjustToastWidgetBounds();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ class FirstAppRunToastManager : public extensions::AppWindowRegistry::Observer,
// aura::WindowObserver:
void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override;
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override;

// extensions::AppWindowRegistry::Observer:
void OnAppWindowActivated(extensions::AppWindow* app_window) override;
Expand Down
6 changes: 4 additions & 2 deletions chrome/browser/ui/ash/chrome_keyboard_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ class WindowBoundsChangeObserver : public aura::WindowObserver {
private:
void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override {
ui_->UpdateInsetsForWindow(window);
}
void OnWindowDestroyed(aura::Window* window) override {
Expand Down Expand Up @@ -396,7 +397,8 @@ void ChromeKeyboardUI::ResetInsets() {

void ChromeKeyboardUI::OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) {
SetShadowAroundKeyboard();
}

Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/ui/ash/chrome_keyboard_ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ class ChromeKeyboardUI : public keyboard::KeyboardUI,
// aura::WindowObserver overrides:
void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override;
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override;
void OnWindowDestroyed(aura::Window* window) override;
void OnWindowParentChanged(aura::Window* window,
aura::Window* parent) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,8 @@ class TestWindowObserver : public aura::WindowObserver {

void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override {
resize_calls_++;
}

Expand Down
3 changes: 2 additions & 1 deletion components/exo/shell_surface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,8 @@ void ShellSurface::OnPostWindowStateTypeChange(

void ShellSurface::OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) {
// TODO(domlaskowski): For BoundsMode::CLIENT, the configure callback does not
// yet support resizing. See crbug.com/699746.
if (bounds_mode_ == BoundsMode::CLIENT)
Expand Down
3 changes: 2 additions & 1 deletion components/exo/shell_surface.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ class ShellSurface : public SurfaceTreeHost,
// Overridden from aura::WindowObserver:
void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override;
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override;
void OnWindowDestroying(aura::Window* window) override;

// Overridden from wm::ActivationChangeObserver:
Expand Down
3 changes: 2 additions & 1 deletion components/ui_devtools/views/window_element.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ void WindowElement::OnWindowStackingChanged(aura::Window* window) {

void WindowElement::OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) {
DCHECK_EQ(window_, window);
delegate()->OnUIElementBoundsChanged(this);
}
Expand Down
3 changes: 2 additions & 1 deletion components/ui_devtools/views/window_element.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class WindowElement : public aura::WindowObserver, public UIElement {
void OnWindowStackingChanged(aura::Window* window) override;
void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override;
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override;

// UIElement:
std::vector<std::pair<std::string, std::string>> GetCustomAttributes()
Expand Down
3 changes: 2 additions & 1 deletion content/browser/media/capture/aura_window_capture_machine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,8 @@ void AuraWindowCaptureMachine::CopyOutputFinishedForVideo(
void AuraWindowCaptureMachine::OnWindowBoundsChanged(
aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(desktop_window_ && window == desktop_window_);

Expand Down
3 changes: 2 additions & 1 deletion content/browser/media/capture/aura_window_capture_machine.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ class AuraWindowCaptureMachine : public media::VideoCaptureMachine,
// Implements aura::WindowObserver.
void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override;
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override;
void OnWindowDestroying(aura::Window* window) override;
void OnWindowAddedToRootWindow(aura::Window* window) override;
void OnWindowRemovingFromRootWindow(aura::Window* window,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,8 @@ class RenderWidgetHostViewAura::WindowAncestorObserver

void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override {
DCHECK(ancestors_.find(window) != ancestors_.end());
if (new_bounds.origin() != old_bounds.origin())
view_->HandleParentBoundsChanged();
Expand Down
3 changes: 2 additions & 1 deletion content/browser/web_contents/web_contents_view_aura.cc
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,8 @@ class WebContentsViewAura::WindowObserver

void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override {
if (window == host_window_ || window == view_->window_.get()) {
SendScreenRects();
if (old_bounds.origin() != new_bounds.origin()) {
Expand Down
3 changes: 2 additions & 1 deletion mash/simple_wm/move_loop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ void MoveLoop::OnWindowHierarchyChanged(const HierarchyChangeParams& params) {

void MoveLoop::OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) {
DCHECK_EQ(window, target_);
if (!changing_bounds_)
Cancel();
Expand Down
3 changes: 2 additions & 1 deletion mash/simple_wm/move_loop.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ class MoveLoop : public aura::WindowObserver {
void OnWindowHierarchyChanged(const HierarchyChangeParams& params) override;
void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override;
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override;
void OnWindowVisibilityChanged(aura::Window* window, bool visible) override;

// The window this MoveLoop is acting on. |target_| is set to null if the
Expand Down
3 changes: 2 additions & 1 deletion services/ui/ws/window_manager_client_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ class BoundsChangeObserver : public aura::WindowObserver {
// Overridden from WindowObserver:
void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override {
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override {
DCHECK_EQ(window, window_);
EXPECT_TRUE(WindowServerTestBase::QuitRunLoop());
}
Expand Down
8 changes: 5 additions & 3 deletions ui/app_list/presenter/app_list_presenter_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,11 @@ void AppListPresenterImpl::OnWindowFocused(aura::Window* gained_focus,

////////////////////////////////////////////////////////////////////////////////
// AppListPresenterImpl, aura::WindowObserver implementation:
void AppListPresenterImpl::OnWindowBoundsChanged(aura::Window* root,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
void AppListPresenterImpl::OnWindowBoundsChanged(
aura::Window* root,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) {
if (presenter_delegate_)
presenter_delegate_->UpdateBounds();
}
Expand Down
3 changes: 2 additions & 1 deletion ui/app_list/presenter/app_list_presenter_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ class APP_LIST_PRESENTER_EXPORT AppListPresenterImpl
// aura::WindowObserver overrides:
void OnWindowBoundsChanged(aura::Window* root,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override;
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) override;

// ui::ImplicitAnimationObserver overrides:
void OnImplicitAnimationsCompleted() override;
Expand Down
Loading

0 comments on commit f935b87

Please sign in to comment.