| 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/drag_window_controller.h" | 5 #include "ash/wm/drag_window_controller.h" |
| 6 | 6 |
| 7 #include "ash/shell_window_ids.h" | 7 #include "ash/shell_window_ids.h" |
| 8 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
| 9 #include "ui/aura/client/screen_position_client.h" | 9 #include "ui/aura/client/screen_position_client.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 params.parent = window_->parent(); | 69 params.parent = window_->parent(); |
| 70 params.can_activate = false; | 70 params.can_activate = false; |
| 71 params.keep_on_top = true; | 71 params.keep_on_top = true; |
| 72 drag_widget_->set_focus_on_creation(false); | 72 drag_widget_->set_focus_on_creation(false); |
| 73 drag_widget_->Init(params); | 73 drag_widget_->Init(params); |
| 74 drag_widget_->SetVisibilityChangedAnimationsEnabled(false); | 74 drag_widget_->SetVisibilityChangedAnimationsEnabled(false); |
| 75 drag_widget_->GetNativeWindow()->SetName("DragWindow"); | 75 drag_widget_->GetNativeWindow()->SetName("DragWindow"); |
| 76 drag_widget_->GetNativeWindow()->set_id(kShellWindowId_PhantomWindow); | 76 drag_widget_->GetNativeWindow()->set_id(kShellWindowId_PhantomWindow); |
| 77 // Show shadow for the dragging window. | 77 // Show shadow for the dragging window. |
| 78 SetShadowType(drag_widget_->GetNativeWindow(), | 78 SetShadowType(drag_widget_->GetNativeWindow(), |
| 79 views::corewm::SHADOW_TYPE_RECTANGULAR); | 79 ::wm::SHADOW_TYPE_RECTANGULAR); |
| 80 SetBoundsInternal(bounds); | 80 SetBoundsInternal(bounds); |
| 81 drag_widget_->StackAbove(window_); | 81 drag_widget_->StackAbove(window_); |
| 82 | 82 |
| 83 RecreateWindowLayers(); | 83 RecreateWindowLayers(); |
| 84 aura::Window* window = drag_widget_->GetNativeWindow(); | 84 aura::Window* window = drag_widget_->GetNativeWindow(); |
| 85 layer_owner_->root()->SetVisible(true); | 85 layer_owner_->root()->SetVisible(true); |
| 86 window->layer()->Add(layer_owner_->root()); | 86 window->layer()->Add(layer_owner_->root()); |
| 87 window->layer()->StackAtTop(layer_owner_->root()); | 87 window->layer()->StackAtTop(layer_owner_->root()); |
| 88 | 88 |
| 89 // Show the widget after all the setups. | 89 // Show the widget after all the setups. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 101 aura::client::ScreenPositionClient* screen_position_client = | 101 aura::client::ScreenPositionClient* screen_position_client = |
| 102 aura::client::GetScreenPositionClient(window->GetRootWindow()); | 102 aura::client::GetScreenPositionClient(window->GetRootWindow()); |
| 103 if (screen_position_client && dst_display_.is_valid()) | 103 if (screen_position_client && dst_display_.is_valid()) |
| 104 screen_position_client->SetBounds(window, bounds, dst_display_); | 104 screen_position_client->SetBounds(window, bounds, dst_display_); |
| 105 else | 105 else |
| 106 drag_widget_->SetBounds(bounds); | 106 drag_widget_->SetBounds(bounds); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void DragWindowController::RecreateWindowLayers() { | 109 void DragWindowController::RecreateWindowLayers() { |
| 110 DCHECK(!layer_owner_.get()); | 110 DCHECK(!layer_owner_.get()); |
| 111 layer_owner_ = views::corewm::RecreateLayers(window_); | 111 layer_owner_ = ::wm::RecreateLayers(window_); |
| 112 layer_owner_->root()->set_delegate(window_->layer()->delegate()); | 112 layer_owner_->root()->set_delegate(window_->layer()->delegate()); |
| 113 // Place the layer at (0, 0) of the DragWindowController's window. | 113 // Place the layer at (0, 0) of the DragWindowController's window. |
| 114 gfx::Rect layer_bounds = layer_owner_->root()->bounds(); | 114 gfx::Rect layer_bounds = layer_owner_->root()->bounds(); |
| 115 layer_bounds.set_origin(gfx::Point(0, 0)); | 115 layer_bounds.set_origin(gfx::Point(0, 0)); |
| 116 layer_owner_->root()->SetBounds(layer_bounds); | 116 layer_owner_->root()->SetBounds(layer_bounds); |
| 117 layer_owner_->root()->SetVisible(false); | 117 layer_owner_->root()->SetVisible(false); |
| 118 // Detach it from the current container. | 118 // Detach it from the current container. |
| 119 layer_owner_->root()->parent()->Remove(layer_owner_->root()); | 119 layer_owner_->root()->parent()->Remove(layer_owner_->root()); |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace internal | 122 } // namespace internal |
| 123 } // namespace ash | 123 } // namespace ash |
| OLD | NEW |