| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/common/wm/dock/docked_window_resizer.h" | 5 #include "ash/common/wm/dock/docked_window_resizer.h" |
| 6 | 6 |
| 7 #include "ash/common/wm/dock/docked_window_layout_manager.h" | 7 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
| 8 #include "ash/common/wm/window_parenting_utils.h" | 8 #include "ash/common/wm/window_parenting_utils.h" |
| 9 #include "ash/common/wm/window_state.h" | 9 #include "ash/common/wm/window_state.h" |
| 10 #include "ash/common/wm/wm_event.h" | 10 #include "ash/common/wm/wm_event.h" |
| 11 #include "ash/common/wm/workspace/magnetism_matcher.h" | 11 #include "ash/common/wm/workspace/magnetism_matcher.h" |
| 12 #include "ash/common/wm_lookup.h" | 12 #include "ash/common/wm_lookup.h" |
| 13 #include "ash/common/wm_root_window_controller.h" | 13 #include "ash/common/wm_root_window_controller.h" |
| 14 #include "ash/common/wm_window.h" | 14 #include "ash/common/wm_window.h" |
| 15 #include "ash/common/wm_window_property.h" |
| 15 #include "ash/public/cpp/shell_window_ids.h" | 16 #include "ash/public/cpp/shell_window_ids.h" |
| 16 #include "ui/base/hit_test.h" | 17 #include "ui/base/hit_test.h" |
| 17 #include "ui/base/ui_base_types.h" | 18 #include "ui/base/ui_base_types.h" |
| 18 #include "ui/display/display.h" | 19 #include "ui/display/display.h" |
| 19 #include "ui/display/screen.h" | 20 #include "ui/display/screen.h" |
| 20 | 21 |
| 21 namespace ash { | 22 namespace ash { |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 DockedWindowLayoutManager* GetDockedLayoutManagerAtPoint( | 25 DockedWindowLayoutManager* GetDockedLayoutManagerAtPoint( |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 } | 200 } |
| 200 | 201 |
| 201 void DockedWindowResizer::FinishedDragging( | 202 void DockedWindowResizer::FinishedDragging( |
| 202 aura::client::WindowMoveResult move_result) { | 203 aura::client::WindowMoveResult move_result) { |
| 203 if (!did_move_or_resize_) | 204 if (!did_move_or_resize_) |
| 204 return; | 205 return; |
| 205 did_move_or_resize_ = false; | 206 did_move_or_resize_ = false; |
| 206 WmWindow* window = GetTarget(); | 207 WmWindow* window = GetTarget(); |
| 207 const bool is_attached_panel = | 208 const bool is_attached_panel = |
| 208 window->GetType() == ui::wm::WINDOW_TYPE_PANEL && | 209 window->GetType() == ui::wm::WINDOW_TYPE_PANEL && |
| 209 window_state_->panel_attached(); | 210 window->GetBoolProperty(WmWindowProperty::PANEL_ATTACHED); |
| 210 const bool is_resized = | 211 const bool is_resized = |
| 211 (details().bounds_change & WindowResizer::kBoundsChange_Resizes) != 0; | 212 (details().bounds_change & WindowResizer::kBoundsChange_Resizes) != 0; |
| 212 | 213 |
| 213 // Undock the window if it is not in the normal, docked or minimized state | 214 // Undock the window if it is not in the normal, docked or minimized state |
| 214 // type. This happens if a user snaps or maximizes a window using a | 215 // type. This happens if a user snaps or maximizes a window using a |
| 215 // keyboard shortcut while it is being dragged. | 216 // keyboard shortcut while it is being dragged. |
| 216 if (!window_state_->IsMinimized() && !window_state_->IsDocked() && | 217 if (!window_state_->IsMinimized() && !window_state_->IsDocked() && |
| 217 !window_state_->IsNormalStateType()) | 218 !window_state_->IsNormalStateType()) |
| 218 is_docked_ = false; | 219 is_docked_ = false; |
| 219 | 220 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 } else if (window->GetWindowState()->IsDocked() && | 317 } else if (window->GetWindowState()->IsDocked() && |
| 317 action == DOCKED_ACTION_UNDOCK) { | 318 action == DOCKED_ACTION_UNDOCK) { |
| 318 const wm::WMEvent event(wm::WM_EVENT_NORMAL); | 319 const wm::WMEvent event(wm::WM_EVENT_NORMAL); |
| 319 window_state_->OnWMEvent(&event); | 320 window_state_->OnWMEvent(&event); |
| 320 } | 321 } |
| 321 | 322 |
| 322 return action; | 323 return action; |
| 323 } | 324 } |
| 324 | 325 |
| 325 } // namespace ash | 326 } // namespace ash |
| OLD | NEW |