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

Unified Diff: ui/app_list/views/app_list_item_view.cc

Issue 17370003: [Win] App launcher drag/drop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/app_list/views/app_list_item_view.h ('k') | ui/app_list/views/app_list_main_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4baf3798ed1d16000d3bf1d52111353e69c4f012 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,14 @@ void AppListItemView::Prerender() {
title_->PaintToBackingImage();
}
+gfx::ImageSkia AppListItemView::GetDragImage() {
+ gfx::Canvas canvas(size(), ui::SCALE_FACTOR_100P, false /* is_opaque */);
+ gfx::Rect bounds(size());
+ canvas.DrawColor(SK_ColorTRANSPARENT);
+ PaintChildren(&canvas);
+ return gfx::ImageSkia(canvas.ExtractImageRep());
+}
+
void AppListItemView::ItemIconChanged() {
UpdateIcon();
}
@@ -342,15 +352,20 @@ void AppListItemView::OnMouseReleased(const ui::MouseEvent& event) {
}
void AppListItemView::OnMouseCaptureLost() {
+ // We don't cancel the dag on mouse capture lost for windows as entering a
+ // synchronous drag causes mouse capture to be lost and pressing escape
+ // dismisses the app list anyway.
+#if !defined(OS_WIN)
CustomButton::OnMouseCaptureLost();
apps_grid_view_->EndDrag(true);
mouse_drag_timer_.Stop();
SetUIState(UI_STATE_NORMAL);
+#endif
}
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 +387,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;
« no previous file with comments | « ui/app_list/views/app_list_item_view.h ('k') | ui/app_list/views/app_list_main_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698