refactor: mojofy draggable regions (#18536)

This commit is contained in:
Jeremy Apthorp 2019-06-03 10:43:04 -07:00 committed by GitHub
parent 52c76d737a
commit 0b25176893
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 59 additions and 91 deletions

View file

@ -7,5 +7,6 @@ mojom("mojo") {
public_deps = [
"//mojo/public/mojom/base",
"//ui/gfx/geometry/mojo",
]
}

View file

@ -1,6 +1,7 @@
module atom.mojom;
import "mojo/public/mojom/base/values.mojom";
import "ui/gfx/geometry/mojo/geometry.mojom";
interface ElectronRenderer {
Message(
@ -13,6 +14,11 @@ interface ElectronRenderer {
TakeHeapSnapshot(handle file) => (bool success);
};
struct DraggableRegion {
bool draggable;
gfx.mojom.Rect bounds;
};
interface ElectronBrowser {
// Emits an event on |channel| from the ipcMain JavaScript object in the main
// process.
@ -50,4 +56,7 @@ interface ElectronBrowser {
MessageHost(
string channel,
mojo_base.mojom.ListValue arguments);
UpdateDraggableRegions(
array<DraggableRegion> regions);
};

View file

@ -4,7 +4,6 @@
// Multiply-included file, no traditional include guard.
#include "atom/common/draggable_region.h"
#include "base/strings/string16.h"
#include "base/values.h"
#include "content/public/common/common_param_traits.h"
@ -20,11 +19,6 @@
#define IPC_MESSAGE_START ElectronMsgStart
IPC_STRUCT_TRAITS_BEGIN(atom::DraggableRegion)
IPC_STRUCT_TRAITS_MEMBER(draggable)
IPC_STRUCT_TRAITS_MEMBER(bounds)
IPC_STRUCT_TRAITS_END()
IPC_MESSAGE_ROUTED3(AtomAutofillFrameHostMsg_ShowPopup,
gfx::RectF /* bounds */,
std::vector<base::string16> /* values */,
@ -35,10 +29,6 @@ IPC_MESSAGE_ROUTED0(AtomAutofillFrameHostMsg_HidePopup)
IPC_MESSAGE_ROUTED1(AtomAutofillFrameMsg_AcceptSuggestion,
base::string16 /* suggestion */)
// Sent by the renderer when the draggable regions are updated.
IPC_MESSAGE_ROUTED1(AtomFrameHostMsg_UpdateDraggableRegions,
std::vector<atom::DraggableRegion> /* regions */)
// Update renderer process preferences.
IPC_MESSAGE_CONTROL1(AtomMsg_UpdatePreferences, base::ListValue)