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

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: Reorder DialogDelegate functions; inline Get*Params into WidgetExample::ButtonPressed; etc. 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
« no previous file with comments | « ui/views/window/dialog_delegate.h ('k') | ui/views/window/dialog_frame_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6ee2e4371e33e7bd0a1b71b8d4ca837c1ceaf8f7 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
« no previous file with comments | « ui/views/window/dialog_delegate.h ('k') | ui/views/window/dialog_frame_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698