Skip to content

Commit

Permalink
Revert "Delivers drag and drop methods from Surface to DataDevice."
Browse files Browse the repository at this point in the history
This reverts commit c59f626.

Reason for revert: Broke compilation on Linux ChromiumOS Builder (dbg)

../../components/exo/data_device_delegate.h:28: error: undefined reference to 'vtable for exo::DataDeviceDelegate'
../../third_party/binutils/Linux_x64/Release/bin/ld.gold: the vtable symbol may be undefined because the class is missing its key function
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Original change's description:
> Delivers drag and drop methods from Surface to DataDevice.
> 
> The CL lets Surface observe drag and drop events and delegates the events to
> DataDevice thorugh DataDeviceManager.
> 
> Bug: b:31988797
> Test: None
> Change-Id: I9574cd86137922d7527bd297d182a7b45e632c9e
> Reviewed-on: https://chromium-review.googlesource.com/579250
> Commit-Queue: Daichi Hirono <hirono@chromium.org>
> Reviewed-by: David Reveman <reveman@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#491951}

TBR=reveman@chromium.org,hirono@chromium.org,hidehiko@chromium.org

Change-Id: Ie770510e27a19b94f5e621ef41d24138c219104c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: b:31988797
Reviewed-on: https://chromium-review.googlesource.com/601989
Reviewed-by: Vasilii Sukhanov <vasilii@chromium.org>
Commit-Queue: Vasilii Sukhanov <vasilii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491984}
  • Loading branch information
Vasilii Sukhanov authored and Commit Bot committed Aug 4, 2017
1 parent bc34c90 commit 0fb3a38
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 58 deletions.
36 changes: 1 addition & 35 deletions components/exo/data_device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,13 @@

#include "base/logging.h"
#include "components/exo/data_device_delegate.h"
#include "components/exo/surface.h"
#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/base/dragdrop/drop_target_event.h"

namespace exo {

DataDevice::DataDevice(DataDeviceDelegate* delegate) : delegate_(delegate) {
WMHelper::GetInstance()->AddDragDropObserver(this);
}
DataDevice::DataDevice(DataDeviceDelegate* delegate) : delegate_(delegate) {}

DataDevice::~DataDevice() {
delegate_->OnDataDeviceDestroying(this);
WMHelper::GetInstance()->RemoveDragDropObserver(this);
}

void DataDevice::StartDrag(const DataSource* source_resource,
Expand All @@ -34,32 +28,4 @@ void DataDevice::SetSelection(const DataSource* source, uint32_t serial) {
NOTIMPLEMENTED();
}

void DataDevice::OnDragEntered(const ui::DropTargetEvent& event) {
NOTIMPLEMENTED();
}

int DataDevice::OnDragUpdated(const ui::DropTargetEvent& event) {
NOTIMPLEMENTED();
return ui::DragDropTypes::DRAG_NONE;
}

void DataDevice::OnDragExited() {
NOTIMPLEMENTED();
}

int DataDevice::OnPerformDrop(const ui::DropTargetEvent& event) {
NOTIMPLEMENTED();
return ui::DragDropTypes::DRAG_NONE;
}

Surface* DataDevice::GetEffectiveTargetForEvent(
const ui::DropTargetEvent& event) const {
Surface* target =
Surface::AsSurface(static_cast<aura::Window*>(event.target()));
if (!target)
return nullptr;

return delegate_->CanAcceptDataEventsForSurface(target) ? target : nullptr;
}

} // namespace exo
17 changes: 2 additions & 15 deletions components/exo/data_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
#include <cstdint>

#include "base/macros.h"
#include "components/exo/wm_helper.h"

namespace ui {
class DropTargetEvent;
}

namespace exo {

Expand All @@ -24,10 +19,10 @@ enum class DndAction { kNone, kCopy, kMove, kAsk };

// Data transfer device providing access to inter-client data transfer
// mechanisms such as copy-and-paste and drag-and-drop.
class DataDevice : public WMHelper::DragDropObserver {
class DataDevice {
public:
explicit DataDevice(DataDeviceDelegate* delegate);
~DataDevice() override;
~DataDevice();

// Starts drag-and-drop operation.
// |source| is data source for the eventual transfer or null if data passing
Expand All @@ -44,15 +39,7 @@ class DataDevice : public WMHelper::DragDropObserver {
// selection. |serial| is a unique number of event which tigers SetSelection.
void SetSelection(const DataSource* source, uint32_t serial);

// Overridden from WMHelper::DragDropObserver:
void OnDragEntered(const ui::DropTargetEvent& event) override;
int OnDragUpdated(const ui::DropTargetEvent& event) override;
void OnDragExited() override;
int OnPerformDrop(const ui::DropTargetEvent& event) override;

private:
Surface* GetEffectiveTargetForEvent(const ui::DropTargetEvent& event) const;

DataDeviceDelegate* const delegate_;

DISALLOW_COPY_AND_ASSIGN(DataDevice);
Expand Down
4 changes: 0 additions & 4 deletions components/exo/data_device_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ class DataDeviceDelegate {
// Called when the data is pasted on the DataDevice.
virtual void OnSelection(const DataOffer& data_offer) = 0;

// This should return true if |surface| is a valid target for this data
// device. E.g. the surface is owned by the same client as the data device.
virtual bool CanAcceptDataEventsForSurface(Surface* surface);

protected:
virtual ~DataDeviceDelegate() {}
};
Expand Down
4 changes: 0 additions & 4 deletions components/exo/wayland/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2843,10 +2843,6 @@ class WaylandDataDeviceDelegate : public DataDeviceDelegate {

// Overridden from DataDeviceDelegate:
void OnDataDeviceDestroying(DataDevice* device) override { delete this; }
bool CanAcceptDataEventsForSurface(Surface* surface) override {
return surface &&
wl_resource_get_client(GetSurfaceResource(surface)) == client_;
}
class DataOffer* OnDataOffer(const std::vector<std::string>& mime_types,
const base::flat_set<DndAction>& source_actions,
DndAction dnd_action) override {
Expand Down

0 comments on commit 0fb3a38

Please sign in to comment.