diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-09 09:39:40 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-09 09:39:40 +0000 |
commit | d7bd6563eba1a5575bb6a12d985dace47c57423f (patch) | |
tree | 5b0b2f7bddb849f651367e7794f4af585209ae38 /ui/views/bubble | |
parent | b9ff6038225f41483a19f61cc2f5290a4da7ad30 (diff) | |
download | chromium_src-d7bd6563eba1a5575bb6a12d985dace47c57423f.zip chromium_src-d7bd6563eba1a5575bb6a12d985dace47c57423f.tar.gz chromium_src-d7bd6563eba1a5575bb6a12d985dace47c57423f.tar.bz2 |
Update Views tab modal dialogs when nativetheme changes
BUG=347832
Review URL: https://codereview.chromium.org/266673013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269200 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/bubble')
-rw-r--r-- | ui/views/bubble/bubble_border.cc | 3 | ||||
-rw-r--r-- | ui/views/bubble/bubble_border.h | 8 | ||||
-rw-r--r-- | ui/views/bubble/bubble_frame_view.cc | 9 | ||||
-rw-r--r-- | ui/views/bubble/bubble_frame_view.h | 1 |
4 files changed, 20 insertions, 1 deletions
diff --git a/ui/views/bubble/bubble_border.cc b/ui/views/bubble/bubble_border.cc index aa9064e..03b422a 100644 --- a/ui/views/bubble/bubble_border.cc +++ b/ui/views/bubble/bubble_border.cc @@ -156,7 +156,8 @@ BubbleBorder::BubbleBorder(Arrow arrow, Shadow shadow, SkColor color) arrow_paint_type_(PAINT_NORMAL), alignment_(ALIGN_ARROW_TO_MID_ANCHOR), shadow_(shadow), - background_color_(color) { + background_color_(color), + use_theme_background_color_(false) { DCHECK(shadow < SHADOW_COUNT); images_ = GetBorderImages(shadow); } diff --git a/ui/views/bubble/bubble_border.h b/ui/views/bubble/bubble_border.h index 4fb961e..15f0f85 100644 --- a/ui/views/bubble/bubble_border.h +++ b/ui/views/bubble/bubble_border.h @@ -136,6 +136,13 @@ class VIEWS_EXPORT BubbleBorder : public Border { void set_background_color(SkColor color) { background_color_ = color; } SkColor background_color() const { return background_color_; } + // If true, the background color should be determined by the host's + // NativeTheme. + void set_use_theme_background_color(bool use_theme_background_color) { + use_theme_background_color_ = use_theme_background_color; + } + bool use_theme_background_color() { return use_theme_background_color_; } + // Sets a desired pixel distance between the arrow tip and the outside edge of // the neighboring border image. For example: |----offset----| // '(' represents shadow around the '{' edge: ((({ ^ }))) @@ -178,6 +185,7 @@ class VIEWS_EXPORT BubbleBorder : public Border { Shadow shadow_; internal::BorderImages* images_; SkColor background_color_; + bool use_theme_background_color_; DISALLOW_COPY_AND_ASSIGN(BubbleBorder); }; diff --git a/ui/views/bubble/bubble_frame_view.cc b/ui/views/bubble/bubble_frame_view.cc index 8bad29e..1c4d70c 100644 --- a/ui/views/bubble/bubble_frame_view.cc +++ b/ui/views/bubble/bubble_frame_view.cc @@ -12,6 +12,7 @@ #include "ui/gfx/path.h" #include "ui/gfx/screen.h" #include "ui/gfx/skia_util.h" +#include "ui/native_theme/native_theme.h" #include "ui/views/bubble/bubble_border.h" #include "ui/views/controls/button/label_button.h" #include "ui/views/widget/widget.h" @@ -223,6 +224,14 @@ void BubbleFrameView::OnThemeChanged() { UpdateWindowIcon(); } +void BubbleFrameView::OnNativeThemeChanged(const ui::NativeTheme* theme) { + if (bubble_border_ && bubble_border_->use_theme_background_color()) { + bubble_border_->set_background_color(GetNativeTheme()-> + GetSystemColor(ui::NativeTheme::kColorId_DialogBackground)); + SchedulePaint(); + } +} + void BubbleFrameView::ButtonPressed(Button* sender, const ui::Event& event) { if (sender == close_) GetWidget()->Close(); diff --git a/ui/views/bubble/bubble_frame_view.h b/ui/views/bubble/bubble_frame_view.h index b72867b..6521343 100644 --- a/ui/views/bubble/bubble_frame_view.h +++ b/ui/views/bubble/bubble_frame_view.h @@ -51,6 +51,7 @@ class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView, virtual const char* GetClassName() const OVERRIDE; virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; virtual void OnThemeChanged() OVERRIDE; + virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; // Overridden from ButtonListener: virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; |