Add MessageHandlerDelegate

This commit is contained in:
Cheng Zhao 2015-08-06 10:15:27 +08:00
parent f740684f41
commit d175a68586
7 changed files with 66 additions and 10 deletions

View file

@ -12,10 +12,12 @@
namespace atom {
AtomDesktopWindowTreeHostWin::AtomDesktopWindowTreeHostWin(
MessageHandlerDelegate* delegate,
views::internal::NativeWidgetDelegate* native_widget_delegate,
views::DesktopNativeWidgetAura* desktop_native_widget_aura)
: views::DesktopWindowTreeHostWin(native_widget_delegate,
desktop_native_widget_aura) {
desktop_native_widget_aura),
delegate_(delegate) {
}
AtomDesktopWindowTreeHostWin::~AtomDesktopWindowTreeHostWin() {

View file

@ -16,25 +16,30 @@
namespace atom {
class MessageHandlerDelegate;
class AtomDesktopWindowTreeHostWin : public views::DesktopWindowTreeHostWin {
public:
AtomDesktopWindowTreeHostWin(
MessageHandlerDelegate* delegate,
views::internal::NativeWidgetDelegate* native_widget_delegate,
views::DesktopNativeWidgetAura* desktop_native_widget_aura);
~AtomDesktopWindowTreeHostWin();
~AtomDesktopWindowTreeHostWin() override;
bool SetThumbarButtons(
HWND window,
const std::vector<NativeWindow::ThumbarButton>& buttons);
protected:
bool PreHandleMSG(UINT message,
WPARAM w_param,
LPARAM l_param,
LRESULT* result) override;
bool PreHandleMSG(
UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) override;
private:
MessageHandlerDelegate* delegate_; // weak ref
scoped_ptr<ThumbarHost> thumbar_host_;
DISALLOW_COPY_AND_ASSIGN(AtomDesktopWindowTreeHostWin);
};
} // namespace atom

View file

@ -0,0 +1,14 @@
// Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/browser/ui/win/message_handler_delegate.h"
namespace atom {
bool MessageHandlerDelegate::PreHandleMSG(
UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) {
return false;
}
} // namespace atom

View file

@ -0,0 +1,26 @@
// Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_UI_WIN_MESSAGE_HANDLER_DELEGATE_H_
#define ATOM_BROWSER_UI_WIN_MESSAGE_HANDLER_DELEGATE_H_
#include <windows.h>
namespace atom {
class MessageHandlerDelegate {
public:
// Catch-all message handling and filtering. Called before
// HWNDMessageHandler's built-in handling, which may pre-empt some
// expectations in Views/Aura if messages are consumed. Returns true if the
// message was consumed by the delegate and should not be processed further
// by the HWNDMessageHandler. In this case, |result| is returned. |result| is
// not modified otherwise.
virtual bool PreHandleMSG(
UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result);
};
} // namespace atom
#endif // ATOM_BROWSER_UI_WIN_MESSAGE_HANDLER_DELEGATE_H_