Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(492)

Unified Diff: ui/views/window/dialog_delegate.cc

Issue 11571023: Move ash/wm's DialogFrameView to ui/views/window; etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove redundant GetContentsView() OVERRIDEs; re-git-add dialog_frame_view files. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/window/dialog_delegate.cc
diff --git a/ui/views/window/dialog_delegate.cc b/ui/views/window/dialog_delegate.cc
index 9f005d82e80e6deb6a1de8329574db5ca00039de..3783cc7767c24b37232dc1f8bce848851c5bab31 100644
--- a/ui/views/window/dialog_delegate.cc
+++ b/ui/views/window/dialog_delegate.cc
@@ -4,16 +4,26 @@
#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:
+// static
+bool DialogDelegate::UseNewStyle() {
+ static const bool use_new_style = CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableNewDialogStyle);
+ return use_new_style;
+}
+
DialogDelegate* DialogDelegate::AsDialogDelegate() { return this; }
DialogDelegate::~DialogDelegate() {
@@ -45,10 +55,6 @@ bool DialogDelegate::IsDialogButtonVisible(ui::DialogButton button) const {
return true;
}
-bool DialogDelegate::UseChromeStyle() const {
- return false;
-}
-
bool DialogDelegate::AreAcceleratorsEnabled(ui::DialogButton button) {
return true;
}
@@ -94,11 +100,12 @@ View* DialogDelegate::GetInitiallyFocusedView() {
}
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 +137,8 @@ const Widget* DialogDelegateView::GetWidget() const {
return View::GetWidget();
}
+View* DialogDelegateView::GetContentsView() {
+ return this;
+}
+
} // namespace views

Powered by Google App Engine
This is Rietveld 408576698