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

Unified Diff: ash/wm/window_resizer.cc

Issue 127053005: Cleanup: remove Details::window. Use GetTarget() when possible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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/wm/window_resizer.cc
diff --git a/ash/wm/window_resizer.cc b/ash/wm/window_resizer.cc
index 372ce4889e0539af5ebadc8bc8f88144a9ba7014..77ba9c67d94f1adc34bd6ee009dc1cd291c3b5d8 100644
--- a/ash/wm/window_resizer.cc
+++ b/ash/wm/window_resizer.cc
@@ -105,8 +105,7 @@ const int WindowResizer::kBoundsChangeDirection_Horizontal = 1;
const int WindowResizer::kBoundsChangeDirection_Vertical = 2;
WindowResizer::Details::Details()
- : window(NULL),
- window_state(NULL),
+ : window_state(NULL),
window_component(HTNOWHERE),
bounds_change(0),
position_change_direction(0),
@@ -119,8 +118,7 @@ WindowResizer::Details::Details(aura::Window* window,
const gfx::Point& location,
int window_component,
aura::client::WindowMoveSource source)
- : window(window),
- window_state(wm::GetWindowState(window)),
+ : window_state(wm::GetWindowState(window)),
initial_bounds_in_parent(window->bounds()),
restore_bounds(gfx::Rect()),
initial_location_in_parent(location),
@@ -142,6 +140,10 @@ WindowResizer::Details::Details(aura::Window* window,
WindowResizer::Details::~Details() {
}
+aura::Window* WindowResizer::Details::window() const {
+ return window_state ? window_state->window() : NULL;
+}
+
WindowResizer::WindowResizer() {
}
@@ -199,17 +201,17 @@ gfx::Rect WindowResizer::CalculateBoundsForDrag(
// has to come first since it might have an impact on the origin as well as
// on the size.
if (details.bounds_change & kBoundsChange_Resizes) {
- gfx::Rect work_area =
- Shell::GetScreen()->GetDisplayNearestWindow(details.window).work_area();
+ gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow(
+ details.window()).work_area();
aura::Window* dock_container = Shell::GetContainer(
- details.window->GetRootWindow(),
+ details.window()->GetRootWindow(),
internal::kShellWindowId_DockedContainer);
internal::DockedWindowLayoutManager* dock_layout =
static_cast<internal::DockedWindowLayoutManager*>(
dock_container->layout_manager());
work_area.Union(dock_layout->docked_bounds());
- work_area = ScreenAsh::ConvertRectFromScreen(details.window->parent(),
+ work_area = ScreenAsh::ConvertRectFromScreen(details.window()->parent(),
work_area);
if (details.size_change_direction & kBoundsChangeDirection_Horizontal) {
if (IsRightEdge(details.window_component) &&
@@ -262,7 +264,7 @@ gfx::Rect WindowResizer::CalculateBoundsForDrag(
// Make sure that |new_bounds| doesn't leave any of the displays. Note that
// the |work_area| above isn't good for this check since it is the work area
// for the current display but the window can move to a different one.
- aura::Window* parent = details.window->parent();
+ aura::Window* parent = details.window()->parent();
gfx::Point passed_location_in_screen(passed_location);
wm::ConvertPointToScreen(parent, &passed_location_in_screen);
gfx::Rect near_passed_location(passed_location_in_screen, gfx::Size());
@@ -354,7 +356,7 @@ gfx::Size WindowResizer::GetSizeForDrag(const Details& details,
int* delta_y) {
gfx::Size size = details.initial_bounds_in_parent.size();
if (details.bounds_change & kBoundsChange_Resizes) {
- gfx::Size min_size = details.window->delegate()->GetMinimumSize();
+ gfx::Size min_size = details.window()->delegate()->GetMinimumSize();
size.SetSize(GetWidthForDrag(details, min_size.width(), delta_x),
GetHeightForDrag(details, min_size.height(), delta_y));
} else if (!details.restore_bounds.IsEmpty()) {
@@ -383,8 +385,8 @@ int WindowResizer::GetWidthForDrag(const Details& details,
// And don't let the window go bigger than the display.
int max_width = Shell::GetScreen()->GetDisplayNearestWindow(
- details.window).bounds().width();
- gfx::Size max_size = details.window->delegate()->GetMaximumSize();
+ details.window()).bounds().width();
+ gfx::Size max_size = details.window()->delegate()->GetMaximumSize();
if (max_size.width() != 0)
max_width = std::min(max_width, max_size.width());
if (width > max_width) {
@@ -416,8 +418,8 @@ int WindowResizer::GetHeightForDrag(const Details& details,
// And don't let the window go bigger than the display.
int max_height = Shell::GetScreen()->GetDisplayNearestWindow(
- details.window).bounds().height();
- gfx::Size max_size = details.window->delegate()->GetMaximumSize();
+ details.window()).bounds().height();
+ gfx::Size max_size = details.window()->delegate()->GetMaximumSize();
if (max_size.height() != 0)
max_height = std::min(max_height, max_size.height());
if (height > max_height) {

Powered by Google App Engine
This is Rietveld 408576698