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 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 #include "ui/compositor/layer.h" | 29 #include "ui/compositor/layer.h" |
| 30 #include "ui/gfx/screen.h" | 30 #include "ui/gfx/screen.h" |
| 31 #include "ui/gfx/transform.h" | 31 #include "ui/gfx/transform.h" |
| 32 | 32 |
| 33 namespace ash { | 33 namespace ash { |
| 34 | 34 |
| 35 scoped_ptr<WindowResizer> CreateWindowResizer(aura::Window* window, | 35 scoped_ptr<WindowResizer> CreateWindowResizer(aura::Window* window, |
| 36 const gfx::Point& point_in_parent, | 36 const gfx::Point& point_in_parent, |
| 37 int window_component) { | 37 int window_component) { |
| 38 DCHECK(window); | 38 DCHECK(window); |
| 39 // No need to return a resizer when the window cannot get resized. | |
| 40 if (!wm::CanResizeWindow(window)) | |
|
sky
2012/11/13 17:01:54
Doesn't returning null here mean you can't drag fr
Mr4D (OOO till 08-26)
2012/11/13 21:27:23
The suggestion to do this came from you ( :) ) - b
| |
| 41 return scoped_ptr<WindowResizer>(); | |
| 42 | |
| 39 if (window->parent() && | 43 if (window->parent() && |
| 40 window->parent()->id() == internal::kShellWindowId_WorkspaceContainer) { | 44 window->parent()->id() == internal::kShellWindowId_WorkspaceContainer) { |
| 41 // Allow dragging maximized windows if it's not tracked by workspace. This | 45 // Allow dragging maximized windows if it's not tracked by workspace. This |
| 42 // is set by tab dragging code. | 46 // is set by tab dragging code. |
| 43 if (!wm::IsWindowNormal(window) && | 47 if (!wm::IsWindowNormal(window) && |
| 44 (window_component != HTCAPTION || GetTrackedByWorkspace(window))) | 48 (window_component != HTCAPTION || GetTrackedByWorkspace(window))) |
| 45 return scoped_ptr<WindowResizer>(); | 49 return scoped_ptr<WindowResizer>(); |
| 46 return make_scoped_ptr<WindowResizer>( | 50 return make_scoped_ptr<WindowResizer>( |
| 47 internal::WorkspaceWindowResizer::Create(window, | 51 internal::WorkspaceWindowResizer::Create(window, |
| 48 point_in_parent, | 52 point_in_parent, |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 ClearRestoreBounds(window()); | 283 ClearRestoreBounds(window()); |
| 280 RestackWindows(); | 284 RestackWindows(); |
| 281 } | 285 } |
| 282 did_move_or_resize_ = true; | 286 did_move_or_resize_ = true; |
| 283 } | 287 } |
| 284 | 288 |
| 285 gfx::Point location_in_screen = location_in_parent; | 289 gfx::Point location_in_screen = location_in_parent; |
| 286 wm::ConvertPointToScreen(window()->parent(), &location_in_screen); | 290 wm::ConvertPointToScreen(window()->parent(), &location_in_screen); |
| 287 const bool in_original_root = | 291 const bool in_original_root = |
| 288 wm::GetRootWindowAt(location_in_screen) == window()->GetRootWindow(); | 292 wm::GetRootWindowAt(location_in_screen) == window()->GetRootWindow(); |
| 293 | |
| 289 // Hide a phantom window for snapping if the cursor is in another root window. | 294 // Hide a phantom window for snapping if the cursor is in another root window. |
| 290 if (in_original_root) { | 295 if (in_original_root && wm::CanResizeWindow(window())) { |
| 291 UpdateSnapPhantomWindow(location_in_parent, bounds); | 296 UpdateSnapPhantomWindow(location_in_parent, bounds); |
| 292 } else { | 297 } else { |
| 293 snap_type_ = SNAP_NONE; | 298 snap_type_ = SNAP_NONE; |
| 294 snap_phantom_window_controller_.reset(); | 299 snap_phantom_window_controller_.reset(); |
| 295 } | 300 } |
| 296 | 301 |
| 297 if (!attached_windows_.empty()) | 302 if (!attached_windows_.empty()) |
| 298 LayoutAttachedWindows(bounds); | 303 LayoutAttachedWindows(bounds); |
| 299 if (bounds != window()->bounds()) { | 304 if (bounds != window()->bounds()) { |
| 300 bool destroyed = false; | 305 bool destroyed = false; |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 833 gfx::Rect layer_bounds = layer_->bounds(); | 838 gfx::Rect layer_bounds = layer_->bounds(); |
| 834 layer_bounds.set_origin(gfx::Point(0, 0)); | 839 layer_bounds.set_origin(gfx::Point(0, 0)); |
| 835 layer_->SetBounds(layer_bounds); | 840 layer_->SetBounds(layer_bounds); |
| 836 layer_->SetVisible(false); | 841 layer_->SetVisible(false); |
| 837 // Detach it from the current container. | 842 // Detach it from the current container. |
| 838 layer_->parent()->Remove(layer_); | 843 layer_->parent()->Remove(layer_); |
| 839 } | 844 } |
| 840 | 845 |
| 841 } // namespace internal | 846 } // namespace internal |
| 842 } // namespace ash | 847 } // namespace ash |
| OLD | NEW |