OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_FOCUS_RING_LAYER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_UI_FOCUS_RING_LAYER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_UI_FOCUS_RING_LAYER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_UI_FOCUS_RING_LAYER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "ui/compositor/layer_delegate.h" | 10 #include "ui/compositor/layer_delegate.h" |
(...skipping 21 matching lines...) Expand all Loading... | |
32 // FocusRingLayer draws a focus ring at a given global rectangle. | 32 // FocusRingLayer draws a focus ring at a given global rectangle. |
33 class FocusRingLayer : public ui::LayerDelegate { | 33 class FocusRingLayer : public ui::LayerDelegate { |
34 public: | 34 public: |
35 explicit FocusRingLayer(FocusRingLayerDelegate* delegate); | 35 explicit FocusRingLayer(FocusRingLayerDelegate* delegate); |
36 virtual ~FocusRingLayer(); | 36 virtual ~FocusRingLayer(); |
37 | 37 |
38 // Move the focus ring layer to the given bounds in the coordinates of | 38 // Move the focus ring layer to the given bounds in the coordinates of |
39 // the given root window. | 39 // the given root window. |
40 void Set(aura::Window* root_window, const gfx::Rect& bounds); | 40 void Set(aura::Window* root_window, const gfx::Rect& bounds); |
41 | 41 |
42 protected: | |
43 // Updates |root_window_| and creates |layer_| if it doesn't exist, | |
44 // or if the root window has changed. Moves the layer to the top if | |
45 // it wasn't there already. | |
46 void CreateOrUpdateLayer(aura::Window* root_window, const char* layer_name); | |
47 | |
48 // The current root window containing the focused object. | |
49 aura::Window* root_window_; | |
xiyuan
2014/09/11 21:56:05
nit: Can we keep the members in private section an
dmazzoni
2014/09/11 22:14:39
Done.
| |
50 | |
51 // The current layer. | |
52 scoped_ptr<ui::Layer> layer_; | |
53 | |
42 private: | 54 private: |
43 // ui::LayerDelegate overrides: | 55 // ui::LayerDelegate overrides: |
44 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; | 56 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; |
45 virtual void OnDelegatedFrameDamage( | 57 virtual void OnDelegatedFrameDamage( |
46 const gfx::Rect& damage_rect_in_dip) OVERRIDE; | 58 const gfx::Rect& damage_rect_in_dip) OVERRIDE; |
47 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; | 59 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; |
48 virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE; | 60 virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE; |
49 | 61 |
50 // The object that owns this layer. | 62 // The object that owns this layer. |
51 FocusRingLayerDelegate* delegate_; | 63 FocusRingLayerDelegate* delegate_; |
52 | 64 |
53 // The current root window containing the focused object. | |
54 aura::Window* root_window_; | |
55 | |
56 // The bounding rectangle of the focused object, in |root_window_| | 65 // The bounding rectangle of the focused object, in |root_window_| |
57 // coordinates. | 66 // coordinates. |
58 gfx::Rect focus_ring_; | 67 gfx::Rect focus_ring_; |
59 | 68 |
60 // The current layer. | |
61 scoped_ptr<ui::Layer> layer_; | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(FocusRingLayer); | 69 DISALLOW_COPY_AND_ASSIGN(FocusRingLayer); |
64 }; | 70 }; |
65 | 71 |
66 } // namespace chromeos | 72 } // namespace chromeos |
67 | 73 |
68 #endif // CHROME_BROWSER_CHROMEOS_UI_FOCUS_RING_LAYER_H_ | 74 #endif // CHROME_BROWSER_CHROMEOS_UI_FOCUS_RING_LAYER_H_ |
OLD | NEW |