#include "ash/capture_mode/capture_mode_behavior.h"
#include <memory>
#include "ash/capture_mode/capture_mode_metrics.h"
#include "ash/capture_mode/capture_mode_types.h"
namespace ash {
namespace {
class DefaultBehavior : public CaptureModeBehavior {
public:
DefaultBehavior()
: CaptureModeBehavior({CaptureModeType::kImage,
CaptureModeSource::kRegion, RecordingType::kWebM,
false,
false}) {}
DefaultBehavior(const DefaultBehavior&) = delete;
DefaultBehavior& operator=(const DefaultBehavior&) = delete;
~DefaultBehavior() override = default;
};
class ProjectorBehavior : public CaptureModeBehavior {
public:
ProjectorBehavior()
: CaptureModeBehavior({CaptureModeType::kVideo,
CaptureModeSource::kRegion, RecordingType::kWebM,
true,
true}) {}
ProjectorBehavior(const ProjectorBehavior&) = delete;
ProjectorBehavior& operator=(const ProjectorBehavior&) = delete;
~ProjectorBehavior() override = default;
bool ShouldImageCaptureTypeBeAllowed() const override { return false; }
bool ShouldSaveToSettingsBeIncluded() const override { return false; }
bool ShouldGifBeSupported() const override { return false; }
bool ShouldShowPreviewNotification() const override { return false; }
bool ShouldCreateRecordingOverlayController() const override { return true; }
bool ShouldShowUserNudge() const override { return false; }
bool ShouldAutoSelectFirstCamera() const override { return true; }
};
}
CaptureModeBehavior::CaptureModeBehavior(
const CaptureModeSessionConfigs& configs)
: capture_mode_configs_(configs) {}
std::unique_ptr<CaptureModeBehavior> CaptureModeBehavior::Create(
BehaviorType behavior_type) {
switch (behavior_type) {
case BehaviorType::kProjector:
return std::make_unique<ProjectorBehavior>();
case BehaviorType::kDefault:
return std::make_unique<DefaultBehavior>();
}
}
bool CaptureModeBehavior::ShouldImageCaptureTypeBeAllowed() const {
return true;
}
bool CaptureModeBehavior::ShouldVideoCaptureTypeBeAllowed() const {
return true;
}
bool CaptureModeBehavior::ShouldFulscreenCaptureSourceBeAllowed() const {
return true;
}
bool CaptureModeBehavior::ShouldRegionCaptureSourceBeAllowed() const {
return true;
}
bool CaptureModeBehavior::ShouldWindowCaptureSourceBeAllowed() const {
return true;
}
bool CaptureModeBehavior::ShouldAudioInputSettingsBeIncluded() const {
return true;
}
bool CaptureModeBehavior::ShouldCameraSelectionSettingsBeIncluded() const {
return true;
}
bool CaptureModeBehavior::ShouldDemoToolsSettingsBeIncluded() const {
return true;
}
bool CaptureModeBehavior::ShouldSaveToSettingsBeIncluded() const {
return true;
}
bool CaptureModeBehavior::ShouldGifBeSupported() const {
return true;
}
bool CaptureModeBehavior::ShouldShowPreviewNotification() const {
return true;
}
bool CaptureModeBehavior::ShouldSkipVideoRecordingCountDown() const {
return false;
}
bool CaptureModeBehavior::ShouldCreateRecordingOverlayController() const {
return false;
}
bool CaptureModeBehavior::ShouldShowUserNudge() const {
return true;
}
bool CaptureModeBehavior::ShouldAutoSelectFirstCamera() const {
return false;
}
}