| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 UI_VIEWS_CONTROLS_FOCUS_RING_H_ | 5 #ifndef UI_VIEWS_CONTROLS_FOCUS_RING_H_ |
| 6 #define UI_VIEWS_CONTROLS_FOCUS_RING_H_ | 6 #define UI_VIEWS_CONTROLS_FOCUS_RING_H_ |
| 7 | 7 |
| 8 #include "base/optional.h" | 8 #include "base/optional.h" |
| 9 #include "ui/native_theme/native_theme.h" | 9 #include "ui/native_theme/native_theme.h" |
| 10 #include "ui/views/view.h" | 10 #include "ui/views/view.h" |
| 11 | 11 |
| 12 namespace views { | 12 namespace views { |
| 13 | 13 |
| 14 // FocusRing is a View that is designed to act as an indicator of focus for its | 14 // FocusRing is a View that is designed to act as an indicator of focus for its |
| 15 // parent. It is a stand-alone view that paints to a layer which extends beyond | 15 // parent. It is a stand-alone view that paints to a layer which extends beyond |
| 16 // the bounds of its parent view. | 16 // the bounds of its parent view. |
| 17 class FocusRing : public View { | 17 class FocusRing : public View { |
| 18 public: | 18 public: |
| 19 static const char kViewClassName[]; | 19 static const char kViewClassName[]; |
| 20 | 20 |
| 21 // Create a FocusRing and adds it to |parent|, or updates the one that already | 21 // Create a FocusRing and adds it to |parent|, or updates the one that already |
| 22 // exists. |override_color_id| will be used in place of the default coloration | 22 // exists. |override_color_id| will be used in place of the default coloration |
| 23 // when provided. | 23 // when provided. |
| 24 static void Install(views::View* parent, | 24 static View* Install(views::View* parent, |
| 25 ui::NativeTheme::ColorId override_color_id = | 25 ui::NativeTheme::ColorId override_color_id = |
| 26 ui::NativeTheme::kColorId_NumColors); | 26 ui::NativeTheme::kColorId_NumColors); |
| 27 | 27 |
| 28 // Removes the FocusRing from |parent|. | 28 // Removes the FocusRing from |parent|. |
| 29 static void Uninstall(views::View* parent); | 29 static void Uninstall(views::View* parent); |
| 30 | 30 |
| 31 // View: | 31 // View: |
| 32 const char* GetClassName() const override; | 32 const char* GetClassName() const override; |
| 33 bool CanProcessEventsWithinSubtree() const override; | 33 bool CanProcessEventsWithinSubtree() const override; |
| 34 void Layout() override; | 34 void Layout() override; |
| 35 void OnPaint(gfx::Canvas* canvas) override; | 35 void OnPaint(gfx::Canvas* canvas) override; |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 FocusRing(); | 38 FocusRing(); |
| 39 ~FocusRing() override; | 39 ~FocusRing() override; |
| 40 | 40 |
| 41 ui::NativeTheme::ColorId override_color_id_; | 41 ui::NativeTheme::ColorId override_color_id_; |
| 42 | 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(FocusRing); | 43 DISALLOW_COPY_AND_ASSIGN(FocusRing); |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 } // views | 46 } // views |
| 47 | 47 |
| 48 #endif // UI_VIEWS_CONTROLS_FOCUS_RING_H_ | 48 #endif // UI_VIEWS_CONTROLS_FOCUS_RING_H_ |
| OLD | NEW |