From: Cheng Zhao Date: Thu, 5 Sep 2013 11:46:12 +0000 (+0800) Subject: Add IPC messages and structs for passing draggable regions. X-Git-Tag: v0.4.5~4^2~11 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=40273cf37d24e1ebeaa8a17e26db7dcd1edd7169;p=electron.git Add IPC messages and structs for passing draggable regions. --- diff --git a/atom.gyp b/atom.gyp index 72174d8f..c08e57d8 100644 --- a/atom.gyp +++ b/atom.gyp @@ -139,6 +139,8 @@ 'common/api/atom_extensions.h', 'common/api/object_life_monitor.cc', 'common/api/object_life_monitor.h', + 'common/draggable_region.cc', + 'common/draggable_region.h', 'common/node_bindings.cc', 'common/node_bindings.h', 'common/node_bindings_mac.cc', diff --git a/common/api/api_messages.h b/common/api/api_messages.h index 48f6d0e2..ee031e64 100644 --- a/common/api/api_messages.h +++ b/common/api/api_messages.h @@ -7,6 +7,7 @@ #include #include "base/values.h" +#include "common/draggable_region.h" #include "content/public/common/common_param_traits.h" #include "ipc/ipc_message_macros.h" @@ -15,6 +16,11 @@ #define IPC_MESSAGE_START ShellMsgStart +IPC_STRUCT_TRAITS_BEGIN(atom::DraggableRegion) + IPC_STRUCT_TRAITS_MEMBER(draggable) + IPC_STRUCT_TRAITS_MEMBER(bounds) +IPC_STRUCT_TRAITS_END() + IPC_MESSAGE_ROUTED2(AtomViewHostMsg_Message, std::string /* channel */, ListValue /* arguments */) @@ -27,3 +33,7 @@ IPC_SYNC_MESSAGE_ROUTED2_1(AtomViewHostMsg_Message_Sync, IPC_MESSAGE_ROUTED2(AtomViewMsg_Message, std::string /* channel */, ListValue /* arguments */) + +// Sent by the renderer when the draggable regions are updated. +IPC_MESSAGE_ROUTED1(AtomViewHostMsg_UpdateDraggableRegions, + std::vector /* regions */) diff --git a/common/draggable_region.cc b/common/draggable_region.cc new file mode 100644 index 00000000..e408c9b4 --- /dev/null +++ b/common/draggable_region.cc @@ -0,0 +1,13 @@ +// Copyright (c) 2012 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. + +#include "common/draggable_region.h" + +namespace atom { + +DraggableRegion::DraggableRegion() + : draggable(false) { +} + +} // namespace atom diff --git a/common/draggable_region.h b/common/draggable_region.h new file mode 100644 index 00000000..6ec3d2d7 --- /dev/null +++ b/common/draggable_region.h @@ -0,0 +1,21 @@ +// Copyright (c) 2012 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 ATOM_COMMON_DRAGGABLE_REGION_H_ +#define ATOM_COMMON_DRAGGABLE_REGION_H_ + +#include "ui/gfx/rect.h" + +namespace atom { + +struct DraggableRegion { + bool draggable; + gfx::Rect bounds; + + DraggableRegion(); +}; + +} // namespace atom + +#endif // ATOM_COMMON_DRAGGABLE_REGION_H_