capture_mode_type_view.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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_TYPE_VIEW_H_
  5. #define ASH_CAPTURE_MODE_CAPTURE_MODE_TYPE_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 CaptureBarView, from which the user can toggle
  13. // between the two available capture types (image, and video).
  14. class ASH_EXPORT CaptureModeTypeView : public views::View {
  15. public:
  16. METADATA_HEADER(CaptureModeTypeView);
  17. // |projector_mode| specifies whether the current capture mode session was
  18. // started for the projector workflow. In this mode, only video recording is
  19. // allowed.
  20. explicit CaptureModeTypeView(bool projector_mode);
  21. CaptureModeTypeView(const CaptureModeTypeView&) = delete;
  22. CaptureModeTypeView& operator=(const CaptureModeTypeView&) = delete;
  23. ~CaptureModeTypeView() override;
  24. CaptureModeToggleButton* image_toggle_button() const {
  25. return image_toggle_button_;
  26. }
  27. CaptureModeToggleButton* video_toggle_button() const {
  28. return video_toggle_button_;
  29. }
  30. // Called when the capture type changes.
  31. void OnCaptureTypeChanged(CaptureModeType new_type);
  32. private:
  33. void OnImageToggle();
  34. void OnVideoToggle();
  35. // Owned by the views hierarchy. Note that `image_toggle_button_` is
  36. // conditionally created based on the value of `projector_mode`, since it's
  37. // only possible to capture videos in the Projector-initiated sessions.
  38. CaptureModeToggleButton* image_toggle_button_;
  39. CaptureModeToggleButton* video_toggle_button_;
  40. };
  41. } // namespace ash
  42. #endif // ASH_CAPTURE_MODE_CAPTURE_MODE_TYPE_VIEW_H_