| Index: chrome/browser/chromeos/ui/focus_ring_layer.cc
|
| diff --git a/chrome/browser/chromeos/ui/focus_ring_layer.cc b/chrome/browser/chromeos/ui/focus_ring_layer.cc
|
| index 43ba8364bb2d9c459ca49ec743400f474b6b7ae0..e4eab4f2ac2b8712fadd66d52b4904298225ba5b 100644
|
| --- a/chrome/browser/chromeos/ui/focus_ring_layer.cc
|
| +++ b/chrome/browser/chromeos/ui/focus_ring_layer.cc
|
| @@ -22,19 +22,30 @@ const SkColor kShadowColor = SkColorSetRGB(77, 144, 254);
|
| FocusRingLayerDelegate::~FocusRingLayerDelegate() {}
|
|
|
| FocusRingLayer::FocusRingLayer(FocusRingLayerDelegate* delegate)
|
| - : delegate_(delegate),
|
| - root_window_(NULL) {
|
| + : root_window_(NULL),
|
| + delegate_(delegate) {
|
| }
|
|
|
| FocusRingLayer::~FocusRingLayer() {}
|
|
|
| void FocusRingLayer::Set(aura::Window* root_window, const gfx::Rect& bounds) {
|
| focus_ring_ = bounds;
|
| + CreateOrUpdateLayer(root_window, "FocusRing");
|
| +
|
| + // Update the layer bounds.
|
| + gfx::Rect layer_bounds = bounds;
|
| + int inset = -(kShadowRadius + 2);
|
| + layer_bounds.Inset(inset, inset, inset, inset);
|
| + layer_->SetBounds(layer_bounds);
|
| +}
|
| +
|
| +void FocusRingLayer::CreateOrUpdateLayer(
|
| + aura::Window* root_window, const char* layer_name) {
|
| if (!layer_ || root_window != root_window_) {
|
| root_window_ = root_window;
|
| ui::Layer* root_layer = root_window->layer();
|
| layer_.reset(new ui::Layer(ui::LAYER_TEXTURED));
|
| - layer_->set_name("FocusRing");
|
| + layer_->set_name(layer_name);
|
| layer_->set_delegate(this);
|
| layer_->SetFillsBoundsOpaquely(false);
|
| root_layer->Add(layer_.get());
|
| @@ -43,12 +54,6 @@ void FocusRingLayer::Set(aura::Window* root_window, const gfx::Rect& bounds) {
|
| // Keep moving it to the top in case new layers have been added
|
| // since we created this layer.
|
| layer_->parent()->StackAtTop(layer_.get());
|
| -
|
| - // Update the layer bounds.
|
| - gfx::Rect layer_bounds = bounds;
|
| - int inset = -(kShadowRadius + 2);
|
| - layer_bounds.Inset(inset, inset, inset, inset);
|
| - layer_->SetBounds(layer_bounds);
|
| }
|
|
|
| void FocusRingLayer::OnPaintLayer(gfx::Canvas* canvas) {
|
|
|