| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 ui::ScopedLayerAnimationSettings scoped_setter(layer->GetAnimator()); | 59 ui::ScopedLayerAnimationSettings scoped_setter(layer->GetAnimator()); |
| 60 layer->SetOpacity(opacity); | 60 layer->SetOpacity(opacity); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void DragWindowController::CreateDragWidget(const gfx::Rect& bounds) { | 63 void DragWindowController::CreateDragWidget(const gfx::Rect& bounds) { |
| 64 DCHECK(!drag_widget_); | 64 DCHECK(!drag_widget_); |
| 65 drag_widget_ = new views::Widget; | 65 drag_widget_ = new views::Widget; |
| 66 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 66 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
| 67 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 67 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| 68 params.parent = window_->parent(); | 68 params.parent = window_->parent(); |
| 69 params.can_activate = false; |
| 69 params.keep_on_top = true; | 70 params.keep_on_top = true; |
| 70 drag_widget_->set_focus_on_creation(false); | 71 drag_widget_->set_focus_on_creation(false); |
| 71 drag_widget_->Init(params); | 72 drag_widget_->Init(params); |
| 72 drag_widget_->SetVisibilityChangedAnimationsEnabled(false); | 73 drag_widget_->SetVisibilityChangedAnimationsEnabled(false); |
| 73 drag_widget_->GetNativeWindow()->SetName("DragWindow"); | 74 drag_widget_->GetNativeWindow()->SetName("DragWindow"); |
| 74 drag_widget_->GetNativeWindow()->set_id(kShellWindowId_PhantomWindow); | 75 drag_widget_->GetNativeWindow()->set_id(kShellWindowId_PhantomWindow); |
| 75 // Show shadow for the dragging window. | 76 // Show shadow for the dragging window. |
| 76 SetShadowType(drag_widget_->GetNativeWindow(), | 77 SetShadowType(drag_widget_->GetNativeWindow(), |
| 77 ::wm::SHADOW_TYPE_RECTANGULAR); | 78 ::wm::SHADOW_TYPE_RECTANGULAR); |
| 78 SetBoundsInternal(bounds); | 79 SetBoundsInternal(bounds); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // Place the layer at (0, 0) of the DragWindowController's window. | 112 // Place the layer at (0, 0) of the DragWindowController's window. |
| 112 gfx::Rect layer_bounds = layer_owner_->root()->bounds(); | 113 gfx::Rect layer_bounds = layer_owner_->root()->bounds(); |
| 113 layer_bounds.set_origin(gfx::Point(0, 0)); | 114 layer_bounds.set_origin(gfx::Point(0, 0)); |
| 114 layer_owner_->root()->SetBounds(layer_bounds); | 115 layer_owner_->root()->SetBounds(layer_bounds); |
| 115 layer_owner_->root()->SetVisible(false); | 116 layer_owner_->root()->SetVisible(false); |
| 116 // Detach it from the current container. | 117 // Detach it from the current container. |
| 117 layer_owner_->root()->parent()->Remove(layer_owner_->root()); | 118 layer_owner_->root()->parent()->Remove(layer_owner_->root()); |
| 118 } | 119 } |
| 119 | 120 |
| 120 } // namespace ash | 121 } // namespace ash |
| OLD | NEW |