Chromium Code Reviews| Index: services/ui/public/cpp/window_drop_target.h |
| diff --git a/services/ui/public/cpp/window_drop_target.h b/services/ui/public/cpp/window_drop_target.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..30f8229a8fb261e18adbdff28dc3ecae78693859 |
| --- /dev/null |
| +++ b/services/ui/public/cpp/window_drop_target.h |
| @@ -0,0 +1,64 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef SERVICES_UI_PUBLIC_CPP_WINDOW_DROP_TARGET_H_ |
| +#define SERVICES_UI_PUBLIC_CPP_WINDOW_DROP_TARGET_H_ |
| + |
| +#include <map> |
| +#include <vector> |
| + |
| +#include "ui/gfx/geometry/point.h" |
| + |
| +namespace ui { |
| + |
| +// Interface that clients that want to opt-in to receiving drag drop events |
| +// pass to their ui::Window. This is the client side equivalent to the |
| +// messages defined in ui::mojom::WindowTreeClient. |
| +class WindowDropTarget { |
| + public: |
| + virtual ~WindowDropTarget() {} |
|
sky
2016/09/13 18:15:31
move to protected section?
|
| + |
| + // On the first time the pointer enters the associated ui::Window, we get a |
| + // start message with all the data that's part of the drag. (The source |
| + // ui::Window receives this immediately through the client library instead |
| + // of asynchronously.) |
| + virtual void OnDragStart( |
| + std::map<std::string, std::vector<uint8_t>> mime_data) = 0; |
| + |
| + // Each time the pointer enters the associated ui::Window, we receive an |
| + // enter event and return a bitmask of drop operations that can be performed |
| + // at this location, in terms of the ui::mojom::kDropEffect{None,Move, |
| + // Copy,Link} constants. |
| + virtual uint32_t OnDragEnter(uint32_t event_flags, |
| + const gfx::Point& position, |
| + uint32_t effect_bitmask) = 0; |
| + |
| + // Each time the pointer moves inside the associated ui::Window, we receive |
| + // an over event and return a bitmask of drop oeprations. |
| + virtual uint32_t OnDragOver(uint32_t event_flags, |
| + const gfx::Point& position, |
| + uint32_t effect_bitmask) = 0; |
| + |
| + // Each time the pointer leaves the associated ui::Window, we receive a |
| + // leave event. |
| + virtual void OnDragLeave() = 0; |
| + |
| + // If the user releases the pointer over the associated ui::Window, we |
| + // receive this drop event to actually try to perform the drop. Unlike the |
| + // other methods in this class which return a value, this return value is not |
| + // a bitmask and is the operation which was actually completed. Returning 0 |
| + // indicates that the drag failed and shouldn't be reported as a success. |
| + virtual uint32_t OnCompleteDrop(uint32_t event_flags, |
| + const gfx::Point& position, |
| + uint32_t effect_bitmask) = 0; |
| + |
| + // When a drag that entered the associated window finishes one way or |
| + // another, the target receives this message to clear the mime_data from the |
| + // start message, along with any other client specific caches. |
| + virtual void OnDragFinish() = 0; |
| +}; |
| + |
| +} // namespace ui |
| + |
| +#endif // SERVICES_UI_PUBLIC_CPP_WINDOW_DROP_TARGET_H_ |