capture_mode_source_view.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright 2020 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_CAPTURE_MODE_CAPTURE_MODE_SOURCE_VIEW_H_
  5. #define ASH_CAPTURE_MODE_CAPTURE_MODE_SOURCE_VIEW_H_
  6. #include "ash/ash_export.h"
  7. #include "ash/capture_mode/capture_mode_types.h"
  8. #include "ui/base/metadata/metadata_header_macros.h"
  9. #include "ui/views/view.h"
  10. namespace ash {
  11. class CaptureModeToggleButton;
  12. // A view that is part of the CaptureBar view, from which the user can toggle
  13. // between the three available capture sources (fullscreen, region, and window).
  14. // Only a single capture source can be active at any time.
  15. class ASH_EXPORT CaptureModeSourceView : public views::View {
  16. public:
  17. METADATA_HEADER(CaptureModeSourceView);
  18. CaptureModeSourceView();
  19. CaptureModeSourceView(const CaptureModeSourceView&) = delete;
  20. CaptureModeSourceView& operator=(const CaptureModeSourceView&) = delete;
  21. ~CaptureModeSourceView() override;
  22. CaptureModeToggleButton* fullscreen_toggle_button() const {
  23. return fullscreen_toggle_button_;
  24. }
  25. CaptureModeToggleButton* region_toggle_button() const {
  26. return region_toggle_button_;
  27. }
  28. CaptureModeToggleButton* window_toggle_button() const {
  29. return window_toggle_button_;
  30. }
  31. // Called when the capture source changes.
  32. void OnCaptureSourceChanged(CaptureModeSource new_source);
  33. // Called when the capture type changes to update tooltip texts.
  34. void OnCaptureTypeChanged(CaptureModeType type);
  35. private:
  36. void OnFullscreenToggle();
  37. void OnRegionToggle();
  38. void OnWindowToggle();
  39. // Owned by the views hierarchy.
  40. CaptureModeToggleButton* fullscreen_toggle_button_;
  41. CaptureModeToggleButton* region_toggle_button_;
  42. CaptureModeToggleButton* window_toggle_button_;
  43. };
  44. } // namespace ash
  45. #endif // ASH_CAPTURE_MODE_CAPTURE_MODE_SOURCE_VIEW_H_