#ifndef ASH_ACCESSIBILITY_UI_ACCESSIBILITY_LAYER_H_
#define ASH_ACCESSIBILITY_UI_ACCESSIBILITY_LAYER_H_
#include <memory>
#include "base/memory/raw_ptr.h"
#include "base/time/time.h"
#include "ui/compositor/layer_delegate.h"
#include "ui/gfx/geometry/rect.h"
namespace aura {
class Window;
}
namespace ui {
class Layer;
}
namespace ash {
class AccessibilityLayerDelegate {
public:
virtual void OnDeviceScaleFactorChanged() = 0;
protected:
virtual ~AccessibilityLayerDelegate() {}
};
class AccessibilityLayer : public ui::LayerDelegate {
public:
explicit AccessibilityLayer(AccessibilityLayerDelegate* delegate);
AccessibilityLayer(const AccessibilityLayer&) = delete;
AccessibilityLayer& operator=(const AccessibilityLayer&) = delete;
~AccessibilityLayer() override;
void Set(aura::Window* root_window,
const gfx::Rect& bounds,
bool stack_at_top);
void SetOpacity(float opacity);
void SetSubpixelPositionOffset(const gfx::Vector2dF& offset);
virtual int GetInset() const = 0;
ui::Layer* layer() { return layer_.get(); }
aura::Window* root_window() { return root_window_; }
protected:
void CreateOrUpdateLayer(aura::Window* root_window,
const char* layer_name,
const gfx::Rect& bounds,
bool stack_at_top);
raw_ptr<aura::Window, DanglingUntriaged> root_window_ = nullptr;
std::unique_ptr<ui::Layer> layer_;
gfx::Rect layer_rect_;
private:
void OnDeviceScaleFactorChanged(float old_device_scale_factor,
float new_device_scale_factor) override;
raw_ptr<AccessibilityLayerDelegate> delegate_;
};
}
#endif