Group sheet event methods with other macOS methods

This commit is contained in:
Kevin Sawicki 2017-04-20 10:31:25 -07:00
parent 75184046f6
commit 29a3e11893
5 changed files with 24 additions and 37 deletions

View file

@ -263,6 +263,14 @@ void Window::OnWindowSwipe(const std::string& direction) {
Emit("swipe", direction);
}
void Window::OnWindowSheetBegin() {
Emit("sheet-begin");
}
void Window::OnWindowSheetEnd() {
Emit("sheet-end");
}
void Window::OnWindowEnterHtmlFullScreen() {
Emit("enter-html-full-screen");
}
@ -298,16 +306,6 @@ void Window::OnWindowMessage(UINT message, WPARAM w_param, LPARAM l_param) {
}
#endif
#if defined(OS_MACOSX)
void Window::OnWindowSheetBegin() {
Emit("sheet-begin");
}
void Window::OnWindowSheetEnd() {
Emit("sheet-end");
}
#endif
// static
mate::WrappableBase* Window::New(mate::Arguments* args) {
if (!Browser::Get()->is_ready()) {

View file

@ -79,6 +79,8 @@ class Window : public mate::TrackableObject<Window>,
void OnWindowScrollTouchEnd() override;
void OnWindowScrollTouchEdge() override;
void OnWindowSwipe(const std::string& direction) override;
void OnWindowSheetBegin() override;
void OnWindowSheetEnd() override;
void OnWindowEnterFullScreen() override;
void OnWindowLeaveFullScreen() override;
void OnWindowEnterHtmlFullScreen() override;
@ -93,11 +95,6 @@ class Window : public mate::TrackableObject<Window>,
void OnWindowMessage(UINT message, WPARAM w_param, LPARAM l_param) override;
#endif
#if defined(OS_MACOSX)
void OnWindowSheetBegin() override;
void OnWindowSheetEnd() override;
#endif
private:
void Init(v8::Isolate* isolate,
v8::Local<v8::Object> wrapper,

View file

@ -554,6 +554,16 @@ void NativeWindow::NotifyWindowSwipe(const std::string& direction) {
observer.OnWindowSwipe(direction);
}
void NativeWindow::NotifyWindowSheetBegin() {
for (NativeWindowObserver& observer : observers_)
observer.OnWindowSheetBegin();
}
void NativeWindow::NotifyWindowSheetEnd() {
for (NativeWindowObserver& observer : observers_)
observer.OnWindowSheetEnd();
}
void NativeWindow::NotifyWindowLeaveFullScreen() {
for (NativeWindowObserver& observer : observers_)
observer.OnWindowLeaveFullScreen();
@ -590,18 +600,6 @@ void NativeWindow::NotifyWindowMessage(
}
#endif
#if defined(OS_MACOSX)
void NativeWindow::NotifyWindowSheetBegin() {
for (NativeWindowObserver& observer : observers_)
observer.OnWindowSheetBegin();
}
void NativeWindow::NotifyWindowSheetEnd() {
for (NativeWindowObserver& observer : observers_)
observer.OnWindowSheetEnd();
}
#endif
std::unique_ptr<SkRegion> NativeWindow::DraggableRegionsToSkRegion(
const std::vector<DraggableRegion>& regions) {
std::unique_ptr<SkRegion> sk_region(new SkRegion);

View file

@ -233,6 +233,8 @@ class NativeWindow : public base::SupportsUserData,
void NotifyWindowScrollTouchEnd();
void NotifyWindowScrollTouchEdge();
void NotifyWindowSwipe(const std::string& direction);
void NotifyWindowSheetBegin();
void NotifyWindowSheetEnd();
void NotifyWindowEnterFullScreen();
void NotifyWindowLeaveFullScreen();
void NotifyWindowEnterHtmlFullScreen();
@ -245,11 +247,6 @@ class NativeWindow : public base::SupportsUserData,
void NotifyWindowMessage(UINT message, WPARAM w_param, LPARAM l_param);
#endif
#if defined(OS_MACOSX)
void NotifyWindowSheetBegin();
void NotifyWindowSheetEnd();
#endif
void AddObserver(NativeWindowObserver* obs) {
observers_.AddObserver(obs);
}

View file

@ -67,6 +67,8 @@ class NativeWindowObserver {
virtual void OnWindowScrollTouchEnd() {}
virtual void OnWindowScrollTouchEdge() {}
virtual void OnWindowSwipe(const std::string& direction) {}
virtual void OnWindowSheetBegin() {}
virtual void OnWindowSheetEnd() {}
virtual void OnWindowEnterFullScreen() {}
virtual void OnWindowLeaveFullScreen() {}
virtual void OnWindowEnterHtmlFullScreen() {}
@ -79,11 +81,6 @@ class NativeWindowObserver {
virtual void OnWindowMessage(UINT message, WPARAM w_param, LPARAM l_param) {}
#endif
#if defined(OS_MACOSX)
virtual void OnWindowSheetBegin() {}
virtual void OnWindowSheetEnd() {}
#endif
// Called when renderer is hung.
virtual void OnRendererUnresponsive() {}