Updates the mic icon status based on the device's audio state (2nd)
[chromium-blink-merge.git] / chrome / browser / chromeos / ui / focus_ring_controller.h
blobcaffb6e0cce91ec72295c77b449879bd052e3eb0
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_CONTROLLER_H_
6 #define CHROME_BROWSER_CHROMEOS_UI_FOCUS_RING_CONTROLLER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/chromeos/ui/focus_ring_layer.h"
11 #include "ui/views/focus/focus_manager.h"
12 #include "ui/views/focus/widget_focus_manager.h"
13 #include "ui/views/widget/widget_observer.h"
15 namespace views {
16 class View;
17 class Widget;
20 namespace chromeos {
22 // FocusRingController manages the focus ring around the focused view. It
23 // follows widget focus change and update the focus ring layer when the focused
24 // view of the widget changes.
25 class FocusRingController : public FocusRingLayerDelegate,
26 public views::WidgetObserver,
27 public views::WidgetFocusChangeListener,
28 public views::FocusChangeListener {
29 public:
30 FocusRingController();
31 virtual ~FocusRingController();
33 // Turns on/off the focus ring.
34 void SetVisible(bool visible);
36 private:
37 // FocusRingLayerDelegate.
38 virtual void OnDeviceScaleFactorChanged() override;
40 // Sets the focused |widget|.
41 void SetWidget(views::Widget* widget);
43 // Updates the focus ring to the focused view of |widget_|. If |widget_| is
44 // NULL or has no focused view, removes the focus ring. Otherwise, draws it.
45 void UpdateFocusRing();
47 // views::WidgetObserver overrides:
48 virtual void OnWidgetDestroying(views::Widget* widget) override;
49 virtual void OnWidgetBoundsChanged(views::Widget* widget,
50 const gfx::Rect& new_bounds) override;
52 // views::WidgetFocusChangeListener overrides:
53 virtual void OnNativeFocusChange(gfx::NativeView focused_before,
54 gfx::NativeView focused_now) override;
56 // views::FocusChangeListener overrides:
57 virtual void OnWillChangeFocus(views::View* focused_before,
58 views::View* focused_now) override;
59 virtual void OnDidChangeFocus(views::View* focused_before,
60 views::View* focused_now) override;
62 bool visible_;
64 views::Widget* widget_;
65 scoped_ptr<FocusRingLayer> focus_ring_layer_;
67 DISALLOW_COPY_AND_ASSIGN(FocusRingController);
70 } // namespace chromeos
72 #endif // CHROME_BROWSER_CHROMEOS_UI_FOCUS_RING_CONTROLLER_H_