browser_observer.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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_BROWSER_OBSERVER_H_
  5. #define ATOM_BROWSER_BROWSER_OBSERVER_H_
  6. #include <string>
  7. #include "build/build_config.h"
  8. namespace base {
  9. class DictionaryValue;
  10. }
  11. namespace atom {
  12. class LoginHandler;
  13. class BrowserObserver {
  14. public:
  15. // The browser is about to close all windows.
  16. virtual void OnBeforeQuit(bool* prevent_default) {}
  17. // The browser has closed all windows and will quit.
  18. virtual void OnWillQuit(bool* prevent_default) {}
  19. // The browser has closed all windows. If the browser is quiting, then this
  20. // method will not be called, instead it will call OnWillQuit.
  21. virtual void OnWindowAllClosed() {}
  22. // The browser is quitting.
  23. virtual void OnQuit() {}
  24. // The browser has opened a file by double clicking in Finder or dragging the
  25. // file to the Dock icon. (macOS only)
  26. virtual void OnOpenFile(bool* prevent_default,
  27. const std::string& file_path) {}
  28. // Browser is used to open a url.
  29. virtual void OnOpenURL(const std::string& url) {}
  30. // The browser is activated with visible/invisible windows (usually by
  31. // clicking on the dock icon).
  32. virtual void OnActivate(bool has_visible_windows) {}
  33. // The browser has finished loading.
  34. virtual void OnWillFinishLaunching() {}
  35. virtual void OnFinishLaunching(const base::DictionaryValue& launch_info) {}
  36. // The browser requests HTTP login.
  37. virtual void OnLogin(LoginHandler* login_handler,
  38. const base::DictionaryValue& request_details) {}
  39. // The browser's accessibility suppport has changed.
  40. virtual void OnAccessibilitySupportChanged() {}
  41. #if defined(OS_MACOSX)
  42. // The browser wants to resume a user activity via handoff. (macOS only)
  43. virtual void OnContinueUserActivity(
  44. bool* prevent_default,
  45. const std::string& type,
  46. const base::DictionaryValue& user_info) {}
  47. #endif
  48. protected:
  49. virtual ~BrowserObserver() {}
  50. };
  51. } // namespace atom
  52. #endif // ATOM_BROWSER_BROWSER_OBSERVER_H_