summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-08 06:57:27 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-08 06:57:27 +0000
commit166d7ffb4093ead55406315b191f6f491833eeda (patch)
treee9dff4c0024ccb8b30bba129437dc41e623d701c /ash
parente9e27e4a6217ae193bd87c945fe79227cbc3eb49 (diff)
downloadchromium_src-166d7ffb4093ead55406315b191f6f491833eeda.zip
chromium_src-166d7ffb4093ead55406315b191f6f491833eeda.tar.gz
chromium_src-166d7ffb4093ead55406315b191f6f491833eeda.tar.bz2
Get drag and drop working on Win Ash.
BUG=154081 Review URL: https://codereview.chromium.org/11787005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175494 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/ash.gyp2
-rw-r--r--ash/drag_drop/drag_drop_controller.cc27
-rw-r--r--ash/drag_drop/drag_drop_controller_unittest.cc4
3 files changed, 11 insertions, 22 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp
index 7fe58b7..420fc37 100644
--- a/ash/ash.gyp
+++ b/ash/ash.gyp
@@ -623,8 +623,6 @@
}],
['OS=="win"', {
'sources/': [
- # TODO(win_ash): implement DragDropController::StartDragAndDrop
- ['exclude', 'drag_drop/drag_drop_controller_unittest.cc'],
# TODO(zork): fix this test to build on Windows. See: crosbug.com/26906
['exclude', 'focus_cycler_unittest.cc'],
# All tests for multiple displays: not supported on Windows Ash.
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc
index 77fbd79..30362e2 100644
--- a/ash/drag_drop/drag_drop_controller.cc
+++ b/ash/drag_drop/drag_drop_controller.cc
@@ -19,7 +19,7 @@
#include "ui/aura/window.h"
#include "ui/base/animation/linear_animation.h"
#include "ui/base/dragdrop/drag_drop_types.h"
-#include "ui/base/dragdrop/os_exchange_data_provider_aura.h"
+#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/base/events/event.h"
#include "ui/base/events/event_utils.h"
#include "ui/gfx/point.h"
@@ -112,22 +112,10 @@ int DragDropController::StartDragAndDrop(
if (IsDragDropInProgress())
return 0;
-#if defined(OS_WIN)
- // TODO(win_ash): need to figure out how this will work in Metro, since
- // OSExchangeDataProviderAura isn't used in Windows builds. Two alternatives:
- // 1) Use OSExchangeDataProviderAura in Ash and OSExchangeDataProviderWin
- // elsewhere. This will complicate creating an ui::OSExchangeData to pass
- // in more context.
- // 2) Add methods to get the image and offset in the base interface of these
- // implementations to get to this data here.
- NOTIMPLEMENTED();
- return 0;
-#else
- const ui::OSExchangeDataProviderAura& provider =
- static_cast<const ui::OSExchangeDataProviderAura&>(data.provider());
+ const ui::OSExchangeData::Provider* provider = &data.provider();
// We do not support touch drag/drop without a drag image.
if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH &&
- provider.drag_image().size().IsEmpty())
+ provider->GetDragImage().size().IsEmpty())
return 0;
current_drag_event_source_ = source;
@@ -162,11 +150,11 @@ int DragDropController::StartDragAndDrop(
gfx::Point start_location = root_location;
ash::wm::ConvertPointToScreen(root_window, &start_location);
drag_image_final_bounds_for_cancel_animation_ = gfx::Rect(
- start_location - provider.drag_image_offset(),
- provider.drag_image().size());
+ start_location - provider->GetDragImageOffset(),
+ provider->GetDragImage().size());
drag_image_.reset(new DragImageView);
- drag_image_->SetImage(provider.drag_image());
- drag_image_offset_ = provider.drag_image_offset();
+ drag_image_->SetImage(provider->GetDragImage());
+ drag_image_offset_ = provider->GetDragImageOffset();
gfx::Rect drag_image_bounds(start_location, drag_image_->GetPreferredSize());
drag_image_bounds = AdjustDragImageBoundsForScaleAndOffset(drag_image_bounds,
drag_image_vertical_offset, drag_image_scale, &drag_image_offset_);
@@ -197,7 +185,6 @@ int DragDropController::StartDragAndDrop(
drag_source_window_->RemoveObserver(this);
drag_source_window_ = NULL;
}
-#endif
return drag_operation_;
}
diff --git a/ash/drag_drop/drag_drop_controller_unittest.cc b/ash/drag_drop/drag_drop_controller_unittest.cc
index f52893a..a287ca8 100644
--- a/ash/drag_drop/drag_drop_controller_unittest.cc
+++ b/ash/drag_drop/drag_drop_controller_unittest.cc
@@ -233,8 +233,12 @@ class TestNativeWidgetAura : public views::NativeWidgetAura {
// TODO(sky): this is for debugging, remove when track down failure.
void SetCheckIfCaptureLost(views::Widget* widget, bool value) {
+ // On Windows, the DCHECK triggers when running on bot or locally through RDP,
+ // but not when logged in locally.
+#if !defined(OS_WIN)
static_cast<TestNativeWidgetAura*>(widget->native_widget())->
set_check_if_capture_lost(value);
+#endif
}
views::Widget* CreateNewWidget() {