Remove OnMessageReceived from NativeWindow
This commit is contained in:
parent
44e7282b4b
commit
bffb31c337
8 changed files with 27 additions and 21 deletions
|
@ -10,6 +10,7 @@
|
|||
#include "atom/browser/browser.h"
|
||||
#include "atom/browser/native_window.h"
|
||||
#include "atom/browser/web_contents_preferences.h"
|
||||
#include "atom/common/api/api_messages.h"
|
||||
#include "atom/common/native_mate_converters/callback.h"
|
||||
#include "atom/common/native_mate_converters/file_path_converter.h"
|
||||
#include "atom/common/native_mate_converters/gfx_converter.h"
|
||||
|
@ -210,6 +211,17 @@ void BrowserWindow::DidFirstVisuallyNonEmptyPaint() {
|
|||
}, GetWeakPtr()));
|
||||
}
|
||||
|
||||
bool BrowserWindow::OnMessageReceived(const IPC::Message& message,
|
||||
content::RenderFrameHost* rfh) {
|
||||
bool handled = true;
|
||||
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(BrowserWindow, message, rfh)
|
||||
IPC_MESSAGE_HANDLER(AtomFrameHostMsg_UpdateDraggableRegions,
|
||||
UpdateDraggableRegions)
|
||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||
IPC_END_MESSAGE_MAP()
|
||||
return handled;
|
||||
}
|
||||
|
||||
void BrowserWindow::WillCloseWindow(bool* prevent_default) {
|
||||
*prevent_default = Emit("close");
|
||||
}
|
||||
|
@ -1039,6 +1051,12 @@ void BrowserWindow::RemoveFromParentChildWindows() {
|
|||
parent->child_windows_.Remove(ID());
|
||||
}
|
||||
|
||||
void BrowserWindow::UpdateDraggableRegions(
|
||||
content::RenderFrameHost* rfh,
|
||||
const std::vector<DraggableRegion>& regions) {
|
||||
window_->UpdateDraggableRegions(regions);
|
||||
}
|
||||
|
||||
// static
|
||||
void BrowserWindow::BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype) {
|
||||
|
|
|
@ -64,6 +64,8 @@ class BrowserWindow : public mate::TrackableObject<BrowserWindow>,
|
|||
// content::WebContentsObserver:
|
||||
void RenderViewCreated(content::RenderViewHost* render_view_host) override;
|
||||
void DidFirstVisuallyNonEmptyPaint() override;
|
||||
bool OnMessageReceived(const IPC::Message& message,
|
||||
content::RenderFrameHost* rfh) override;
|
||||
|
||||
// NativeWindowObserver:
|
||||
void WillCloseWindow(bool* prevent_default) override;
|
||||
|
@ -244,6 +246,11 @@ class BrowserWindow : public mate::TrackableObject<BrowserWindow>,
|
|||
// Remove this window from parent window's |child_windows_|.
|
||||
void RemoveFromParentChildWindows();
|
||||
|
||||
// Called when the window needs to update its draggable region.
|
||||
void UpdateDraggableRegions(
|
||||
content::RenderFrameHost* rfh,
|
||||
const std::vector<DraggableRegion>& regions);
|
||||
|
||||
#if defined(OS_WIN)
|
||||
typedef std::map<UINT, MessageCallback> MessageCallbackMap;
|
||||
MessageCallbackMap messages_callback_map_;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "atom/browser/browser.h"
|
||||
#include "atom/browser/unresponsive_suppressor.h"
|
||||
#include "atom/browser/window_list.h"
|
||||
#include "atom/common/api/api_messages.h"
|
||||
#include "atom/common/draggable_region.h"
|
||||
#include "atom/common/native_mate_converters/file_path_converter.h"
|
||||
#include "atom/common/options_switches.h"
|
||||
#include "base/files/file_util.h"
|
||||
|
@ -659,18 +659,6 @@ void NativeWindow::BeforeUnloadDialogCancelled() {
|
|||
window_unresposive_closure_.Cancel();
|
||||
}
|
||||
|
||||
bool NativeWindow::OnMessageReceived(const IPC::Message& message,
|
||||
content::RenderFrameHost* rfh) {
|
||||
bool handled = true;
|
||||
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(NativeWindow, message, rfh)
|
||||
IPC_MESSAGE_HANDLER(AtomFrameHostMsg_UpdateDraggableRegions,
|
||||
UpdateDraggableRegions)
|
||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||
IPC_END_MESSAGE_MAP()
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
void NativeWindow::ScheduleUnresponsiveEvent(int ms) {
|
||||
if (!window_unresposive_closure_.IsCancelled())
|
||||
return;
|
||||
|
|
|
@ -224,7 +224,6 @@ class NativeWindow : public base::SupportsUserData,
|
|||
|
||||
// Called when the window needs to update its draggable region.
|
||||
virtual void UpdateDraggableRegions(
|
||||
content::RenderFrameHost* rfh,
|
||||
const std::vector<DraggableRegion>& regions) = 0;
|
||||
|
||||
base::WeakPtr<NativeWindow> GetWeakPtr() {
|
||||
|
@ -318,8 +317,6 @@ class NativeWindow : public base::SupportsUserData,
|
|||
|
||||
// content::WebContentsObserver:
|
||||
void BeforeUnloadDialogCancelled() override;
|
||||
bool OnMessageReceived(const IPC::Message& message,
|
||||
content::RenderFrameHost* rfh) override;
|
||||
|
||||
private:
|
||||
// Schedule a notification unresponsive event.
|
||||
|
|
|
@ -122,7 +122,6 @@ class NativeWindowMac : public NativeWindow,
|
|||
gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds) const;
|
||||
gfx::Rect WindowBoundsToContentBounds(const gfx::Rect& bounds) const;
|
||||
void UpdateDraggableRegions(
|
||||
content::RenderFrameHost* rfh,
|
||||
const std::vector<DraggableRegion>& regions) override;
|
||||
|
||||
// content::RenderWidgetHost::InputEventObserver:
|
||||
|
|
|
@ -296,7 +296,7 @@ bool ScopedDisableResize::disable_resize_ = false;
|
|||
}
|
||||
|
||||
- (void)windowDidResize:(NSNotification*)notification {
|
||||
shell_->UpdateDraggableRegions(nullptr, shell_->draggable_regions());
|
||||
shell_->UpdateDraggableRegions(shell_->draggable_regions());
|
||||
shell_->NotifyWindowResize();
|
||||
}
|
||||
|
||||
|
@ -1816,7 +1816,6 @@ gfx::Rect NativeWindowMac::WindowBoundsToContentBounds(
|
|||
}
|
||||
|
||||
void NativeWindowMac::UpdateDraggableRegions(
|
||||
content::RenderFrameHost* rfh,
|
||||
const std::vector<DraggableRegion>& regions) {
|
||||
if (has_frame())
|
||||
return;
|
||||
|
|
|
@ -1122,7 +1122,6 @@ gfx::Rect NativeWindowViews::WindowBoundsToContentBounds(
|
|||
}
|
||||
|
||||
void NativeWindowViews::UpdateDraggableRegions(
|
||||
content::RenderFrameHost* rfh,
|
||||
const std::vector<DraggableRegion>& regions) {
|
||||
// Draggable region is not supported for non-frameless window.
|
||||
if (has_frame())
|
||||
|
|
|
@ -129,7 +129,6 @@ class NativeWindowViews : public NativeWindow,
|
|||
gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds) const override;
|
||||
gfx::Rect WindowBoundsToContentBounds(const gfx::Rect& bounds) const override;
|
||||
void UpdateDraggableRegions(
|
||||
content::RenderFrameHost* rfh,
|
||||
const std::vector<DraggableRegion>& regions) override;
|
||||
|
||||
#if defined(OS_WIN)
|
||||
|
|
Loading…
Reference in a new issue