Index: ui/app_list/views/app_list_item_view.cc |
diff --git a/ui/app_list/views/app_list_item_view.cc b/ui/app_list/views/app_list_item_view.cc |
index fa2b1237bb143f3ac45a44f12a5386a3eb958e8c..37c632ec9f0e3dd3ecdc8f00f3c635b387146844 100644 |
--- a/ui/app_list/views/app_list_item_view.cc |
+++ b/ui/app_list/views/app_list_item_view.cc |
@@ -14,6 +14,7 @@ |
#include "ui/app_list/views/cached_label.h" |
#include "ui/base/accessibility/accessible_view_state.h" |
#include "ui/base/animation/throb_animation.h" |
+#include "ui/base/dragdrop/drag_utils.h" |
#include "ui/base/resource/resource_bundle.h" |
#include "ui/compositor/layer.h" |
#include "ui/compositor/scoped_layer_animation_settings.h" |
@@ -25,6 +26,7 @@ |
#include "ui/views/controls/label.h" |
#include "ui/views/controls/menu/menu_item_view.h" |
#include "ui/views/controls/menu/menu_runner.h" |
+#include "ui/views/drag_controller.h" |
namespace app_list { |
@@ -172,6 +174,17 @@ void AppListItemView::Prerender() { |
title_->PaintToBackingImage(); |
} |
+gfx::ImageSkia AppListItemView::GetDragImage() { |
+ gfx::Canvas canvas(size(), ui::SCALE_FACTOR_100P, false /* is_opaque */); |
+ gfx::Rect bounds(0, 0, size().width(), size().height()); |
xiyuan
2013/06/19 05:41:38
nit: gfx::Rect bounds(size);
koz (OOO until 15th September)
2013/06/19 07:55:08
Done.
|
+ LOG(ERROR) << bounds.ToString(); |
xiyuan
2013/06/19 05:41:38
Get rid of debugging log.
koz (OOO until 15th September)
2013/06/19 07:55:08
Done.
|
+ canvas.FillRect(bounds, SkColorSetARGB(0, 0, 0, 0), |
+ SkXfermode::kSrc_Mode); |
xiyuan
2013/06/19 05:41:38
nit: canvas.DrawColor(SK_ColorTRANSPARENT);
koz (OOO until 15th September)
2013/06/19 07:55:08
Done.
|
+ PaintChildren(&canvas); |
+ |
+ return gfx::ImageSkia(canvas.ExtractImageRep()); |
+} |
+ |
void AppListItemView::ItemIconChanged() { |
UpdateIcon(); |
} |
@@ -341,16 +354,9 @@ void AppListItemView::OnMouseReleased(const ui::MouseEvent& event) { |
SetUIState(UI_STATE_NORMAL); |
} |
-void AppListItemView::OnMouseCaptureLost() { |
xiyuan
2013/06/19 05:41:38
Why don't we need this?
koz (OOO until 15th September)
2013/06/19 07:55:08
Ah, we do on CROS, but it causes problems on Windo
|
- CustomButton::OnMouseCaptureLost(); |
- apps_grid_view_->EndDrag(true); |
- mouse_drag_timer_.Stop(); |
- SetUIState(UI_STATE_NORMAL); |
-} |
- |
bool AppListItemView::OnMouseDragged(const ui::MouseEvent& event) { |
CustomButton::OnMouseDragged(event); |
- apps_grid_view_->UpdateDrag(this, AppsGridView::MOUSE, event); |
+ apps_grid_view_->UpdateDragFromItem(AppsGridView::MOUSE, event); |
// Shows dragging UI when it's confirmed without waiting for the timer. |
if (ui_state_ != UI_STATE_DRAGGING && |
@@ -372,7 +378,7 @@ void AppListItemView::OnGestureEvent(ui::GestureEvent* event) { |
break; |
case ui::ET_GESTURE_SCROLL_UPDATE: |
if (touch_dragging_) { |
- apps_grid_view_->UpdateDrag(this, AppsGridView::TOUCH, *event); |
+ apps_grid_view_->UpdateDragFromItem(AppsGridView::TOUCH, *event); |
event->SetHandled(); |
} |
break; |