зеркало из https://github.com/electron/electron.git
Send and receive the AtomViewHostMsg_UpdateDraggableRegions message.
This commit is contained in:
Родитель
40273cf37d
Коммит
4223867dbc
|
@ -298,6 +298,8 @@ bool NativeWindow::OnMessageReceived(const IPC::Message& message) {
|
||||||
IPC_BEGIN_MESSAGE_MAP(NativeWindow, message)
|
IPC_BEGIN_MESSAGE_MAP(NativeWindow, message)
|
||||||
IPC_MESSAGE_HANDLER(AtomViewHostMsg_Message, OnRendererMessage)
|
IPC_MESSAGE_HANDLER(AtomViewHostMsg_Message, OnRendererMessage)
|
||||||
IPC_MESSAGE_HANDLER(AtomViewHostMsg_Message_Sync, OnRendererMessageSync)
|
IPC_MESSAGE_HANDLER(AtomViewHostMsg_Message_Sync, OnRendererMessageSync)
|
||||||
|
IPC_MESSAGE_HANDLER(AtomViewHostMsg_UpdateDraggableRegions,
|
||||||
|
UpdateDraggableRegions)
|
||||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||||
IPC_END_MESSAGE_MAP()
|
IPC_END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ class Size;
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
class AtomJavaScriptDialogManager;
|
class AtomJavaScriptDialogManager;
|
||||||
|
struct DraggableRegion;
|
||||||
|
|
||||||
class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
||||||
public content::WebContentsObserver,
|
public content::WebContentsObserver,
|
||||||
|
@ -125,6 +126,10 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
||||||
void NotifyWindowClosed();
|
void NotifyWindowClosed();
|
||||||
void NotifyWindowBlur();
|
void NotifyWindowBlur();
|
||||||
|
|
||||||
|
// Called when the window needs to update its draggable region.
|
||||||
|
virtual void UpdateDraggableRegions(
|
||||||
|
const std::vector<DraggableRegion>& regions) = 0;
|
||||||
|
|
||||||
// Implementations of content::WebContentsDelegate.
|
// Implementations of content::WebContentsDelegate.
|
||||||
virtual void WebContentsCreated(content::WebContents* source_contents,
|
virtual void WebContentsCreated(content::WebContents* source_contents,
|
||||||
int64 source_frame_id,
|
int64 source_frame_id,
|
||||||
|
|
|
@ -57,6 +57,9 @@ class NativeWindowMac : public NativeWindow {
|
||||||
void NotifyWindowBlur() { NativeWindow::NotifyWindowBlur(); }
|
void NotifyWindowBlur() { NativeWindow::NotifyWindowBlur(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void UpdateDraggableRegions(
|
||||||
|
const std::vector<DraggableRegion>& regions) OVERRIDE;
|
||||||
|
|
||||||
// Implementations of content::WebContentsDelegate.
|
// Implementations of content::WebContentsDelegate.
|
||||||
virtual void HandleKeyboardEvent(
|
virtual void HandleKeyboardEvent(
|
||||||
content::WebContents*,
|
content::WebContents*,
|
||||||
|
|
|
@ -324,6 +324,10 @@ gfx::NativeWindow NativeWindowMac::GetNativeWindow() {
|
||||||
return window();
|
return window();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NativeWindowMac::UpdateDraggableRegions(
|
||||||
|
const std::vector<DraggableRegion>& regions) {
|
||||||
|
}
|
||||||
|
|
||||||
void NativeWindowMac::HandleKeyboardEvent(
|
void NativeWindowMac::HandleKeyboardEvent(
|
||||||
content::WebContents*,
|
content::WebContents*,
|
||||||
const content::NativeWebKeyboardEvent& event) {
|
const content::NativeWebKeyboardEvent& event) {
|
||||||
|
|
|
@ -221,6 +221,10 @@ gfx::NativeWindow NativeWindowWin::GetNativeWindow() {
|
||||||
return window_->GetNativeView();
|
return window_->GetNativeView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NativeWindowWin::UpdateDraggableRegions(
|
||||||
|
const std::vector<DraggableRegion>& regions) {
|
||||||
|
}
|
||||||
|
|
||||||
void NativeWindowWin::HandleKeyboardEvent(
|
void NativeWindowWin::HandleKeyboardEvent(
|
||||||
content::WebContents*,
|
content::WebContents*,
|
||||||
const content::NativeWebKeyboardEvent& event) {
|
const content::NativeWebKeyboardEvent& event) {
|
||||||
|
|
|
@ -61,6 +61,9 @@ class NativeWindowWin : public NativeWindow,
|
||||||
virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
|
virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void UpdateDraggableRegions(
|
||||||
|
const std::vector<DraggableRegion>& regions) OVERRIDE;
|
||||||
|
|
||||||
// Overridden from content::WebContentsDelegate:
|
// Overridden from content::WebContentsDelegate:
|
||||||
virtual void HandleKeyboardEvent(
|
virtual void HandleKeyboardEvent(
|
||||||
content::WebContents*,
|
content::WebContents*,
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#include "ipc/ipc_message_macros.h"
|
#include "ipc/ipc_message_macros.h"
|
||||||
#include "renderer/api/atom_renderer_bindings.h"
|
#include "renderer/api/atom_renderer_bindings.h"
|
||||||
#include "renderer/atom_renderer_client.h"
|
#include "renderer/atom_renderer_client.h"
|
||||||
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
|
||||||
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDraggableRegion.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
|
||||||
#include "v8/include/v8.h"
|
#include "v8/include/v8.h"
|
||||||
|
|
||||||
|
@ -76,6 +78,19 @@ void AtomRenderViewObserver::FrameWillClose(WebFrame* frame) {
|
||||||
vec.erase(std::remove(vec.begin(), vec.end(), frame), vec.end());
|
vec.erase(std::remove(vec.begin(), vec.end(), frame), vec.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AtomRenderViewObserver::DraggableRegionsChanged(WebKit::WebFrame* frame) {
|
||||||
|
WebKit::WebVector<WebKit::WebDraggableRegion> webregions =
|
||||||
|
frame->document().draggableRegions();
|
||||||
|
std::vector<DraggableRegion> regions;
|
||||||
|
for (size_t i = 0; i < webregions.size(); ++i) {
|
||||||
|
DraggableRegion region;
|
||||||
|
region.bounds = webregions[i].bounds;
|
||||||
|
region.draggable = webregions[i].draggable;
|
||||||
|
regions.push_back(region);
|
||||||
|
}
|
||||||
|
Send(new AtomViewHostMsg_UpdateDraggableRegions(routing_id(), regions));
|
||||||
|
}
|
||||||
|
|
||||||
bool AtomRenderViewObserver::OnMessageReceived(const IPC::Message& message) {
|
bool AtomRenderViewObserver::OnMessageReceived(const IPC::Message& message) {
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
IPC_BEGIN_MESSAGE_MAP(AtomRenderViewObserver, message)
|
IPC_BEGIN_MESSAGE_MAP(AtomRenderViewObserver, message)
|
||||||
|
|
|
@ -32,6 +32,7 @@ class AtomRenderViewObserver : content::RenderViewObserver {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// content::RenderViewObserver implementation.
|
// content::RenderViewObserver implementation.
|
||||||
|
virtual void DraggableRegionsChanged(WebKit::WebFrame* frame) OVERRIDE;
|
||||||
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
|
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
|
||||||
|
|
||||||
void OnBrowserMessage(const std::string& channel,
|
void OnBrowserMessage(const std::string& channel,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче