#include "extensions/browser/api/system_display/system_display_api.h"
#include <map>
#include <memory>
#include <set>
#include <string>
#include "base/functional/bind.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "extensions/browser/api/system_display/display_info_provider.h"
#include "extensions/common/mojom/context_type.mojom.h"
#include "extensions/common/permissions/permissions_data.h"
#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS)
#include "extensions/common/manifest_handlers/kiosk_mode_info.h"
#endif
namespace extensions {
display;
const char SystemDisplayFunction::kApiNotAvailableError[] = …;
const char SystemDisplayCrOSRestrictedFunction::kCrosOnlyError[] = …;
const char SystemDisplayCrOSRestrictedFunction::kKioskOnlyError[] = …;
namespace {
class OverscanTracker;
class OverscanTracker { … };
class OverscanTracker::OverscanWebObserver
: public content::WebContentsObserver { … };
static OverscanTracker* g_overscan_tracker = …;
void OverscanTracker::AddDisplay(content::WebContents* web_contents,
const std::string& id) { … }
void OverscanTracker::RemoveDisplay(content::WebContents* web_contents,
const std::string& id) { … }
void OverscanTracker::RemoveObserver(content::WebContents* web_contents) { … }
OverscanTracker::OverscanWebObserver* OverscanTracker::GetObserver(
content::WebContents* web_contents,
bool create) { … }
bool OverscanTracker::RemoveObserverImpl(content::WebContents* web_contents) { … }
bool HasAutotestPrivate(const ExtensionFunction& function) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS)
bool ShouldRestrictEdidInformation(const ExtensionFunction& function) {
if (function.extension()) {
return !(HasAutotestPrivate(function) ||
KioskModeInfo::IsKioskEnabled(function.extension()));
}
return function.source_context_type() != mojom::ContextType::kWebUi;
}
#endif
}
bool SystemDisplayFunction::PreRunValidation(std::string* error) { … }
bool SystemDisplayCrOSRestrictedFunction::PreRunValidation(std::string* error) { … }
bool SystemDisplayCrOSRestrictedFunction::ShouldRestrictToKioskAndWebUI() { … }
ExtensionFunction::ResponseAction SystemDisplayGetInfoFunction::Run() { … }
void SystemDisplayGetInfoFunction::Response(
std::vector<api::system_display::DisplayUnitInfo> all_displays_info) { … }
ExtensionFunction::ResponseAction SystemDisplayGetDisplayLayoutFunction::Run() { … }
void SystemDisplayGetDisplayLayoutFunction::Response(
std::vector<api::system_display::DisplayLayout> display_layout) { … }
bool SystemDisplayGetDisplayLayoutFunction::ShouldRestrictToKioskAndWebUI() { … }
ExtensionFunction::ResponseAction
SystemDisplaySetDisplayPropertiesFunction::Run() { … }
void SystemDisplaySetDisplayPropertiesFunction::Response(
std::optional<std::string> error) { … }
ExtensionFunction::ResponseAction SystemDisplaySetDisplayLayoutFunction::Run() { … }
void SystemDisplaySetDisplayLayoutFunction::Response(
std::optional<std::string> error) { … }
ExtensionFunction::ResponseAction
SystemDisplayEnableUnifiedDesktopFunction::Run() { … }
ExtensionFunction::ResponseAction
SystemDisplayOverscanCalibrationStartFunction::Run() { … }
ExtensionFunction::ResponseAction
SystemDisplayOverscanCalibrationAdjustFunction::Run() { … }
ExtensionFunction::ResponseAction
SystemDisplayOverscanCalibrationResetFunction::Run() { … }
ExtensionFunction::ResponseAction
SystemDisplayOverscanCalibrationCompleteFunction::Run() { … }
ExtensionFunction::ResponseAction
SystemDisplayShowNativeTouchCalibrationFunction::Run() { … }
void SystemDisplayShowNativeTouchCalibrationFunction::OnCalibrationComplete(
std::optional<std::string> error) { … }
ExtensionFunction::ResponseAction
SystemDisplayStartCustomTouchCalibrationFunction::Run() { … }
ExtensionFunction::ResponseAction
SystemDisplayCompleteCustomTouchCalibrationFunction::Run() { … }
ExtensionFunction::ResponseAction
SystemDisplayClearTouchCalibrationFunction::Run() { … }
ExtensionFunction::ResponseAction SystemDisplaySetMirrorModeFunction::Run() { … }
void SystemDisplaySetMirrorModeFunction::Response(
std::optional<std::string> error) { … }
}