diff options
Diffstat (limited to 'ui/views/window/dialog_delegate.cc')
-rw-r--r-- | ui/views/window/dialog_delegate.cc | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/ui/views/window/dialog_delegate.cc b/ui/views/window/dialog_delegate.cc index 9f005d8..6ee2e43 100644 --- a/ui/views/window/dialog_delegate.cc +++ b/ui/views/window/dialog_delegate.cc @@ -4,21 +4,29 @@ #include "ui/views/window/dialog_delegate.h" +#include "base/command_line.h" #include "base/logging.h" +#include "ui/base/ui_base_switches.h" #include "ui/views/controls/button/text_button.h" #include "ui/views/widget/widget.h" #include "ui/views/window/dialog_client_view.h" +#include "ui/views/window/dialog_frame_view.h" namespace views { //////////////////////////////////////////////////////////////////////////////// // DialogDelegate: -DialogDelegate* DialogDelegate::AsDialogDelegate() { return this; } - DialogDelegate::~DialogDelegate() { } +// static +bool DialogDelegate::UseNewStyle() { + static const bool use_new_style = CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableNewDialogStyle); + return use_new_style; +} + int DialogDelegate::GetDialogButtons() const { return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; } @@ -45,10 +53,6 @@ bool DialogDelegate::IsDialogButtonVisible(ui::DialogButton button) const { return true; } -bool DialogDelegate::UseChromeStyle() const { - return false; -} - bool DialogDelegate::AreAcceleratorsEnabled(ui::DialogButton button) { return true; } @@ -93,12 +97,17 @@ View* DialogDelegate::GetInitiallyFocusedView() { return NULL; } +DialogDelegate* DialogDelegate::AsDialogDelegate() { + return this; +} + ClientView* DialogDelegate::CreateClientView(Widget* widget) { - DialogClientView::StyleParams params = UseChromeStyle() ? - DialogClientView::GetChromeStyleParams() : - DialogClientView::StyleParams(); + return new DialogClientView(widget, GetContentsView()); +} - return new DialogClientView(widget, GetContentsView(), params); +NonClientFrameView* DialogDelegate::CreateNonClientFrameView(Widget* widget) { + return UseNewStyle() ? new DialogFrameView() : + WidgetDelegate::CreateNonClientFrameView(widget); } const DialogClientView* DialogDelegate::GetDialogClientView() const { @@ -130,4 +139,8 @@ const Widget* DialogDelegateView::GetWidget() const { return View::GetWidget(); } +View* DialogDelegateView::GetContentsView() { + return this; +} + } // namespace views |