Introduced the cursor-changed event with one parameter - the name of the cursor type

This commit is contained in:
Heilig Benedek 2016-01-30 06:33:55 +01:00
parent e22cb0ca9f
commit 0c9174bc7c
5 changed files with 194 additions and 0 deletions

View file

@ -56,9 +56,12 @@
#include "net/url_request/url_request_context.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "ui/base/l10n/l10n_util.h"
#include "mw/cursor/cursor_event_filter.h"
#include "atom/common/node_includes.h"
#include <iostream>
namespace {
struct PrintSettings {
@ -619,6 +622,8 @@ bool WebContents::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(AtomViewHostMsg_Message, OnRendererMessage)
IPC_MESSAGE_HANDLER_DELAY_REPLY(AtomViewHostMsg_Message_Sync,
OnRendererMessageSync)
IPC_MESSAGE_HANDLER_CODE(ViewHostMsg_SetCursor, OnCursorChange,
handled = false)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@ -1039,6 +1044,10 @@ void WebContents::EndFrameSubscription() {
view->EndFrameSubscription();
}
void WebContents::OnCursorChange(const content::WebCursor& cursor) {
Emit("cursor-changed", CursorChangeEvent::toString(cursor));
}
void WebContents::SetSize(const SetSizeParams& params) {
if (guest_delegate_)
guest_delegate_->SetSize(params);

View file

@ -14,6 +14,7 @@
#include "atom/browser/common_web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/favicon_url.h"
#include "content/common/cursors/webcursor.h"
#include "native_mate/handle.h"
#include "ui/gfx/image/image.h"
@ -255,6 +256,8 @@ class WebContents : public mate::TrackableObject<WebContents>,
return ++request_id_;
}
void OnCursorChange(const content::WebCursor& cursor);
// Called when received a message from renderer.
void OnRendererMessage(const base::string16& channel,
const base::ListValue& args);