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 11 matching lines...) Expand all Loading... | |
| 22 #include "ash/wm/workspace/phantom_window_controller.h" | 22 #include "ash/wm/workspace/phantom_window_controller.h" |
| 23 #include "ash/wm/workspace/snap_sizer.h" | 23 #include "ash/wm/workspace/snap_sizer.h" |
| 24 #include "ui/aura/client/aura_constants.h" | 24 #include "ui/aura/client/aura_constants.h" |
| 25 #include "ui/aura/root_window.h" | 25 #include "ui/aura/root_window.h" |
| 26 #include "ui/aura/window.h" | 26 #include "ui/aura/window.h" |
| 27 #include "ui/aura/window_delegate.h" | 27 #include "ui/aura/window_delegate.h" |
| 28 #include "ui/base/hit_test.h" | 28 #include "ui/base/hit_test.h" |
| 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 #include "ui/views/widget/widget.h" | |
| 33 #include "ui/views/widget/widget_delegate.h" | |
| 32 | 34 |
| 33 namespace ash { | 35 namespace ash { |
| 34 | 36 |
| 35 scoped_ptr<WindowResizer> CreateWindowResizer(aura::Window* window, | 37 scoped_ptr<WindowResizer> CreateWindowResizer(aura::Window* window, |
| 36 const gfx::Point& point_in_parent, | 38 const gfx::Point& point_in_parent, |
| 37 int window_component) { | 39 int window_component) { |
| 38 DCHECK(window); | 40 DCHECK(window); |
| 39 if (window->parent() && | 41 if (window->parent() && |
| 40 window->parent()->id() == internal::kShellWindowId_WorkspaceContainer) { | 42 window->parent()->id() == internal::kShellWindowId_WorkspaceContainer) { |
| 41 // Allow dragging maximized windows if it's not tracked by workspace. This | 43 // Allow dragging maximized windows if it's not tracked by workspace. This |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 ClearRestoreBounds(window()); | 281 ClearRestoreBounds(window()); |
| 280 RestackWindows(); | 282 RestackWindows(); |
| 281 } | 283 } |
| 282 did_move_or_resize_ = true; | 284 did_move_or_resize_ = true; |
| 283 } | 285 } |
| 284 | 286 |
| 285 gfx::Point location_in_screen = location_in_parent; | 287 gfx::Point location_in_screen = location_in_parent; |
| 286 wm::ConvertPointToScreen(window()->parent(), &location_in_screen); | 288 wm::ConvertPointToScreen(window()->parent(), &location_in_screen); |
| 287 const bool in_original_root = | 289 const bool in_original_root = |
| 288 wm::GetRootWindowAt(location_in_screen) == window()->GetRootWindow(); | 290 wm::GetRootWindowAt(location_in_screen) == window()->GetRootWindow(); |
| 291 | |
| 292 bool resizeable = true; | |
| 293 views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window()); | |
|
sky
2012/11/12 03:56:08
If all windows were created by widgets, this chang
Mr4D (OOO till 08-26)
2012/11/12 18:25:01
Done.
| |
| 294 if (widget && widget->widget_delegate()) | |
| 295 resizeable = widget->widget_delegate()->CanResize(); | |
| 296 | |
| 289 // Hide a phantom window for snapping if the cursor is in another root window. | 297 // Hide a phantom window for snapping if the cursor is in another root window. |
| 290 if (in_original_root) { | 298 if (in_original_root && resizeable) { |
| 291 UpdateSnapPhantomWindow(location_in_parent, bounds); | 299 UpdateSnapPhantomWindow(location_in_parent, bounds); |
| 292 } else { | 300 } else { |
| 293 snap_type_ = SNAP_NONE; | 301 snap_type_ = SNAP_NONE; |
| 294 snap_phantom_window_controller_.reset(); | 302 snap_phantom_window_controller_.reset(); |
| 295 } | 303 } |
| 296 | 304 |
| 297 if (!attached_windows_.empty()) | 305 if (!attached_windows_.empty()) |
| 298 LayoutAttachedWindows(bounds); | 306 LayoutAttachedWindows(bounds); |
| 299 if (bounds != window()->bounds()) { | 307 if (bounds != window()->bounds()) { |
| 300 bool destroyed = false; | 308 bool destroyed = false; |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 833 gfx::Rect layer_bounds = layer_->bounds(); | 841 gfx::Rect layer_bounds = layer_->bounds(); |
| 834 layer_bounds.set_origin(gfx::Point(0, 0)); | 842 layer_bounds.set_origin(gfx::Point(0, 0)); |
| 835 layer_->SetBounds(layer_bounds); | 843 layer_->SetBounds(layer_bounds); |
| 836 layer_->SetVisible(false); | 844 layer_->SetVisible(false); |
| 837 // Detach it from the current container. | 845 // Detach it from the current container. |
| 838 layer_->parent()->Remove(layer_); | 846 layer_->parent()->Remove(layer_); |
| 839 } | 847 } |
| 840 | 848 |
| 841 } // namespace internal | 849 } // namespace internal |
| 842 } // namespace ash | 850 } // namespace ash |
| OLD | NEW |