1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/capture_mode/null_capture_mode_session.h"
#include "base/notreached.h"
#include "ui/compositor/layer.h"
namespace ash {
NullCaptureModeSession::NullCaptureModeSession(
CaptureModeController* controller,
CaptureModeBehavior* active_behavior)
: BaseCaptureModeSession(controller, active_behavior, SessionType::kReal) {}
views::Widget* NullCaptureModeSession::GetCaptureModeBarWidget() {
// The null session will never have a bar widget, so this function should
// never be called.
NOTREACHED();
}
aura::Window* NullCaptureModeSession::GetSelectedWindow() const {
CHECK_LE(selected_window_tracker_.windows().size(), 1u);
return selected_window_tracker_.windows().size() == 1
? selected_window_tracker_.windows().front()
: nullptr;
}
void NullCaptureModeSession::SetPreSelectedWindow(
aura::Window* pre_selected_window) {
selected_window_tracker_.Add(pre_selected_window);
// A pre-selected window has just been set, which means the selfie camera (if
// one is selected) can now be shown, and its parenting should be updated such
// that it can be made a child of the pre-selected window.
MaybeUpdateSelfieCamInSessionVisibility();
}
void NullCaptureModeSession::OnCaptureSourceChanged(
CaptureModeSource new_source) {
// Currently, the null session only applies to game dashboard, which only
// records selected windows.
if (new_source != CaptureModeSource::kWindow) {
NOTREACHED();
}
}
void NullCaptureModeSession::OnCaptureTypeChanged(CaptureModeType new_type) {
MaybeUpdateSelfieCamInSessionVisibility();
}
void NullCaptureModeSession::OnRecordingTypeChanged() {}
void NullCaptureModeSession::OnAudioRecordingModeChanged() {
active_behavior_->OnAudioRecordingModeChanged();
}
void NullCaptureModeSession::OnDemoToolsSettingsChanged() {
active_behavior_->OnDemoToolsSettingsChanged();
}
void NullCaptureModeSession::OnWaitingForDlpConfirmationStarted() {}
void NullCaptureModeSession::OnWaitingForDlpConfirmationEnded(bool reshow_uis) {
}
void NullCaptureModeSession::ReportSessionHistograms() {
RecordCaptureModeConfiguration(
controller_->type(), controller_->source(), controller_->recording_type(),
controller_->GetEffectiveAudioRecordingMode(), active_behavior_);
}
void NullCaptureModeSession::StartCountDown(
base::OnceClosure countdown_finished_callback) {
// Skip the countdown as we are aiming to record immediately.
std::move(countdown_finished_callback).Run();
}
void NullCaptureModeSession::OnCaptureFolderMayHaveChanged() {
NOTREACHED();
}
void NullCaptureModeSession::OnDefaultCaptureFolderSelectionChanged() {
NOTREACHED();
}
bool NullCaptureModeSession::CalculateCameraPreviewTargetVisibility() const {
return true;
}
void NullCaptureModeSession::OnCameraPreviewDragStarted() {}
void NullCaptureModeSession::OnCameraPreviewDragEnded(
const gfx::Point& screen_location,
bool is_touch) {}
void NullCaptureModeSession::OnCameraPreviewBoundsOrVisibilityChanged(
bool capture_surface_became_too_small,
bool did_bounds_or_visibility_change) {}
void NullCaptureModeSession::OnCameraPreviewDestroyed() {}
void NullCaptureModeSession::MaybeDismissSunfishRegionNudgeForever() {}
void NullCaptureModeSession::MaybeChangeRoot(aura::Window* new_root,
bool root_window_will_shutdown) {
DCHECK(new_root->IsRootWindow());
current_root_ = new_root;
}
std::set<aura::Window*>
NullCaptureModeSession::GetWindowsToIgnoreFromWidgets() {
return std::set<aura::Window*>();
}
void NullCaptureModeSession::OnPerformCaptureForSearchStarting(
PerformCaptureType capture_type) {}
void NullCaptureModeSession::OnPerformCaptureForSearchEnded(
PerformCaptureType capture_type) {}
base::WeakPtr<BaseCaptureModeSession>
NullCaptureModeSession::GetImageSearchToken() {
return nullptr;
}
ActionButtonView* NullCaptureModeSession::AddActionButton(
views::Button::PressedCallback callback,
std::u16string text,
const gfx::VectorIcon* icon,
const ActionButtonRank rank,
ActionButtonViewID id) {
return nullptr;
}
void NullCaptureModeSession::AddSmartActionsButton() {}
void NullCaptureModeSession::MaybeShowScannerDisclaimer(
ScannerEntryPoint entry_point,
base::RepeatingClosure accept_callback,
base::RepeatingClosure decline_callback) {}
void NullCaptureModeSession::OnScannerActionsFetched(
ScannerSession::FetchActionsResponse actions_response) {}
void NullCaptureModeSession::ShowActionContainerError(
const std::u16string& error_message) {}
void NullCaptureModeSession::InitInternal() {
layer()->SetName("NullCaptureModeSession");
}
void NullCaptureModeSession::ShutdownInternal() {}
void NullCaptureModeSession::OnSearchResultsPanelCreated(
views::Widget* panel_widget) {}
bool NullCaptureModeSession::TakeFocusForSearchResultsPanel(bool reverse) {
return false;
}
void NullCaptureModeSession::ClearPseudoFocus() {}
void NullCaptureModeSession::SetA11yOverrideWindowToSearchResultsPanel() {}
} // namespace ash
|