Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: ash/drag_drop/drag_image_view.cc

Issue 10855159: Support Drag and Drop across displays. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable DragDropTrackerTest on Win Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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" 7 #include "ash/wm/shadow_types.h"
8 #include "ui/aura/window.h"
8 #include "ui/views/widget/widget.h" 9 #include "ui/views/widget/widget.h"
9 10
10 namespace ash { 11 namespace ash {
11 namespace internal { 12 namespace internal {
12 13
13 namespace { 14 namespace {
14 using views::Widget; 15 using views::Widget;
15 16
16 Widget* CreateDragWidget() { 17 Widget* CreateDragWidget() {
17 Widget* drag_widget = new Widget; 18 Widget* drag_widget = new Widget;
18 Widget::InitParams params; 19 Widget::InitParams params;
19 params.type = Widget::InitParams::TYPE_TOOLTIP; 20 params.type = Widget::InitParams::TYPE_TOOLTIP;
20 params.keep_on_top = true; 21 params.keep_on_top = true;
21 params.accept_events = false; 22 params.accept_events = false;
22 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 23 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
23 params.transparent = true; 24 params.transparent = true;
24 drag_widget->Init(params); 25 drag_widget->Init(params);
25 drag_widget->SetOpacity(0xFF); 26 drag_widget->SetOpacity(0xFF);
27 drag_widget->GetNativeWindow()->set_owned_by_parent(false);
26 SetShadowType(drag_widget->GetNativeView(), SHADOW_TYPE_NONE); 28 SetShadowType(drag_widget->GetNativeView(), SHADOW_TYPE_NONE);
27 return drag_widget; 29 return drag_widget;
28 } 30 }
29 } 31 }
30 32
31 DragImageView::DragImageView() : views::ImageView() { 33 DragImageView::DragImageView() : views::ImageView() {
32 widget_.reset(CreateDragWidget()); 34 widget_.reset(CreateDragWidget());
33 widget_->SetContentsView(this); 35 widget_->SetContentsView(this);
34 widget_->SetAlwaysOnTop(true); 36 widget_->SetAlwaysOnTop(true);
35 37
(...skipping 17 matching lines...) Expand all
53 if (visible != widget_->IsVisible()) { 55 if (visible != widget_->IsVisible()) {
54 if (visible) 56 if (visible)
55 widget_->Show(); 57 widget_->Show();
56 else 58 else
57 widget_->Hide(); 59 widget_->Hide();
58 } 60 }
59 } 61 }
60 62
61 } // namespace internal 63 } // namespace internal
62 } // namespace ash 64 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698