summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrfevang@chromium.org <rfevang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-15 09:20:29 +0000
committerrfevang@chromium.org <rfevang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-15 09:20:29 +0000
commit08d7b2796ca0ee39154410a76fb298e1bda23fea (patch)
tree3c4cb091d4b13696614dbf5901edc6b7c4ad9974
parentabc7d5c08b6df19f5f58f9beb339c1c36d0d0770 (diff)
downloadchromium_src-08d7b2796ca0ee39154410a76fb298e1bda23fea.zip
chromium_src-08d7b2796ca0ee39154410a76fb298e1bda23fea.tar.gz
chromium_src-08d7b2796ca0ee39154410a76fb298e1bda23fea.tar.bz2
Proper positioning of new dialog style print preview.
Removed the title bar and fixed positioning of the print preview for the new dialog style. A close button in the top right will be added in the webui later, along with other internal layout changes. Spec: https://docs.google.com/a/google.com/folder/d/0B6x6iYCtKinEUTFOWUJFTWJFSTA/edit?docId=0B6x6iYCtKinEajVGQ0R6bERQVm8 Before: http://i.imgur.com/Dinw9MB.png After: http://i.imgur.com/QXdap6W.png BUG=133363,140560 Review URL: https://chromiumcodereview.appspot.com/14803012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200219 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/printing/print_preview_dialog_controller.cc2
-rw-r--r--chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc11
-rw-r--r--ui/views/widget/widget_delegate.cc4
-rw-r--r--ui/views/widget/widget_delegate.h3
-rw-r--r--ui/views/window/dialog_delegate.cc2
5 files changed, 17 insertions, 5 deletions
diff --git a/chrome/browser/printing/print_preview_dialog_controller.cc b/chrome/browser/printing/print_preview_dialog_controller.cc
index 85b7826..17eb41c 100644
--- a/chrome/browser/printing/print_preview_dialog_controller.cc
+++ b/chrome/browser/printing/print_preview_dialog_controller.cc
@@ -156,8 +156,6 @@ void PrintPreviewDialogDelegate::OnCloseContents(WebContents* /* source */,
}
bool PrintPreviewDialogDelegate::ShouldShowDialogTitle() const {
- // Not used, returning dummy value.
- NOTREACHED();
return false;
}
diff --git a/chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc b/chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc
index c05c1d7..7d86371 100644
--- a/chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc
+++ b/chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc
@@ -17,6 +17,7 @@
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
+#include "ui/views/window/dialog_delegate.h"
#include "ui/web_dialogs/web_dialog_delegate.h"
#include "ui/web_dialogs/web_dialog_ui.h"
@@ -134,6 +135,10 @@ class ConstrainedWebDialogDelegateViewViews
widget,
GetWebContents()->GetBrowserContext());
}
+ virtual bool ShouldShowCloseButton() const OVERRIDE {
+ // No close button if the dialog doesn't want a title bar.
+ return impl_->GetWebDialogDelegate()->ShouldShowDialogTitle();
+ }
virtual ui::ModalType GetModalType() const OVERRIDE {
#if defined(USE_ASH)
@@ -149,8 +154,10 @@ class ConstrainedWebDialogDelegateViewViews
if (!GetWidget())
return;
- GetWidget()->CenterWindow(
- GetWidget()->non_client_view()->GetPreferredSize());
+ if (!views::DialogDelegate::UseNewStyle()) {
+ GetWidget()->CenterWindow(
+ GetWidget()->non_client_view()->GetPreferredSize());
+ }
views::WidgetDelegate::OnWidgetMove();
}
diff --git a/ui/views/widget/widget_delegate.cc b/ui/views/widget/widget_delegate.cc
index c095ca3..1af0254 100644
--- a/ui/views/widget/widget_delegate.cc
+++ b/ui/views/widget/widget_delegate.cc
@@ -73,6 +73,10 @@ bool WidgetDelegate::ShouldShowWindowTitle() const {
return true;
}
+bool WidgetDelegate::ShouldShowCloseButton() const {
+ return true;
+}
+
bool WidgetDelegate::ShouldHandleSystemCommands() const {
const Widget* widget = GetWidget();
if (!widget)
diff --git a/ui/views/widget/widget_delegate.h b/ui/views/widget/widget_delegate.h
index 6bf4d16..e06b697 100644
--- a/ui/views/widget/widget_delegate.h
+++ b/ui/views/widget/widget_delegate.h
@@ -71,6 +71,9 @@ class VIEWS_EXPORT WidgetDelegate {
// Returns true if the window should show a title in the title bar.
virtual bool ShouldShowWindowTitle() const;
+ // Returns true if the window should show a close button in the title bar.
+ virtual bool ShouldShowCloseButton() const;
+
// Returns true if the window should handle standard system commands, such as
// close, minimize, maximize.
virtual bool ShouldHandleSystemCommands() const;
diff --git a/ui/views/window/dialog_delegate.cc b/ui/views/window/dialog_delegate.cc
index 66f965f..f020d92 100644
--- a/ui/views/window/dialog_delegate.cc
+++ b/ui/views/window/dialog_delegate.cc
@@ -187,7 +187,7 @@ NonClientFrameView* DialogDelegate::CreateNewStyleFrameView(
if (titlebar_view)
frame->SetTitlebarExtraView(titlebar_view);
}
- frame->SetShowCloseButton(true);
+ frame->SetShowCloseButton(widget->widget_delegate()->ShouldShowCloseButton());
frame->set_can_drag(true);
if (force_opaque_border)
widget->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM);