| Index: ui/display/chromeos/virtual_display_delegate.h
|
| diff --git a/ui/display/chromeos/virtual_display_delegate.h b/ui/display/chromeos/virtual_display_delegate.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ae2de88d23aa2d0862ad00716f1ab3819f2f76c8
|
| --- /dev/null
|
| +++ b/ui/display/chromeos/virtual_display_delegate.h
|
| @@ -0,0 +1,102 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef UI_DISPLAY_CHROMEOS_VIRTUAL_DISPLAY_DELEGATE_H_
|
| +#define UI_DISPLAY_CHROMEOS_VIRTUAL_DISPLAY_DELEGATE_H_
|
| +
|
| +#include <memory>
|
| +#include <vector>
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/observer_list.h"
|
| +#include "ui/display/chromeos/display_snapshot_virtual.h"
|
| +#include "ui/display/display_export.h"
|
| +#include "ui/display/types/native_display_delegate.h"
|
| +#include "ui/display/types/virtual_display_controller.h"
|
| +
|
| +namespace display {
|
| +
|
| +// A NativeDisplayDelegate implementation that manages virtual displays. Each
|
| +// virtual display mimics a physical display that doesn't exist. Intended to be
|
| +// used when running off device and for unit testing of display configuration
|
| +// and display management code.
|
| +//
|
| +// The size and number of displays can controlled via --display-bounds=X
|
| +// command line flag with the format:
|
| +// HxW[,]
|
| +// H: display height in pixels
|
| +// W: display width in pixels
|
| +//
|
| +// For example --display=bounds=1920x1080,400x400 creates two displays, the
|
| +// first display 1920x1080 and the second 400x400. The specifier for each
|
| +// display is comma separated.
|
| +class DISPLAY_EXPORT VirtualDisplayDelegate : public ui::NativeDisplayDelegate,
|
| + public VirtualDisplayController {
|
| + public:
|
| + VirtualDisplayDelegate();
|
| + ~VirtualDisplayDelegate() override;
|
| +
|
| + // VirtualDisplayController:
|
| + int64_t AddVirtualDisplay(const gfx::Size& display_size) override;
|
| + bool RemoveVirtualDisplay(int64_t display_id) override;
|
| +
|
| + // NativeDisplayDelegate overrides:
|
| + void Initialize() override;
|
| + void GrabServer() override;
|
| + void UngrabServer() override;
|
| + void TakeDisplayControl(const ui::DisplayControlCallback& callback) override;
|
| + void RelinquishDisplayControl(
|
| + const ui::DisplayControlCallback& callback) override;
|
| + void SyncWithServer() override;
|
| + void SetBackgroundColor(uint32_t color_argb) override;
|
| + void ForceDPMSOn() override;
|
| + void GetDisplays(const ui::GetDisplaysCallback& callback) override;
|
| + void AddMode(const ui::DisplaySnapshot& output,
|
| + const ui::DisplayMode* mode) override;
|
| + void Configure(const ui::DisplaySnapshot& output,
|
| + const ui::DisplayMode* mode,
|
| + const gfx::Point& origin,
|
| + const ui::ConfigureCallback& callback) override;
|
| + void CreateFrameBuffer(const gfx::Size& size) override;
|
| + void GetHDCPState(const ui::DisplaySnapshot& output,
|
| + const ui::GetHDCPStateCallback& callback) override;
|
| + void SetHDCPState(const ui::DisplaySnapshot& output,
|
| + ui::HDCPState state,
|
| + const ui::SetHDCPStateCallback& callback) override;
|
| + std::vector<ui::ColorCalibrationProfile> GetAvailableColorCalibrationProfiles(
|
| + const ui::DisplaySnapshot& output) override;
|
| + bool SetColorCalibrationProfile(
|
| + const ui::DisplaySnapshot& output,
|
| + ui::ColorCalibrationProfile new_profile) override;
|
| + bool SetColorCorrection(const ui::DisplaySnapshot& output,
|
| + const std::vector<ui::GammaRampRGBEntry>& degamma_lut,
|
| + const std::vector<ui::GammaRampRGBEntry>& gamma_lut,
|
| + const std::vector<float>& correction_matrix) override;
|
| + void AddObserver(ui::NativeDisplayObserver* observer) override;
|
| + void RemoveObserver(ui::NativeDisplayObserver* observer) override;
|
| + VirtualDisplayController* GetVirtualDisplayController() override;
|
| +
|
| + protected:
|
| + // Initializes display snapshots from command line flags if provided.
|
| + void InitFromCommandLine();
|
| +
|
| + // Updates observers when display configuration has changed. Will not update
|
| + // until after |Initialize()| has been called.
|
| + void OnConfigurationChanged();
|
| +
|
| + private:
|
| + base::ObserverList<ui::NativeDisplayObserver> observers_;
|
| + std::vector<std::unique_ptr<ui::DisplaySnapshotVirtual>> displays_;
|
| +
|
| + // Initialize() has been called.
|
| + bool initialized_ = false;
|
| +
|
| + // The next available virtual display id.
|
| + uint8_t next_virtual_display_id_ = 0;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(VirtualDisplayDelegate);
|
| +};
|
| +
|
| +} // namespace display
|
| +#endif // UI_DISPLAY_CHROMEOS_VIRTUAL_DISPLAY_DELEGATE_H_
|
|
|