| Index: ui/views/controls/separator.cc
|
| diff --git a/ui/views/controls/separator.cc b/ui/views/controls/separator.cc
|
| index cbc4938ea2824efc3df7644fd6ef4c6fc7b18274..5ec611832bd1aa7758a4d86702fb74c4a781b7a9 100644
|
| --- a/ui/views/controls/separator.cc
|
| +++ b/ui/views/controls/separator.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "ui/accessibility/ax_node_data.h"
|
| #include "ui/gfx/canvas.h"
|
| +#include "ui/native_theme/native_theme.h"
|
|
|
| namespace views {
|
|
|
| @@ -15,13 +16,11 @@ const char Separator::kViewClassName[] = "Separator";
|
| // The separator size in pixels.
|
| const int kSeparatorSize = 1;
|
|
|
| -// Default color of the separator.
|
| -const SkColor kDefaultColor = SkColorSetARGB(255, 233, 233, 233);
|
| -
|
| Separator::Separator(Orientation orientation)
|
| : orientation_(orientation),
|
| - color_(kDefaultColor),
|
| + color_overridden_(false),
|
| size_(kSeparatorSize) {
|
| + SetColorFromNativeTheme();
|
| }
|
|
|
| Separator::~Separator() {
|
| @@ -29,6 +28,7 @@ Separator::~Separator() {
|
|
|
| void Separator::SetColor(SkColor color) {
|
| color_ = color;
|
| + color_overridden_ = true;
|
| SchedulePaint();
|
| }
|
|
|
| @@ -39,6 +39,11 @@ void Separator::SetPreferredSize(int size) {
|
| }
|
| }
|
|
|
| +void Separator::SetColorFromNativeTheme() {
|
| + color_ = GetNativeTheme()->GetSystemColor(
|
| + ui::NativeTheme::kColorId_SeparatorColor);
|
| +}
|
| +
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // Separator, View overrides:
|
|
|
| @@ -58,6 +63,11 @@ void Separator::OnPaint(gfx::Canvas* canvas) {
|
| canvas->FillRect(GetContentsBounds(), color_);
|
| }
|
|
|
| +void Separator::OnNativeThemeChanged(const ui::NativeTheme* theme) {
|
| + if (!color_overridden_)
|
| + SetColorFromNativeTheme();
|
| +}
|
| +
|
| const char* Separator::GetClassName() const {
|
| return kViewClassName;
|
| }
|
|
|