]> khamidou — GitHub mirrors - electron.git/commitdiff
Add IPC messages and structs for passing draggable regions.
authorCheng Zhao <zcbenz@gmail.com>
Thu, 5 Sep 2013 11:46:12 +0000 (19:46 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 5 Sep 2013 11:46:12 +0000 (19:46 +0800)
atom.gyp
common/api/api_messages.h
common/draggable_region.cc [new file with mode: 0644]
common/draggable_region.h [new file with mode: 0644]

index 72174d8f8bcc3a1809eda13cdf59980a1f33ba80..c08e57d8806a5b90b131676426864d75ee2e6fec 100644 (file)
--- a/atom.gyp
+++ b/atom.gyp
       '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',
index 48f6d0e29707f8abd46afbb005ae652b858e35dc..ee031e6487e696f12f74bcc68aa2420d403effcc 100644 (file)
@@ -7,6 +7,7 @@
 #include <string>
 
 #include "base/values.h"
+#include "common/draggable_region.h"
 #include "content/public/common/common_param_traits.h"
 #include "ipc/ipc_message_macros.h"
 
 
 #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<atom::DraggableRegion> /* regions */)
diff --git a/common/draggable_region.cc b/common/draggable_region.cc
new file mode 100644 (file)
index 0000000..e408c9b
--- /dev/null
@@ -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 (file)
index 0000000..6ec3d2d
--- /dev/null
@@ -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_