screen_switch_check_controller.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ASH_SYSTEM_SCREEN_SECURITY_SCREEN_SWITCH_CHECK_CONTROLLER_H_
  5. #define ASH_SYSTEM_SCREEN_SECURITY_SCREEN_SWITCH_CHECK_CONTROLLER_H_
  6. #include "ash/system/screen_security/screen_capture_observer.h"
  7. #include "ash/system/screen_security/screen_share_observer.h"
  8. namespace ash {
  9. // Controller of a dialog that confirms the user wants to stop screen share/cast
  10. // on user profile switching.
  11. class ScreenSwitchCheckController : public ScreenCaptureObserver,
  12. public ScreenShareObserver {
  13. public:
  14. ScreenSwitchCheckController();
  15. ScreenSwitchCheckController(const ScreenSwitchCheckController&) = delete;
  16. ScreenSwitchCheckController& operator=(const ScreenSwitchCheckController&) =
  17. delete;
  18. ~ScreenSwitchCheckController() override;
  19. // Determines if it's ok to switch away from the currently active user. Screen
  20. // casting may block this (or at least throw up a confirmation dialog). Calls
  21. // |callback| with the result.
  22. void CanSwitchAwayFromActiveUser(base::OnceCallback<void(bool)> callback);
  23. private:
  24. // ScreenCaptureObserver:
  25. void OnScreenCaptureStart(
  26. const base::RepeatingClosure& stop_callback,
  27. const base::RepeatingClosure& source_callback,
  28. const std::u16string& screen_capture_status) override;
  29. void OnScreenCaptureStop() override;
  30. // ScreenShareObserver:
  31. void OnScreenShareStart(const base::RepeatingClosure& stop_callback,
  32. const std::u16string& helper_name) override;
  33. void OnScreenShareStop() override;
  34. bool has_capture_ = false;
  35. bool has_share_ = false;
  36. };
  37. } // namespace ash
  38. #endif // ASH_SYSTEM_SCREEN_SECURITY_SCREEN_SWITCH_CHECK_CONTROLLER_H_