electron/shell/browser/native_window_observer.h

111 lines
3.7 KiB
C
Raw Normal View History

// Copyright (c) 2013 GitHub, Inc.
2014-04-25 09:49:37 +00:00
// Use of this source code is governed by the MIT license that can be
2013-04-18 12:50:58 +00:00
// found in the LICENSE file.
2019-06-19 20:56:58 +00:00
#ifndef SHELL_BROWSER_NATIVE_WINDOW_OBSERVER_H_
#define SHELL_BROWSER_NATIVE_WINDOW_OBSERVER_H_
2013-04-18 12:50:58 +00:00
#include <string>
2013-04-18 12:50:58 +00:00
#include "base/observer_list_types.h"
#include "base/strings/string16.h"
#include "base/values.h"
#include "ui/base/window_open_disposition.h"
#include "url/gurl.h"
2015-10-27 01:12:01 +00:00
#if defined(OS_WIN)
#include <windows.h>
#endif
namespace gfx {
class Rect;
}
namespace electron {
2013-04-18 12:50:58 +00:00
class NativeWindowObserver : public base::CheckedObserver {
2013-04-18 12:50:58 +00:00
public:
~NativeWindowObserver() override {}
2013-04-18 12:50:58 +00:00
// Called when the web page in window wants to create a popup window.
virtual void WillCreatePopupWindow(const base::string16& frame_name,
const GURL& target_url,
const std::string& partition_id,
WindowOpenDisposition disposition) {}
// Called when user is starting an navigation in web page.
virtual void WillNavigate(bool* prevent_default, const GURL& url) {}
// Called when the window is gonna closed.
virtual void WillCloseWindow(bool* prevent_default) {}
// Called when the window wants to know the preferred width.
virtual void RequestPreferredWidth(int* width) {}
// Called when closed button is clicked.
virtual void OnCloseButtonClicked(bool* prevent_default) {}
// Called when the window is closed.
virtual void OnWindowClosed() {}
// Called when Windows sends WM_ENDSESSION message
virtual void OnWindowEndSession() {}
// Called when window loses focus.
virtual void OnWindowBlur() {}
// Called when window gains focus.
virtual void OnWindowFocus() {}
2020-06-29 20:15:28 +00:00
// Called when window gained or lost key window status.
virtual void OnWindowIsKeyChanged(bool is_key) {}
// Called when window is shown.
virtual void OnWindowShow() {}
// Called when window is hidden.
virtual void OnWindowHide() {}
2014-11-25 04:43:25 +00:00
// Called when window state changed.
virtual void OnWindowMaximize() {}
virtual void OnWindowUnmaximize() {}
virtual void OnWindowMinimize() {}
virtual void OnWindowRestore() {}
virtual void OnWindowWillResize(const gfx::Rect& new_bounds,
bool* prevent_default) {}
2015-05-09 15:55:10 +00:00
virtual void OnWindowResize() {}
virtual void OnWindowResized() {}
virtual void OnWindowWillMove(const gfx::Rect& new_bounds,
bool* prevent_default) {}
2015-05-09 15:55:10 +00:00
virtual void OnWindowMove() {}
2015-05-20 08:37:13 +00:00
virtual void OnWindowMoved() {}
2016-01-22 00:31:09 +00:00
virtual void OnWindowScrollTouchBegin() {}
virtual void OnWindowScrollTouchEnd() {}
virtual void OnWindowSwipe(const std::string& direction) {}
virtual void OnWindowRotateGesture(float rotation) {}
virtual void OnWindowSheetBegin() {}
virtual void OnWindowSheetEnd() {}
2014-11-25 04:43:25 +00:00
virtual void OnWindowEnterFullScreen() {}
virtual void OnWindowLeaveFullScreen() {}
virtual void OnWindowEnterHtmlFullScreen() {}
virtual void OnWindowLeaveHtmlFullScreen() {}
virtual void OnWindowAlwaysOnTopChanged() {}
virtual void OnTouchBarItemResult(const std::string& item_id,
const base::DictionaryValue& details) {}
virtual void OnNewWindowForTab() {}
virtual void OnSystemContextMenu(int x, int y, bool* prevent_default) {}
2014-11-25 04:43:25 +00:00
2018-04-18 01:44:10 +00:00
// Called when window message received
#if defined(OS_WIN)
2015-10-29 02:53:48 +00:00
virtual void OnWindowMessage(UINT message, WPARAM w_param, LPARAM l_param) {}
2018-04-18 01:44:10 +00:00
#endif
2015-10-27 01:12:01 +00:00
// Called on Windows when App Commands arrive (WM_APPCOMMAND)
// Some commands are implemented on on other platforms as well
virtual void OnExecuteAppCommand(const std::string& command_name) {}
2013-04-18 12:50:58 +00:00
};
} // namespace electron
2013-04-18 12:50:58 +00:00
2019-06-19 20:56:58 +00:00
#endif // SHELL_BROWSER_NATIVE_WINDOW_OBSERVER_H_