Hacking Chromium for drag-out!


#1

Hey all! First post here. I created an issue on libchromiumcontent that may be interesting to some, and I would greatly appreciate any advice. Sorry for the double posting, but would love to have a few smart eyes on it. If posting this here is against any rules, feel free to reprimand =)

The gist of it: we previously hacked at Chromium to support drag-to-desktop functionality, and would love to switch to Electron, but Chromium code has shuffled around.

Thanks!


#2

For some reason, it wouldn’t let me post the full link in my original post: https://github.com/atom/libchromiumcontent/issues/140


#3

It is spam protection for new users. I fixed it for you :grinning:


#4

Hi Dan,
I notice you closed that issue.

Did you solve to drag an image outside Electron?

Thanks.


#5

I was able to port our node webkit hacks into the newer chromium source, so yup!


#6

Is it ok to share some more informations. I’d like to do the same. Thank you very much.


#7

We actually posted something online somewhere, but I am having trouble tracking it down. I’ll try and find something soon to share.

The gist of it was hooking into a few files where Chromium checks the dragData, and detecting a magic string provided from javascript.


#8

hey quicksnap,
sounds interesting. And i would love to get some more information…? :slightly_smiling:

The best way to handle the drag out that I figured out, is the drag event downloadURL.
Its not that bad. But works only nice for images and pdf.
If I drag-out other files in an application to open that directly, It doesn’t work…
but I need that! :frowning:

I think that is the way how the awesome nylas n1 mailclient deals with that:
https://github.com/nylas/N1/blob/master/internal_packages/attachments/lib/attachment-component.cjsx#L67

But thats not a full solution for me.


#9

For all interested, this is our patch against libchromiumcontent which enables dragging out native files via the ‘dragStart’ event: https://gist.github.com/quicksnap/c30f2219a8e36bd81fe2

Edit: Wrong link posted


#10

Awesome! :slight_smile:
But can you give some information about how to apply that?

Or i’m on the wrong way?

Thanks!


#11