Commit 22228929 authored by sky@chromium.org's avatar sky@chromium.org

Minor refactoring of window resize code. I wasn't too happy with

continuing to have WindowResizer expose logic for
WorkspaceWindowResizer. Instead WindowResizer is pure virtual, with
some common code in static methods that both implementations can
use. This'll make the code for multi-window resizing more centralized.

BUG=116079
TEST=refactoring covered by tests
Review URL: https://chromiumcodereview.appspot.com/9599007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124939 0039d316-1c4b-4281-b951-d872f2087c98
parent 98ffde9b
......@@ -141,6 +141,8 @@
'wm/compact_layout_manager.h',
'wm/compact_status_area_layout_manager.cc',
'wm/compact_status_area_layout_manager.h',
'wm/default_window_resizer.cc',
'wm/default_window_resizer.h',
'wm/dialog_frame_view.cc',
'wm/dialog_frame_view.h',
'wm/image_grid.cc',
......
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/wm/default_window_resizer.h"
#include "ash/shell.h"
#include "ash/wm/root_window_event_filter.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
#include "ui/base/hit_test.h"
#include "ui/base/ui_base_types.h"
#include "ui/gfx/compositor/scoped_layer_animation_settings.h"
#include "ui/gfx/screen.h"
namespace ash {
DefaultWindowResizer::~DefaultWindowResizer() {
if (root_filter_)
root_filter_->UnlockCursor();
}
// static
DefaultWindowResizer*
DefaultWindowResizer::Create(aura::Window* window,
const gfx::Point& location,
int window_component,
int grid_size) {
Details details(window, location, window_component, grid_size);
return details.is_resizable ? new DefaultWindowResizer(details) : NULL;
}
void DefaultWindowResizer::Drag(const gfx::Point& location) {
gfx::Rect bounds(CalculateBoundsForDrag(details_, location));
if (bounds != details_.window->bounds()) {
did_move_or_resize_ = true;
details_.window->SetBounds(bounds);
}
}
void DefaultWindowResizer::CompleteDrag() {
if (details_.grid_size <= 1 || !did_move_or_resize_)
return;
gfx::Rect new_bounds(AdjustBoundsToGrid(details_));
if (new_bounds == details_.window->bounds())
return;
if (new_bounds.size() != details_.window->bounds().size()) {
// Don't attempt to animate a size change.
details_.window->SetBounds(new_bounds);
return;
}
ui::ScopedLayerAnimationSettings scoped_setter(
details_.window->layer()->GetAnimator());
// Use a small duration since the grid is small.
scoped_setter.SetTransitionDuration(base::TimeDelta::FromMilliseconds(100));
details_.window->SetBounds(new_bounds);
}
void DefaultWindowResizer::RevertDrag() {
if (!did_move_or_resize_)
return;
details_.window->SetBounds(details_.initial_bounds);
}
DefaultWindowResizer::DefaultWindowResizer(const Details& details)
: details_(details),
did_move_or_resize_(false),
root_filter_(NULL) {
DCHECK(details_.is_resizable);
root_filter_ = Shell::GetInstance()->root_filter();
if (root_filter_)
root_filter_->LockCursor();
}
} // namespace aura
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_WM_DEFAULT_WINDOW_RESIZER_H_
#define ASH_WM_DEFAULT_WINDOW_RESIZER_H_
#pragma once
#include "ash/wm/window_resizer.h"
#include "base/compiler_specific.h"
namespace ash {
namespace internal {
class RootWindowEventFilter;
}
// WindowResizer is used by ToplevelWindowEventFilter to handle dragging, moving
// or resizing a window. All coordinates passed to this are in the parent
// windows coordiantes.
class ASH_EXPORT DefaultWindowResizer : public WindowResizer {
public:
// Constants to identify the type of resize.
static const int kBoundsChange_None;
static const int kBoundsChange_Repositions;
static const int kBoundsChange_Resizes;
// Used to indicate which direction the resize occurs in.
static const int kBoundsChangeDirection_None;
static const int kBoundsChangeDirection_Horizontal;
static const int kBoundsChangeDirection_Vertical;
virtual ~DefaultWindowResizer();
// Creates a new DefaultWindowResizer. The caller takes ownership of the
// returned object. Returns NULL if not resizable.
static DefaultWindowResizer* Create(aura::Window* window,
const gfx::Point& location,
int window_component,
int grid_size);
// Returns true if the drag will result in changing the window in anyway.
bool is_resizable() const { return details_.is_resizable; }
// WindowResizer overides:
virtual void Drag(const gfx::Point& location) OVERRIDE;
virtual void CompleteDrag() OVERRIDE;
virtual void RevertDrag() OVERRIDE;
private:
explicit DefaultWindowResizer(const Details& details);
const Details details_;
// Set to true once Drag() is invoked and the bounds of the window change.
bool did_move_or_resize_;
internal::RootWindowEventFilter* root_filter_;
DISALLOW_COPY_AND_ASSIGN(DefaultWindowResizer);
};
} // namespace aura
#endif // ASH_WM_DEFAULT_WINDOW_RESIZER_H_
......@@ -5,6 +5,7 @@
#include "ash/wm/toplevel_window_event_filter.h"
#include "ash/shell.h"
#include "ash/wm/default_window_resizer.h"
#include "ash/wm/property_util.h"
#include "ash/wm/window_resizer.h"
#include "ash/wm/window_util.h"
......@@ -22,6 +23,17 @@
namespace ash {
namespace {
gfx::Point ConvertPointToParent(aura::Window* window,
const gfx::Point& point) {
gfx::Point result(point);
aura::Window::ConvertPointToWindow(window, window->parent(), &result);
return result;
}
}
ToplevelWindowEventFilter::ToplevelWindowEventFilter(aura::Window* owner)
: in_move_loop_(false),
in_gesture_resize_(false),
......@@ -51,10 +63,10 @@ bool ToplevelWindowEventFilter::PreHandleMouseEvent(aura::Window* target,
int component =
target->delegate()->GetNonClientComponent(event->location());
if (WindowResizer::GetBoundsChangeForWindowComponent(component)) {
gfx::Point parent_location(
ConvertPointToParent(target, event->location()));
window_resizer_.reset(
CreateWindowResizer(target, event->location(), component));
if (window_resizer_.get() && !window_resizer_->is_resizable())
window_resizer_.reset();
CreateWindowResizer(target, parent_location, component));
} else {
window_resizer_.reset();
}
......@@ -95,7 +107,8 @@ ui::TouchStatus ToplevelWindowEventFilter::PreHandleTouchEvent(
}
ui::GestureStatus ToplevelWindowEventFilter::PreHandleGestureEvent(
aura::Window* target, aura::GestureEvent* event) {
aura::Window* target,
aura::GestureEvent* event) {
switch (event->type()) {
case ui::ET_GESTURE_SCROLL_BEGIN: {
int component =
......@@ -105,10 +118,10 @@ ui::GestureStatus ToplevelWindowEventFilter::PreHandleGestureEvent(
return ui::GESTURE_STATUS_UNKNOWN;
}
in_gesture_resize_ = true;
gfx::Point parent_location(
ConvertPointToParent(target, event->location()));
window_resizer_.reset(
CreateWindowResizer(target, event->location(), component));
if (window_resizer_.get() && !window_resizer_->is_resizable())
window_resizer_.reset();
CreateWindowResizer(target, parent_location, component));
break;
}
case ui::ET_GESTURE_SCROLL_UPDATE: {
......@@ -134,11 +147,11 @@ ui::GestureStatus ToplevelWindowEventFilter::PreHandleGestureEvent(
void ToplevelWindowEventFilter::RunMoveLoop(aura::Window* source) {
DCHECK(!in_move_loop_); // Can only handle one nested loop at a time.
in_move_loop_ = true;
gfx::Point source_mouse_location(gfx::Screen::GetCursorScreenPoint());
gfx::Point parent_mouse_location(gfx::Screen::GetCursorScreenPoint());
aura::Window::ConvertPointToWindow(
Shell::GetRootWindow(), source, &source_mouse_location);
Shell::GetRootWindow(), source->parent(), &parent_mouse_location);
window_resizer_.reset(
CreateWindowResizer(source, source_mouse_location, HTCAPTION));
CreateWindowResizer(source, parent_mouse_location, HTCAPTION));
#if !defined(OS_MACOSX)
MessageLoopForUI::current()->RunWithDispatcher(
aura::Env::GetInstance()->GetDispatcher());
......@@ -159,13 +172,15 @@ void ToplevelWindowEventFilter::EndMoveLoop() {
Shell::GetRootWindow()->PostNativeEvent(ui::CreateNoopEvent());
}
// static
WindowResizer* ToplevelWindowEventFilter::CreateWindowResizer(
aura::Window* window,
const gfx::Point& point,
int window_component) {
if (!wm::IsWindowNormal(window))
return NULL; // Don't allow resizing/dragging maximized/fullscreen windows.
return new WindowResizer(window, point, window_component, grid_size_);
return DefaultWindowResizer::Create(
window, point, window_component, grid_size_);
}
void ToplevelWindowEventFilter::CompleteDrag(DragCompletionStatus status) {
......@@ -188,7 +203,7 @@ bool ToplevelWindowEventFilter::HandleDrag(aura::Window* target,
if (!window_resizer_.get())
return false;
window_resizer_->Drag(event->location());
window_resizer_->Drag(ConvertPointToParent(target, event->location()));
return true;
}
......
This diff is collapsed.
......@@ -16,12 +16,9 @@ class Window;
namespace ash {
namespace internal {
class RootWindowEventFilter;
}
// WindowResizer is used by ToplevelWindowEventFilter to handle dragging,
// moving or resizing a window.
// WindowResizer is used by ToplevelWindowEventFilter to handle dragging, moving
// or resizing a window. All coordinates passed to this are in the parent
// windows coordinates.
class ASH_EXPORT WindowResizer {
public:
// Constants to identify the type of resize.
......@@ -34,10 +31,7 @@ class ASH_EXPORT WindowResizer {
static const int kBoundsChangeDirection_Horizontal;
static const int kBoundsChangeDirection_Vertical;
WindowResizer(aura::Window* window,
const gfx::Point& location,
int window_component,
int grid_size);
WindowResizer();
virtual ~WindowResizer();
// Returns a bitmask of the kBoundsChange_ values.
......@@ -49,84 +43,80 @@ class ASH_EXPORT WindowResizer {
// Invoked to drag/move/resize the window. |location| is in the coordinates
// of the window supplied to the constructor.
void Drag(const gfx::Point& location);
virtual void Drag(const gfx::Point& location) = 0;
// Invoked to complete the drag.
virtual void CompleteDrag();
virtual void CompleteDrag() = 0;
// Reverts the drag.
virtual void RevertDrag();
// Returns true if the drag will result in changing the window in anyway.
bool is_resizable() const { return is_resizable_; }
// See description above members for details.
const gfx::Rect& initial_bounds() const { return initial_bounds_; }
const gfx::Point& initial_location_in_parent() const {
return initial_location_in_parent_;
}
int window_component() const { return window_component_; }
aura::Window* window() const { return window_; }
int grid_size() const { return grid_size_; }
bool did_move_or_resize() const { return did_move_or_resize_; }
int bounds_change() const { return bounds_change_; }
virtual void RevertDrag() = 0;
protected:
// Returns the bounds to give to the window once the mouse has moved to
// |location|.
virtual gfx::Rect GetBoundsForDrag(const gfx::Point& location);
struct Details {
Details();
Details(aura::Window* window,
const gfx::Point& location,
int window_component,
int grid_size);
~Details();
// Returns the final bounds. This differs from current bounds if a grid_size
// was specified.
virtual gfx::Rect GetFinalBounds();
// The window we're resizing.
aura::Window* window;
private:
// Returns the new origin of the window. The arguments are the difference
// between the current location and the initial location.
gfx::Point GetOriginForDrag(int delta_x, int delta_y) const;
// Initial bounds of the window.
gfx::Rect initial_bounds;
// Returns the size of the window for the drag.
gfx::Size GetSizeForDrag(int* delta_x, int* delta_y) const;
// Location passed to the constructor, in |window->parent()|'s coordinates.
gfx::Point initial_location_in_parent;
// Returns the width of the window.
int GetWidthForDrag(int min_width, int* delta_x) const;
// The component the user pressed on.
int window_component;
// Returns the height of the drag.
int GetHeightForDrag(int min_height, int* delta_y) const;
// Bitmask of the |kBoundsChange_| constants.
int bounds_change;
// The window we're resizing.
aura::Window* window_;
// Bitmask of the |kBoundsChangeDirection_| constants.
int position_change_direction;
// Initial bounds of the window.
const gfx::Rect initial_bounds_;
// Bitmask of the |kBoundsChangeDirection_| constants.
int size_change_direction;
// Location passed to the constructor, in |window->parent()|'s coordinates.
const gfx::Point initial_location_in_parent_;
// Will the drag actually modify the window?
bool is_resizable;
// The component the user pressed on.
const int window_component_;
// Size of the grid.
int grid_size;
};
// Bitmask of the |kBoundsChange_| constants.
const int bounds_change_;
static gfx::Rect CalculateBoundsForDrag(
const Details& details,
const gfx::Point& location);
// Bitmask of the |kBoundsChangeDirection_| constants.
const int position_change_direction_;
static gfx::Rect AdjustBoundsToGrid(const Details& details);
// Bitmask of the |kBoundsChangeDirection_| constants.
const int size_change_direction_;
static bool IsBottomEdge(int component);
// Will the drag actually modify the window?
const bool is_resizable_;
// Size of the grid.
const int grid_size_;
private:
// Returns the new origin of the window. The arguments are the difference
// between the current location and the initial location.
static gfx::Point GetOriginForDrag(const Details& details,
int delta_x,
int delta_y);
// Set to true once Drag() is invoked and the bounds of the window change.
bool did_move_or_resize_;
// Returns the size of the window for the drag.
static gfx::Size GetSizeForDrag(const Details& details,
int* delta_x,
int* delta_y);
internal::RootWindowEventFilter* root_filter_;
// Returns the width of the window.
static int GetWidthForDrag(const Details& details,
int min_width,
int* delta_x);
DISALLOW_COPY_AND_ASSIGN(WindowResizer);
// Returns the height of the drag.
static int GetHeightForDrag(const Details& details,
int min_height,
int* delta_y);
};
} // namespace aura
......
......@@ -93,8 +93,8 @@ WindowResizer* WorkspaceEventFilter::CreateWindowResizer(
(window_component != HTCAPTION || GetTrackedByWorkspace(window))) {
return NULL;
}
return
new WorkspaceWindowResizer(window, point, window_component, grid_size());
return WorkspaceWindowResizer::Create(
window, point, window_component, grid_size());
}
void WorkspaceEventFilter::UpdateHoveredWindow(
......
......@@ -4,6 +4,8 @@
#include "ash/wm/workspace/workspace_window_resizer.h"
#include "ash/shell.h"
#include "ash/wm/root_window_event_filter.h"
#include "ash/wm/window_util.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
......@@ -25,74 +27,123 @@ const aura::WindowProperty<int> kHeightBeforeObscuredProp = {0};
const aura::WindowProperty<int>* const kHeightBeforeObscuredKey =
&kHeightBeforeObscuredProp;
} // namespace
void SetHeightBeforeObscured(aura::Window* window, int height) {
window->SetProperty(kHeightBeforeObscuredKey, height);
}
WorkspaceWindowResizer::WorkspaceWindowResizer(aura::Window* window,
const gfx::Point& location,
int window_component,
int grid_size)
: WindowResizer(window, location, window_component, grid_size),
constrain_size_(wm::IsWindowNormal(window)) {
if (is_resizable() && GetHeightBeforeObscured(window) &&
constrain_size_ &&
(!WindowTouchesBottomOfScreen() ||
bounds_change() != kBoundsChange_Repositions)) {
ClearHeightBeforeObscured(window);
}
int GetHeightBeforeObscured(aura::Window* window) {
return window->GetProperty(kHeightBeforeObscuredKey);
}
void ClearHeightBeforeObscured(aura::Window* window) {
window->SetProperty(kHeightBeforeObscuredKey, 0);
}
} // namespace
WorkspaceWindowResizer::~WorkspaceWindowResizer() {
if (root_filter_)
root_filter_->UnlockCursor();
}
gfx::Rect WorkspaceWindowResizer::GetBoundsForDrag(const gfx::Point& location) {
if (!is_resizable())
return WindowResizer::GetBoundsForDrag(location);
// static
WorkspaceWindowResizer* WorkspaceWindowResizer::Create(
aura::Window* window,
const gfx::Point& location,
int window_component,
int grid_size) {
Details details(window, location, window_component, grid_size);
return details.is_resizable ?
new WorkspaceWindowResizer(details) : NULL;
}
gfx::Rect bounds(WindowResizer::GetBoundsForDrag(location));
AdjustBounds(&bounds);
return bounds;
void WorkspaceWindowResizer::Drag(const gfx::Point& location) {
gfx::Rect bounds = CalculateBoundsForDrag(details_, location);
if (constrain_size_)
AdjustBoundsForMainWindow(&bounds);
if (bounds != details_.window->bounds()) {
did_move_or_resize_ = true;
details_.window->SetBounds(bounds);
}
}
gfx::Rect WorkspaceWindowResizer::GetFinalBounds() {
if (grid_size() <= 1 || !GetHeightBeforeObscured(window()))
return WindowResizer::GetFinalBounds();
gfx::Rect initial_bounds(window()->bounds());
bool at_bottom = WindowTouchesBottomOfScreen();
gfx::Rect bounds(WindowResizer::GetFinalBounds());
if (at_bottom && bounds.y() != initial_bounds.y()) {
if (bounds.y() < initial_bounds.y()) {
bounds.set_height(bounds.height() + grid_size() -
(initial_bounds.y() - bounds.y()));
void WorkspaceWindowResizer::CompleteDrag() {
if (details_.grid_size <= 1 || !did_move_or_resize_ ||
details_.window_component != HTCAPTION)
return;
gfx::Rect bounds(AdjustBoundsToGrid(details_));
if (GetHeightBeforeObscured(window()) || constrain_size_) {
// Two things can happen:
// . We'll snap to the grid, which may result in different bounds. When
// dragging we only snap on release.
// . If the bounds are different, and the windows height was truncated
// because it touched the bottom, than snapping to the grid may cause the
// window to no longer touch the bottom. Push it back up.
gfx::Rect initial_bounds(window()->bounds());
bool at_bottom = TouchesBottomOfScreen();
if (at_bottom && bounds.y() != initial_bounds.y()) {
if (bounds.y() < initial_bounds.y()) {
bounds.set_height(bounds.height() + details_.grid_size -
(initial_bounds.y() - bounds.y()));
}
AdjustBoundsForMainWindow(&bounds);
}
AdjustBounds(&bounds);
}
return bounds;
}
// static
void WorkspaceWindowResizer::SetHeightBeforeObscured(aura::Window* window,
int height) {
window->SetProperty(kHeightBeforeObscuredKey, height);
}
if (bounds == details_.window->bounds())
return;
// static
void WorkspaceWindowResizer::ClearHeightBeforeObscured(aura::Window* window) {
window->SetProperty(kHeightBeforeObscuredKey, 0);
}
if (bounds.size() != details_.window->bounds().size()) {
// Don't attempt to animate a size change.
details_.window->SetBounds(bounds);
return;
}
// static
int WorkspaceWindowResizer::GetHeightBeforeObscured(aura::Window* window) {
return window->GetProperty(kHeightBeforeObscuredKey);
ui::ScopedLayerAnimationSettings scoped_setter(
details_.window->layer()->GetAnimator());
// Use a small duration since the grid is small.
scoped_setter.SetTransitionDuration(base::TimeDelta::FromMilliseconds(100));
details_.window->SetBounds(bounds);
}
void WorkspaceWindowResizer::AdjustBounds(gfx::Rect* bounds) const {
if (!constrain_size_)
void WorkspaceWindowResizer::RevertDrag() {
if (!did_move_or_resize_)
return;
details_.window->SetBounds(details_.initial_bounds);
}
WorkspaceWindowResizer::WorkspaceWindowResizer(
const Details& details)
: details_(details),
constrain_size_(wm::IsWindowNormal(details.window)),
did_move_or_resize_(false),
root_filter_(NULL) {
DCHECK(details_.is_resizable);
root_filter_ = Shell::GetInstance()->root_filter();
if (root_filter_)
root_filter_->LockCursor();
if (is_resizable() && constrain_size_ &&
(!TouchesBottomOfScreen() ||
details_.bounds_change != kBoundsChange_Repositions)) {
ClearCachedHeights();
}
}
void WorkspaceWindowResizer::AdjustBoundsForMainWindow(
gfx::Rect* bounds) const {
gfx::Rect work_area(gfx::Screen::GetMonitorWorkAreaNearestWindow(window()));
AdjustBoundsForWindow(work_area, window(), bounds);
}
void WorkspaceWindowResizer::AdjustBoundsForWindow(
const gfx::Rect& work_area,
aura::Window* window,
gfx::Rect* bounds) const {
if (bounds->bottom() < work_area.bottom()) {
int height = GetHeightBeforeObscured(window());
int height = GetHeightBeforeObscured(window);
if (!height)
return;
height = std::max(bounds->height(), height);
......@@ -103,20 +154,26 @@ void WorkspaceWindowResizer::AdjustBounds(gfx::Rect* bounds) const {
if (bounds->bottom() == work_area.bottom())
return;
if (!GetHeightBeforeObscured(window()))
SetHeightBeforeObscured(window(), window()->bounds().height());
if (!GetHeightBeforeObscured(window))
SetHeightBeforeObscured(window, window->bounds().height());
gfx::Size min_size = window()->delegate()->GetMinimumSize();
bounds->set_height(std::max(0, work_area.bottom() - bounds->y()));
gfx::Size min_size = window->delegate()->GetMinimumSize();
bounds->set_height(
std::max(0, work_area.bottom() - bounds->y()));
if (bounds->height() < min_size.height()) {
bounds->set_height(min_size.height());
bounds->set_y(work_area.bottom() - min_size.height());
}
}
bool WorkspaceWindowResizer::WindowTouchesBottomOfScreen() const {
gfx::Rect work_area(gfx::Screen::GetMonitorWorkAreaNearestWindow(window()));
return window()->bounds().bottom() == work_area.bottom();
void WorkspaceWindowResizer::ClearCachedHeights() {
ClearHeightBeforeObscured(details_.window);
}
bool WorkspaceWindowResizer::TouchesBottomOfScreen() const {
gfx::Rect work_area(
gfx::Screen::GetMonitorWorkAreaNearestWindow(details_.window));
return details_.window->bounds().bottom() == work_area.bottom();
}
} // namespace internal
......
......@@ -12,6 +12,8 @@
namespace ash {
namespace internal {
class RootWindowEventFilter;
// WindowResizer implementation for workspaces. This enforces that windows are
// not allowed to vertically move or resize outside of the work area. As windows
// are moved outside the work area they are shrunk. We remember the height of
......@@ -19,33 +21,56 @@ namespace internal {
// attempt to restore the old height.
class ASH_EXPORT WorkspaceWindowResizer : public WindowResizer {
public:
WorkspaceWindowResizer(aura::Window* window,
const gfx::Point& location,
int window_component,
int grid_size);
virtual ~WorkspaceWindowResizer();
protected:
// WindowResizer overrides:
virtual gfx::Rect GetBoundsForDrag(const gfx::Point& location) OVERRIDE;
virtual gfx::Rect GetFinalBounds() OVERRIDE;
// Creates a new WorkspaceWindowResizer. The caller takes ownership of the
// returned object. Returns NULL if not resizable.
static WorkspaceWindowResizer* Create(
aura::Window* window,
const gfx::Point& location,
int window_component,
int grid_size);
// Returns true if the drag will result in changing the window in anyway.
bool is_resizable() const { return details_.is_resizable; }
const gfx::Point& initial_location_in_parent() const {
return details_.initial_location_in_parent;
}
// Overridden from WindowResizer:
virtual void Drag(const gfx::Point& location);
virtual void CompleteDrag();
virtual void RevertDrag();
private:
// Used to maintain the height of the window before we started collapsing it.
static void SetHeightBeforeObscured(aura::Window* window, int height);
static void ClearHeightBeforeObscured(aura::Window* window);
static int GetHeightBeforeObscured(aura::Window* window);
explicit WorkspaceWindowResizer(const Details& details);
// Adjusts the bounds to enforce that windows are vertically contained in the
// work area.
void AdjustBounds(gfx::Rect* bounds) const;
void AdjustBoundsForMainWindow(gfx::Rect* bounds) const;
void AdjustBoundsForWindow(const gfx::Rect& work_area,
aura::Window* window,
gfx::Rect* bounds) const;
// Clears the cached height of the window being dragged.
void ClearCachedHeights();
// Returns true if the window touches the bottom of the work area.
bool WindowTouchesBottomOfScreen() const;
bool TouchesBottomOfScreen() const;
aura::Window* window() const { return details_.window; }
const Details details_;
// True if the window size (height) should be constrained.
const bool constrain_size_;
// Set to true once Drag() is invoked and the bounds of the window change.
bool did_move_or_resize_;
internal::RootWindowEventFilter* root_filter_;
DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer);
};
......
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