Chromium Code Reviews| 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/workspace/workspace_window_resizer.h" | 5 #include "ash/wm/workspace/workspace_window_resizer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "ash/display/display_controller.h" | 10 #include "ash/display/display_controller.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 if (destroyed_) | 87 if (destroyed_) |
| 88 *destroyed_ = true; | 88 *destroyed_ = true; |
| 89 } | 89 } |
| 90 | 90 |
| 91 // static | 91 // static |
| 92 WorkspaceWindowResizer* WorkspaceWindowResizer::Create( | 92 WorkspaceWindowResizer* WorkspaceWindowResizer::Create( |
| 93 aura::Window* window, | 93 aura::Window* window, |
| 94 const gfx::Point& location_in_parent, | 94 const gfx::Point& location_in_parent, |
| 95 int window_component, | 95 int window_component, |
| 96 const std::vector<aura::Window*>& attached_windows) { | 96 const std::vector<aura::Window*>& attached_windows) { |
| 97 if (wm::IsWindowNormal(window) && window_component == HTCAPTION) { | |
| 98 // When a restore bounds is stored for the window, it gets restored to its | |
| 99 // original size. | |
| 100 const gfx::Rect *restore = GetRestoreBoundsInScreen(window); | |
| 101 if (restore) { | |
| 102 gfx::Rect bounds = gfx::Rect(window->bounds().origin(), restore->size()); | |
| 103 window->SetBounds(bounds); | |
|
sky
2012/09/05 17:03:24
This is the wrong place for this. Doing it here me
Mr4D (OOO till 08-26)
2012/09/06 16:06:54
Done.
| |
| 104 ClearRestoreBounds(window); | |
| 105 } | |
| 106 } | |
| 97 Details details(window, location_in_parent, window_component); | 107 Details details(window, location_in_parent, window_component); |
| 98 return details.is_resizable ? | 108 return details.is_resizable ? |
| 99 new WorkspaceWindowResizer(details, attached_windows) : NULL; | 109 new WorkspaceWindowResizer(details, attached_windows) : NULL; |
| 100 } | 110 } |
| 101 | 111 |
| 102 void WorkspaceWindowResizer::Drag(const gfx::Point& location, int event_flags) { | 112 void WorkspaceWindowResizer::Drag(const gfx::Point& location, int event_flags) { |
| 103 std::pair<aura::RootWindow*, gfx::Point> actual_location = | 113 std::pair<aura::RootWindow*, gfx::Point> actual_location = |
| 104 wm::GetRootWindowRelativeToWindow(window()->parent(), location); | 114 wm::GetRootWindowRelativeToWindow(window()->parent(), location); |
| 105 aura::RootWindow* current_root = actual_location.first; | 115 aura::RootWindow* current_root = actual_location.first; |
| 106 gfx::Point location_in_parent = actual_location.second; | 116 gfx::Point location_in_parent = actual_location.second; |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 611 gfx::Rect layer_bounds = layer_->bounds(); | 621 gfx::Rect layer_bounds = layer_->bounds(); |
| 612 layer_bounds.set_origin(gfx::Point(0, 0)); | 622 layer_bounds.set_origin(gfx::Point(0, 0)); |
| 613 layer_->SetBounds(layer_bounds); | 623 layer_->SetBounds(layer_bounds); |
| 614 layer_->SetVisible(false); | 624 layer_->SetVisible(false); |
| 615 // Detach it from the current container. | 625 // Detach it from the current container. |
| 616 layer_->parent()->Remove(layer_); | 626 layer_->parent()->Remove(layer_); |
| 617 } | 627 } |
| 618 | 628 |
| 619 } // namespace internal | 629 } // namespace internal |
| 620 } // namespace ash | 630 } // namespace ash |
| OLD | NEW |