| 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/drag_drop/drag_image_view.h" | 5 #include "ash/drag_drop/drag_image_view.h" |
| 6 | 6 |
| 7 #include "ash/wm/shadow_types.h" | |
| 8 #include "ui/aura/window.h" | 7 #include "ui/aura/window.h" |
| 8 #include "ui/views/corewm/shadow_types.h" |
| 9 #include "ui/views/widget/widget.h" | 9 #include "ui/views/widget/widget.h" |
| 10 | 10 |
| 11 namespace ash { | 11 namespace ash { |
| 12 namespace internal { | 12 namespace internal { |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 using views::Widget; | 15 using views::Widget; |
| 16 | 16 |
| 17 Widget* CreateDragWidget() { | 17 Widget* CreateDragWidget() { |
| 18 Widget* drag_widget = new Widget; | 18 Widget* drag_widget = new Widget; |
| 19 Widget::InitParams params; | 19 Widget::InitParams params; |
| 20 params.type = Widget::InitParams::TYPE_TOOLTIP; | 20 params.type = Widget::InitParams::TYPE_TOOLTIP; |
| 21 params.keep_on_top = true; | 21 params.keep_on_top = true; |
| 22 params.accept_events = false; | 22 params.accept_events = false; |
| 23 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 23 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 24 params.transparent = true; | 24 params.transparent = true; |
| 25 drag_widget->Init(params); | 25 drag_widget->Init(params); |
| 26 drag_widget->SetOpacity(0xFF); | 26 drag_widget->SetOpacity(0xFF); |
| 27 drag_widget->GetNativeWindow()->set_owned_by_parent(false); | 27 drag_widget->GetNativeWindow()->set_owned_by_parent(false); |
| 28 SetShadowType(drag_widget->GetNativeView(), SHADOW_TYPE_NONE); | 28 SetShadowType(drag_widget->GetNativeView(), views::corewm::SHADOW_TYPE_NONE); |
| 29 return drag_widget; | 29 return drag_widget; |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 | 32 |
| 33 DragImageView::DragImageView() : views::ImageView() { | 33 DragImageView::DragImageView() : views::ImageView() { |
| 34 widget_.reset(CreateDragWidget()); | 34 widget_.reset(CreateDragWidget()); |
| 35 widget_->SetContentsView(this); | 35 widget_->SetContentsView(this); |
| 36 widget_->SetAlwaysOnTop(true); | 36 widget_->SetAlwaysOnTop(true); |
| 37 | 37 |
| 38 // We are owned by the DragDropController. | 38 // We are owned by the DragDropController. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 55 if (visible != widget_->IsVisible()) { | 55 if (visible != widget_->IsVisible()) { |
| 56 if (visible) | 56 if (visible) |
| 57 widget_->Show(); | 57 widget_->Show(); |
| 58 else | 58 else |
| 59 widget_->Hide(); | 59 widget_->Hide(); |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 } // namespace internal | 63 } // namespace internal |
| 64 } // namespace ash | 64 } // namespace ash |
| OLD | NEW |