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
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_CHROMEOS_UI_FOCUS_RING_LAYER_H_
6#define CHROME_BROWSER_CHROMEOS_UI_FOCUS_RING_LAYER_H_
7
8#include "base/basictypes.h"
9#include "base/memory/scoped_ptr.h"
10#include "ui/compositor/layer_delegate.h"
11
12namespace ui {
13class Layer;
14}
15
16namespace views {
17class Painter;
18class View;
19}
20
21namespace chromeos {
22
23// FocusRingLayer draws a focus ring for a given view.
24class FocusRingLayer : public ui::LayerDelegate {
25 public:
26  FocusRingLayer();
27  virtual ~FocusRingLayer();
28
29  // Updates the focus ring layer for the view or clears it if |view| is NULL.
30  void SetForView(views::View* view);
31
32 private:
33  // ui::LayerDelegate overrides:
34  virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE;
35  virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
36  virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE;
37
38  scoped_ptr<ui::Layer> layer_;
39  scoped_ptr<views::Painter> ring_painter_;
40
41  DISALLOW_COPY_AND_ASSIGN(FocusRingLayer);
42};
43
44}  // namespace chromeos
45
46#endif  // CHROME_BROWSER_CHROMEOS_UI_FOCUS_RING_LAYER_H_
47