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

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

Issue 2571613002: Convert Register Protocol Handler dialog for Harmony/Material Design (Closed)
Patch Set: More fixed nits Created 3 years, 11 months 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/views_delegate.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/window/dialog_client_view.cc
diff --git a/ui/views/window/dialog_client_view.cc b/ui/views/window/dialog_client_view.cc
index 82817517d4ee906b211c71e9a5da419330928b4c..ee88f8654e741d8370cbb236fb3f1f24aeef8efb 100644
--- a/ui/views/window/dialog_client_view.cc
+++ b/ui/views/window/dialog_client_view.cc
@@ -10,6 +10,7 @@
#include "ui/base/material_design/material_design_controller.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/views/background.h"
+#include "ui/views/border.h"
#include "ui/views/controls/button/blue_button.h"
#include "ui/views/controls/button/custom_button.h"
#include "ui/views/controls/button/label_button.h"
@@ -68,14 +69,15 @@ void LayoutButton(LabelButton* button,
DialogClientView::DialogClientView(Widget* owner, View* contents_view)
: ClientView(owner, contents_view),
- button_row_insets_(0,
- kButtonHEdgeMarginNew,
- kButtonVEdgeMarginNew,
- kButtonHEdgeMarginNew),
ok_button_(nullptr),
cancel_button_(nullptr),
extra_view_(nullptr),
delegate_allowed_close_(false) {
+ button_row_insets_ =
+ ViewsDelegate::GetInstance()
+ ? ViewsDelegate::GetInstance()->GetDialogButtonInsets()
+ : gfx::Insets(0, kButtonHEdgeMarginNew, kButtonVEdgeMarginNew,
+ kButtonHEdgeMarginNew);
// Doing this now ensures this accelerator will have lower priority than
// one set by the contents view.
AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE));
@@ -159,14 +161,21 @@ gfx::Size DialogClientView::GetPreferredSize() const {
// Initialize the size to fit the buttons and extra view row.
int extra_view_padding = 0;
if (!GetDialogDelegate()->GetExtraViewPadding(&extra_view_padding))
- extra_view_padding = kRelatedButtonHSpacing;
+ extra_view_padding = ViewsDelegate::GetInstance()
+ ? ViewsDelegate::GetInstance()
+ ->GetDialogRelatedButtonHorizontalSpacing()
+ : kRelatedButtonHSpacing;
gfx::Size size(
(ok_button_ ? ok_button_->GetPreferredSize().width() : 0) +
- (cancel_button_ ? cancel_button_->GetPreferredSize().width() : 0) +
- (cancel_button_ && ok_button_ ? kRelatedButtonHSpacing : 0) +
+ (cancel_button_ ? cancel_button_->GetPreferredSize().width() : 0) +
+ (cancel_button_ && ok_button_
+ ? (ViewsDelegate::GetInstance()
+ ? ViewsDelegate::GetInstance()
+ ->GetDialogRelatedButtonHorizontalSpacing()
+ : kRelatedButtonHSpacing) : 0) +
(ShouldShow(extra_view_) ? extra_view_->GetPreferredSize().width() : 0) +
- (ShouldShow(extra_view_) && has_dialog_buttons() ?
- extra_view_padding : 0),
+ (ShouldShow(extra_view_) && has_dialog_buttons() ? extra_view_padding
+ : 0),
0);
int buttons_height = GetButtonsAndExtraViewRowHeight();
@@ -367,10 +376,13 @@ int DialogClientView::GetButtonsAndExtraViewRowTopPadding() const {
// Some subclasses of DialogClientView, in order to do their own layout, set
// button_row_insets_ to gfx::Insets(). To avoid breaking behavior of those
// dialogs, supplying 0 for the top inset of the row falls back to
+ // ViewsDelegate::GetRelatedControlVerticalSpacing or
// kRelatedControlVerticalSpacing.
- // TODO(ellyjones): Figure out a more principled way to approach that issue.
if (!spacing)
- spacing = kRelatedControlVerticalSpacing;
+ spacing = ViewsDelegate::GetInstance()
+ ? ViewsDelegate::GetInstance()
+ ->GetDialogRelatedControlVerticalSpacing()
+ : kRelatedControlVerticalSpacing;
return spacing;
}
« no previous file with comments | « ui/views/views_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698