OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_CHROMEOS_UI_ACCESSIBILITY_FOCUS_RING_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_UI_ACCESSIBILITY_FOCUS_RING_CONTROLLER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_UI_ACCESSIBILITY_FOCUS_RING_CONTROLLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_UI_ACCESSIBILITY_FOCUS_RING_CONTROLLER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 public: | 29 public: |
30 // Get the single instance of this class. | 30 // Get the single instance of this class. |
31 static AccessibilityFocusRingController* GetInstance(); | 31 static AccessibilityFocusRingController* GetInstance(); |
32 | 32 |
33 // Draw a focus ring around the given set of rects, in global screen | 33 // Draw a focus ring around the given set of rects, in global screen |
34 // coordinates. | 34 // coordinates. |
35 void SetFocusRing(const std::vector<gfx::Rect>& rects); | 35 void SetFocusRing(const std::vector<gfx::Rect>& rects); |
36 | 36 |
37 protected: | 37 protected: |
38 AccessibilityFocusRingController(); | 38 AccessibilityFocusRingController(); |
39 virtual ~AccessibilityFocusRingController(); | 39 ~AccessibilityFocusRingController() override; |
40 | 40 |
41 // Given an unordered vector of bounding rectangles that cover everything | 41 // Given an unordered vector of bounding rectangles that cover everything |
42 // that currently has focus, populate a vector of one or more | 42 // that currently has focus, populate a vector of one or more |
43 // AccessibilityFocusRings that surround the rectangles. Adjacent or | 43 // AccessibilityFocusRings that surround the rectangles. Adjacent or |
44 // overlapping rectangles are combined first. This function is protected | 44 // overlapping rectangles are combined first. This function is protected |
45 // so it can be unit-tested. | 45 // so it can be unit-tested. |
46 void RectsToRings(const std::vector<gfx::Rect>& rects, | 46 void RectsToRings(const std::vector<gfx::Rect>& rects, |
47 std::vector<AccessibilityFocusRing>* rings) const; | 47 std::vector<AccessibilityFocusRing>* rings) const; |
48 | 48 |
49 virtual int GetMargin() const; | 49 virtual int GetMargin() const; |
50 | 50 |
51 private: | 51 private: |
52 // FocusRingLayerDelegate. | 52 // FocusRingLayerDelegate. |
53 virtual void OnDeviceScaleFactorChanged() override; | 53 void OnDeviceScaleFactorChanged() override; |
54 | 54 |
55 // CompositorAnimationObserver. | 55 // CompositorAnimationObserver. |
56 virtual void OnAnimationStep(base::TimeTicks timestamp) override; | 56 void OnAnimationStep(base::TimeTicks timestamp) override; |
57 | 57 |
58 void Update(); | 58 void Update(); |
59 | 59 |
60 AccessibilityFocusRing RingFromSortedRects( | 60 AccessibilityFocusRing RingFromSortedRects( |
61 const std::vector<gfx::Rect>& rects) const; | 61 const std::vector<gfx::Rect>& rects) const; |
62 void SplitIntoParagraphShape( | 62 void SplitIntoParagraphShape( |
63 const std::vector<gfx::Rect>& rects, | 63 const std::vector<gfx::Rect>& rects, |
64 gfx::Rect* top, | 64 gfx::Rect* top, |
65 gfx::Rect* middle, | 65 gfx::Rect* middle, |
66 gfx::Rect* bottom) const; | 66 gfx::Rect* bottom) const; |
67 bool Intersects(const gfx::Rect& r1, const gfx::Rect& r2) const; | 67 bool Intersects(const gfx::Rect& r1, const gfx::Rect& r2) const; |
68 | 68 |
69 std::vector<gfx::Rect> rects_; | 69 std::vector<gfx::Rect> rects_; |
70 std::vector<AccessibilityFocusRing> previous_rings_; | 70 std::vector<AccessibilityFocusRing> previous_rings_; |
71 std::vector<AccessibilityFocusRing> rings_; | 71 std::vector<AccessibilityFocusRing> rings_; |
72 ScopedVector<AccessibilityFocusRingLayer> layers_; | 72 ScopedVector<AccessibilityFocusRingLayer> layers_; |
73 base::TimeTicks focus_change_time_; | 73 base::TimeTicks focus_change_time_; |
74 ui::Compositor* compositor_; | 74 ui::Compositor* compositor_; |
75 | 75 |
76 friend struct DefaultSingletonTraits<AccessibilityFocusRingController>; | 76 friend struct DefaultSingletonTraits<AccessibilityFocusRingController>; |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(AccessibilityFocusRingController); | 78 DISALLOW_COPY_AND_ASSIGN(AccessibilityFocusRingController); |
79 }; | 79 }; |
80 | 80 |
81 } // namespace chromeos | 81 } // namespace chromeos |
82 | 82 |
83 #endif // CHROME_BROWSER_CHROMEOS_UI_ACCESSIBILITY_FOCUS_RING_CONTROLLER_H_ | 83 #endif // CHROME_BROWSER_CHROMEOS_UI_ACCESSIBILITY_FOCUS_RING_CONTROLLER_H_ |
OLD | NEW |