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/window | |
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/window')
-rw-r--r-- | ui/views/window/dialog_client_view.cc | 18 | ||||
-rw-r--r-- | ui/views/window/dialog_client_view.h | 1 | ||||
-rw-r--r-- | ui/views/window/dialog_delegate.cc | 8 |
3 files changed, 16 insertions, 11 deletions
diff --git a/ui/views/window/dialog_client_view.cc b/ui/views/window/dialog_client_view.cc index cdcc98ef..e100fd1 100644 --- a/ui/views/window/dialog_client_view.cc +++ b/ui/views/window/dialog_client_view.cc @@ -265,13 +265,6 @@ void DialogClientView::ViewHierarchyChanged( const ViewHierarchyChangedDetails& details) { ClientView::ViewHierarchyChanged(details); if (details.is_add && details.child == this) { - // The old dialog style needs an explicit background color, while the new - // dialog style simply inherits the bubble's frame view color. - const DialogDelegate* dialog = GetDialogDelegate(); - if (dialog && !dialog->UseNewStyleForThisDialog()) - set_background(views::Background::CreateSolidBackground(GetNativeTheme()-> - GetSystemColor(ui::NativeTheme::kColorId_DialogBackground))); - focus_manager_ = GetFocusManager(); if (focus_manager_) GetFocusManager()->AddFocusChangeListener(this); @@ -304,6 +297,17 @@ void DialogClientView::NativeViewHierarchyChanged() { } } +void DialogClientView::OnNativeThemeChanged(const ui::NativeTheme* theme) { + // The old dialog style needs an explicit background color, while the new + // dialog style simply inherits the bubble's frame view color. + const DialogDelegate* dialog = GetDialogDelegate(); + + if (dialog && !dialog->UseNewStyleForThisDialog()) { + set_background(views::Background::CreateSolidBackground(GetNativeTheme()-> + GetSystemColor(ui::NativeTheme::kColorId_DialogBackground))); + } +} + //////////////////////////////////////////////////////////////////////////////// // DialogClientView, ButtonListener implementation: diff --git a/ui/views/window/dialog_client_view.h b/ui/views/window/dialog_client_view.h index d780806..e6f0ca2 100644 --- a/ui/views/window/dialog_client_view.h +++ b/ui/views/window/dialog_client_view.h @@ -63,6 +63,7 @@ class VIEWS_EXPORT DialogClientView : public ClientView, virtual void ViewHierarchyChanged( const ViewHierarchyChangedDetails& details) OVERRIDE; virtual void NativeViewHierarchyChanged() OVERRIDE; + virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; // ButtonListener implementation: virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; diff --git a/ui/views/window/dialog_delegate.cc b/ui/views/window/dialog_delegate.cc index 8177be4..7af50a4 100644 --- a/ui/views/window/dialog_delegate.cc +++ b/ui/views/window/dialog_delegate.cc @@ -156,10 +156,10 @@ NonClientFrameView* DialogDelegate::CreateNonClientFrameView(Widget* widget) { // static NonClientFrameView* DialogDelegate::CreateDialogFrameView(Widget* widget) { BubbleFrameView* frame = new BubbleFrameView(gfx::Insets()); - const SkColor color = widget->GetNativeTheme()->GetSystemColor( - ui::NativeTheme::kColorId_DialogBackground); - frame->SetBubbleBorder(scoped_ptr<BubbleBorder>(new BubbleBorder( - BubbleBorder::FLOAT, BubbleBorder::SMALL_SHADOW, color))); + scoped_ptr<BubbleBorder> border(new BubbleBorder( + BubbleBorder::FLOAT, BubbleBorder::SMALL_SHADOW, SK_ColorRED)); + border->set_use_theme_background_color(true); + frame->SetBubbleBorder(border.Pass()); DialogDelegate* delegate = widget->widget_delegate()->AsDialogDelegate(); if (delegate) { View* titlebar_view = delegate->CreateTitlebarExtraView(); |