Updates the mic icon status based on the device's audio state (2nd)
[chromium-blink-merge.git] / chrome / browser / chromeos / ui / focus_ring_layer.h
blob46b888c40408cbfba4061b0b7ed8ad73b0b54546
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.
5 #ifndef CHROME_BROWSER_CHROMEOS_UI_FOCUS_RING_LAYER_H_
6 #define CHROME_BROWSER_CHROMEOS_UI_FOCUS_RING_LAYER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "ui/compositor/layer_delegate.h"
11 #include "ui/gfx/rect.h"
13 namespace aura {
14 class Window;
17 namespace ui {
18 class Layer;
21 namespace chromeos {
23 // A delegate interface implemented by the object that owns a FocusRingLayer.
24 class FocusRingLayerDelegate {
25 public:
26 virtual void OnDeviceScaleFactorChanged() = 0;
28 protected:
29 virtual ~FocusRingLayerDelegate();
32 // FocusRingLayer draws a focus ring at a given global rectangle.
33 class FocusRingLayer : public ui::LayerDelegate {
34 public:
35 explicit FocusRingLayer(FocusRingLayerDelegate* delegate);
36 virtual ~FocusRingLayer();
38 // Move the focus ring layer to the given bounds in the coordinates of
39 // the given root window.
40 void Set(aura::Window* root_window, const gfx::Rect& bounds);
42 ui::Layer* layer() { return layer_.get(); }
43 aura::Window* root_window() { return root_window_; }
45 protected:
46 // Updates |root_window_| and creates |layer_| if it doesn't exist,
47 // or if the root window has changed. Moves the layer to the top if
48 // it wasn't there already.
49 void CreateOrUpdateLayer(aura::Window* root_window, const char* layer_name);
51 private:
52 // ui::LayerDelegate overrides:
53 virtual void OnPaintLayer(gfx::Canvas* canvas) override;
54 virtual void OnDelegatedFrameDamage(
55 const gfx::Rect& damage_rect_in_dip) override;
56 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override;
57 virtual base::Closure PrepareForLayerBoundsChange() override;
59 // The object that owns this layer.
60 FocusRingLayerDelegate* delegate_;
62 // The current root window containing the focused object.
63 aura::Window* root_window_;
65 // The current layer.
66 scoped_ptr<ui::Layer> layer_;
68 // The bounding rectangle of the focused object, in |root_window_|
69 // coordinates.
70 gfx::Rect focus_ring_;
72 DISALLOW_COPY_AND_ASSIGN(FocusRingLayer);
75 } // namespace chromeos
77 #endif // CHROME_BROWSER_CHROMEOS_UI_FOCUS_RING_LAYER_H_