Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5447)

Unified Diff: chrome/browser/chromeos/ui/focus_ring_layer.h

Issue 2038093003: Refactor accessible focus ring code so the layers are animation observers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@improve_highlights
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/ui/focus_ring_controller.cc ('k') | chrome/browser/chromeos/ui/focus_ring_layer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/ui/focus_ring_layer.h
diff --git a/chrome/browser/chromeos/ui/focus_ring_layer.h b/chrome/browser/chromeos/ui/focus_ring_layer.h
index f4e5236f52e885caa417719b2958e5fdca6b1da8..fc91d7863b1bbc69947434aa220160aeab09142b 100644
--- a/chrome/browser/chromeos/ui/focus_ring_layer.h
+++ b/chrome/browser/chromeos/ui/focus_ring_layer.h
@@ -8,6 +8,8 @@
#include <memory>
#include "base/macros.h"
+#include "base/time/time.h"
+#include "ui/compositor/compositor_animation_observer.h"
#include "ui/compositor/layer_delegate.h"
#include "ui/gfx/geometry/rect.h"
@@ -16,6 +18,7 @@ class Window;
}
namespace ui {
+class Compositor;
class Layer;
}
@@ -25,13 +28,15 @@ namespace chromeos {
class FocusRingLayerDelegate {
public:
virtual void OnDeviceScaleFactorChanged() = 0;
+ virtual void OnAnimationStep(base::TimeTicks timestamp) = 0;
protected:
virtual ~FocusRingLayerDelegate();
};
// FocusRingLayer draws a focus ring at a given global rectangle.
-class FocusRingLayer : public ui::LayerDelegate {
+class FocusRingLayer : public ui::LayerDelegate,
+ public ui::CompositorAnimationObserver {
public:
explicit FocusRingLayer(FocusRingLayerDelegate* delegate);
~FocusRingLayer() override;
@@ -40,6 +45,10 @@ class FocusRingLayer : public ui::LayerDelegate {
// the given root window.
void Set(aura::Window* root_window, const gfx::Rect& bounds);
+ // Returns true if this layer is in a composited window with an
+ // animation observer.
+ bool CanAnimate() const;
+
ui::Layer* layer() { return layer_.get(); }
aura::Window* root_window() { return root_window_; }
@@ -47,7 +56,9 @@ class FocusRingLayer : public ui::LayerDelegate {
// Updates |root_window_| and creates |layer_| if it doesn't exist,
// or if the root window has changed. Moves the layer to the top if
// it wasn't there already.
- void CreateOrUpdateLayer(aura::Window* root_window, const char* layer_name);
+ void CreateOrUpdateLayer(aura::Window* root_window,
+ const char* layer_name,
+ const gfx::Rect& bounds);
private:
// ui::LayerDelegate overrides:
@@ -56,6 +67,10 @@ class FocusRingLayer : public ui::LayerDelegate {
void OnDeviceScaleFactorChanged(float device_scale_factor) override;
base::Closure PrepareForLayerBoundsChange() override;
+ // CompositorAnimationObserver overrides:
+ void OnAnimationStep(base::TimeTicks timestamp) override;
+ void OnCompositingShuttingDown(ui::Compositor* compositor) override;
+
// The object that owns this layer.
FocusRingLayerDelegate* delegate_;
@@ -69,6 +84,9 @@ class FocusRingLayer : public ui::LayerDelegate {
// coordinates.
gfx::Rect focus_ring_;
+ // The compositor associated with this layer.
+ ui::Compositor* compositor_;
+
DISALLOW_COPY_AND_ASSIGN(FocusRingLayer);
};
« no previous file with comments | « chrome/browser/chromeos/ui/focus_ring_controller.cc ('k') | chrome/browser/chromeos/ui/focus_ring_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698