| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/wm/window_resizer.h" | 5 #include "ash/wm/window_resizer.h" |
| 6 | 6 |
| 7 #include "ash/screen_ash.h" | 7 #include "ash/screen_ash.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
| 10 #include "ash/wm/coordinate_conversion.h" | 10 #include "ash/wm/coordinate_conversion.h" |
| 11 #include "ash/wm/dock/docked_window_layout_manager.h" | 11 #include "ash/wm/dock/docked_window_layout_manager.h" |
| 12 #include "ash/wm/property_util.h" | 12 #include "ash/wm/window_state.h" |
| 13 #include "ash/wm/window_util.h" | 13 #include "ash/wm/window_util.h" |
| 14 #include "ui/aura/client/aura_constants.h" | 14 #include "ui/aura/client/aura_constants.h" |
| 15 #include "ui/aura/root_window.h" | 15 #include "ui/aura/root_window.h" |
| 16 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 17 #include "ui/aura/window_delegate.h" | 17 #include "ui/aura/window_delegate.h" |
| 18 #include "ui/base/hit_test.h" | 18 #include "ui/base/hit_test.h" |
| 19 #include "ui/base/ui_base_types.h" | 19 #include "ui/base/ui_base_types.h" |
| 20 #include "ui/compositor/scoped_layer_animation_settings.h" | 20 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 21 #include "ui/gfx/display.h" | 21 #include "ui/gfx/display.h" |
| 22 #include "ui/gfx/screen.h" | 22 #include "ui/gfx/screen.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 // static | 100 // static |
| 101 const int WindowResizer::kBoundsChangeDirection_None = 0; | 101 const int WindowResizer::kBoundsChangeDirection_None = 0; |
| 102 // static | 102 // static |
| 103 const int WindowResizer::kBoundsChangeDirection_Horizontal = 1; | 103 const int WindowResizer::kBoundsChangeDirection_Horizontal = 1; |
| 104 // static | 104 // static |
| 105 const int WindowResizer::kBoundsChangeDirection_Vertical = 2; | 105 const int WindowResizer::kBoundsChangeDirection_Vertical = 2; |
| 106 | 106 |
| 107 WindowResizer::Details::Details() | 107 WindowResizer::Details::Details() |
| 108 : window(NULL), | 108 : window(NULL), |
| 109 window_state(NULL), |
| 109 window_component(HTNOWHERE), | 110 window_component(HTNOWHERE), |
| 110 bounds_change(0), | 111 bounds_change(0), |
| 111 position_change_direction(0), | 112 position_change_direction(0), |
| 112 size_change_direction(0), | 113 size_change_direction(0), |
| 113 is_resizable(false), | 114 is_resizable(false), |
| 114 source(aura::client::WINDOW_MOVE_SOURCE_MOUSE) { | 115 source(aura::client::WINDOW_MOVE_SOURCE_MOUSE) { |
| 115 } | 116 } |
| 116 | 117 |
| 117 WindowResizer::Details::Details(aura::Window* window, | 118 WindowResizer::Details::Details(aura::Window* window, |
| 118 const gfx::Point& location, | 119 const gfx::Point& location, |
| 119 int window_component, | 120 int window_component, |
| 120 aura::client::WindowMoveSource source) | 121 aura::client::WindowMoveSource source) |
| 121 : window(window), | 122 : window(window), |
| 123 window_state(wm::GetWindowState(window)), |
| 122 initial_bounds_in_parent(window->bounds()), | 124 initial_bounds_in_parent(window->bounds()), |
| 123 restore_bounds(gfx::Rect()), | 125 restore_bounds(gfx::Rect()), |
| 124 initial_location_in_parent(location), | 126 initial_location_in_parent(location), |
| 125 initial_opacity(window->layer()->opacity()), | 127 initial_opacity(window->layer()->opacity()), |
| 126 window_component(window_component), | 128 window_component(window_component), |
| 127 bounds_change(GetBoundsChangeForWindowComponent(window_component)), | 129 bounds_change(GetBoundsChangeForWindowComponent(window_component)), |
| 128 position_change_direction( | 130 position_change_direction( |
| 129 GetPositionChangeDirectionForWindowComponent(window_component)), | 131 GetPositionChangeDirectionForWindowComponent(window_component)), |
| 130 size_change_direction( | 132 size_change_direction( |
| 131 GetSizeChangeDirectionForWindowComponent(window_component)), | 133 GetSizeChangeDirectionForWindowComponent(window_component)), |
| 132 is_resizable(bounds_change != kBoundsChangeDirection_None), | 134 is_resizable(bounds_change != kBoundsChangeDirection_None), |
| 133 source(source) { | 135 source(source) { |
| 134 if (wm::IsWindowNormal(window) && | 136 if (window_state->IsNormalShowState() && |
| 135 GetRestoreBoundsInScreen(window) && | 137 window_state->HasRestoreBounds() && |
| 136 window_component == HTCAPTION) | 138 window_component == HTCAPTION) |
| 137 restore_bounds = *GetRestoreBoundsInScreen(window); | 139 restore_bounds = window_state->GetRestoreBoundsInScreen(); |
| 138 } | 140 } |
| 139 | 141 |
| 140 WindowResizer::Details::~Details() { | 142 WindowResizer::Details::~Details() { |
| 141 } | 143 } |
| 142 | 144 |
| 143 WindowResizer::WindowResizer() { | 145 WindowResizer::WindowResizer() { |
| 144 } | 146 } |
| 145 | 147 |
| 146 WindowResizer::~WindowResizer() { | 148 WindowResizer::~WindowResizer() { |
| 147 } | 149 } |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 if (height > max_height) { | 418 if (height > max_height) { |
| 417 height = max_height; | 419 height = max_height; |
| 418 *delta_y = -y_multiplier * (details.initial_bounds_in_parent.height() - | 420 *delta_y = -y_multiplier * (details.initial_bounds_in_parent.height() - |
| 419 max_height); | 421 max_height); |
| 420 } | 422 } |
| 421 } | 423 } |
| 422 return height; | 424 return height; |
| 423 } | 425 } |
| 424 | 426 |
| 425 } // namespace aura | 427 } // namespace aura |
| OLD | NEW |