| Index: services/ui/ws/current_drag_operation.h
|
| diff --git a/services/ui/ws/current_drag_operation.h b/services/ui/ws/current_drag_operation.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..87570cd160b695790e6dac2eab054c35128b12b7
|
| --- /dev/null
|
| +++ b/services/ui/ws/current_drag_operation.h
|
| @@ -0,0 +1,89 @@
|
| +// 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_WS_CURRENT_DRAG_OPERATION_H_
|
| +#define SERVICES_UI_WS_CURRENT_DRAG_OPERATION_H_
|
| +
|
| +#include <deque>
|
| +
|
| +#include "base/memory/weak_ptr.h"
|
| +#include "services/ui/common/types.h"
|
| +#include "services/ui/ws/ids.h"
|
| +#include "services/ui/ws/server_window_observer.h"
|
| +
|
| +namespace ui {
|
| +namespace ws {
|
| +
|
| +class CurrentDragOperationDelegate;
|
| +class WindowServer;
|
| +class WindowTree;
|
| +
|
| +// Represents all the data around the current ongoing drag operation.
|
| +//
|
| +// There should only be one instance of this class per userid
|
| +class CurrentDragOperation : public ServerWindowObserver {
|
| + public:
|
| + CurrentDragOperation(CurrentDragOperationDelegate* delegate,
|
| + uint32_t change_id,
|
| + WindowTree* source_window_tree,
|
| + ServerWindow* source_window,
|
| + mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data,
|
| + uint32_t drag_operations);
|
| + ~CurrentDragOperation() override;
|
| +
|
| + void DispatchLocatedEvent(const ui::LocatedEvent& event,
|
| + ServerWindow* current_target,
|
| + const ClientSpecificId& client_id);
|
| +
|
| + void MessageDragCompleted(bool success);
|
| +
|
| + private:
|
| + struct Operation;
|
| +
|
| + void DispatchFrontOfWindowQueue(ServerWindow* window,
|
| + std::deque<Operation>* queue);
|
| +
|
| + // Overridden from ServerWindowObserver:
|
| + void OnWindowDestroying(ServerWindow* window) override;
|
| +
|
| + // Callback methods.
|
| + void OnDragStatusCompleted(const WindowId& id, uint32_t bitmask);
|
| + void OnDragDropCompleted(const WindowId& id, uint32_t bitmask);
|
| +
|
| + // Our owner.
|
| + CurrentDragOperationDelegate* delegate_ = nullptr;
|
| +
|
| + uint32_t change_id_;
|
| +
|
| + uint32_t drag_operations_;
|
| +
|
| + bool waiting_for_final_drop_response_ = false;
|
| +
|
| + WindowTree* source_window_tree_ = nullptr;
|
| +
|
| + WindowServer* window_server_ = nullptr;
|
| +
|
| + // The window which started the drag and which acts as the ipc source.
|
| + ServerWindow* source_window_ = nullptr;
|
| +
|
| + ServerWindow* current_target_window_ = nullptr;
|
| +
|
| + // A list of the offered mime types.
|
| + mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data_;
|
| +
|
| + // Event queues for each window. If a vector is empty, there are no
|
| + // operations going on. If a vector has one operation, we're waiting on a
|
| + // response for that operation from the client. Every operation past the
|
| + // first is queued.
|
| + std::map<ServerWindow*, std::deque<Operation>> current_window_state_;
|
| +
|
| + base::WeakPtrFactory<CurrentDragOperation> weak_factory_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(CurrentDragOperation);
|
| +};
|
| +
|
| +} // namespace ws
|
| +} // namespace ui
|
| +
|
| +#endif // SERVICES_UI_WS_CURRENT_DRAG_OPERATION_H_
|
|
|