native_window_observer.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. // Copyright (c) 2013 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ATOM_BROWSER_NATIVE_WINDOW_OBSERVER_H_
  5. #define ATOM_BROWSER_NATIVE_WINDOW_OBSERVER_H_
  6. #include <string>
  7. #include "base/strings/string16.h"
  8. #include "base/values.h"
  9. #include "ui/base/window_open_disposition.h"
  10. #include "url/gurl.h"
  11. #if defined(OS_WIN)
  12. #include <windows.h>
  13. #endif
  14. namespace atom {
  15. class NativeWindowObserver {
  16. public:
  17. virtual ~NativeWindowObserver() {}
  18. // Called when the web page in window wants to create a popup window.
  19. virtual void WillCreatePopupWindow(const base::string16& frame_name,
  20. const GURL& target_url,
  21. const std::string& partition_id,
  22. WindowOpenDisposition disposition) {}
  23. // Called when user is starting an navigation in web page.
  24. virtual void WillNavigate(bool* prevent_default, const GURL& url) {}
  25. // Called when the window is gonna closed.
  26. virtual void WillCloseWindow(bool* prevent_default) {}
  27. // Called before the native window object is going to be destroyed.
  28. virtual void WillDestroyNativeObject() {}
  29. // Called when the window is closed.
  30. virtual void OnWindowClosed() {}
  31. // Called when Windows sends WM_ENDSESSION message
  32. virtual void OnWindowEndSession() {}
  33. // Called when window loses focus.
  34. virtual void OnWindowBlur() {}
  35. // Called when window gains focus.
  36. virtual void OnWindowFocus() {}
  37. // Called when window is shown.
  38. virtual void OnWindowShow() {}
  39. // Called when window is hidden.
  40. virtual void OnWindowHide() {}
  41. // Called when window is ready to show.
  42. virtual void OnReadyToShow() {}
  43. // Called when window state changed.
  44. virtual void OnWindowMaximize() {}
  45. virtual void OnWindowUnmaximize() {}
  46. virtual void OnWindowMinimize() {}
  47. virtual void OnWindowRestore() {}
  48. virtual void OnWindowResize() {}
  49. virtual void OnWindowMove() {}
  50. virtual void OnWindowMoved() {}
  51. virtual void OnWindowScrollTouchBegin() {}
  52. virtual void OnWindowScrollTouchEnd() {}
  53. virtual void OnWindowScrollTouchEdge() {}
  54. virtual void OnWindowSwipe(const std::string& direction) {}
  55. virtual void OnWindowSheetBegin() {}
  56. virtual void OnWindowSheetEnd() {}
  57. virtual void OnWindowEnterFullScreen() {}
  58. virtual void OnWindowLeaveFullScreen() {}
  59. virtual void OnWindowEnterHtmlFullScreen() {}
  60. virtual void OnWindowLeaveHtmlFullScreen() {}
  61. virtual void OnTouchBarItemResult(const std::string& item_id,
  62. const base::DictionaryValue& details) {}
  63. // Called when window message received
  64. #if defined(OS_WIN)
  65. virtual void OnWindowMessage(UINT message, WPARAM w_param, LPARAM l_param) {}
  66. #endif
  67. // Called when renderer is hung.
  68. virtual void OnRendererUnresponsive() {}
  69. // Called when renderer recovers.
  70. virtual void OnRendererResponsive() {}
  71. // Called on Windows when App Commands arrive (WM_APPCOMMAND)
  72. virtual void OnExecuteWindowsCommand(const std::string& command_name) {}
  73. };
  74. } // namespace atom
  75. #endif // ATOM_BROWSER_NATIVE_WINDOW_OBSERVER_H_