15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// IPC messages for drag and drop.
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Multiply-included message file, hence no include guard.
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/common/drag_event_source_info.h"
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/common/common_param_traits.h"
10eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#include "content/public/common/drop_data.h"
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ipc/ipc_message_macros.h"
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "third_party/skia/include/core/SkBitmap.h"
137d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#include "third_party/WebKit/public/web/WebDragOperation.h"
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/gfx/point.h"
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/gfx/vector2d.h"
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define IPC_MESSAGE_START DragMsgStart
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Messages sent from the browser to the renderer.
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)IPC_MESSAGE_ROUTED5(DragMsg_TargetDragEnter,
22eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch                    content::DropData /* drop_data */,
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    gfx::Point /* client_pt */,
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    gfx::Point /* screen_pt */,
25f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                    blink::WebDragOperationsMask /* ops_allowed */,
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    int /* key_modifiers */)
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)IPC_MESSAGE_ROUTED4(DragMsg_TargetDragOver,
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    gfx::Point /* client_pt */,
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    gfx::Point /* screen_pt */,
31f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                    blink::WebDragOperationsMask /* ops_allowed */,
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    int /* key_modifiers */)
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)IPC_MESSAGE_ROUTED0(DragMsg_TargetDragLeave)
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)IPC_MESSAGE_ROUTED3(DragMsg_TargetDrop,
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    gfx::Point /* client_pt */,
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    gfx::Point /* screen_pt */,
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    int /* key_modifiers */)
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
41c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch// Notifies the renderer when and where the mouse-drag ended.
42c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen MurdochIPC_MESSAGE_ROUTED3(DragMsg_SourceEnded,
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    gfx::Point /* client_pt */,
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    gfx::Point /* screen_pt */,
45f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                    blink::WebDragOperation /* drag_operation */)
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Notifies the renderer that the system DoDragDrop call has ended.
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)IPC_MESSAGE_ROUTED0(DragMsg_SourceSystemDragEnded)
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Messages sent from the renderer to the browser.
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Used to tell the parent the user started dragging in the content area. The
53eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch// DropData struct contains contextual information about the pieces of the
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// page the user dragged. The parent uses this notification to initiate a
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// drag session at the OS level.
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)IPC_MESSAGE_ROUTED5(DragHostMsg_StartDragging,
57eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch                    content::DropData /* drop_data */,
58f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                    blink::WebDragOperationsMask /* ops_allowed */,
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    SkBitmap /* image */,
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    gfx::Vector2d /* image_offset */,
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    content::DragEventSourceInfo /* event_info */)
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The page wants to update the mouse cursor during a drag & drop operation.
645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// |is_drop_target| is true if the mouse is over a valid drop target.
655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)IPC_MESSAGE_ROUTED1(DragHostMsg_UpdateDragCursor,
66f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                    blink::WebDragOperation /* drag_operation */)
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Notifies the host that the renderer finished a drop operation.
695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)IPC_MESSAGE_ROUTED0(DragHostMsg_TargetDrop_ACK)
70