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

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

Issue 2375843003: views: add Harmony dialog width support (Closed)
Patch Set: remove GetDialogWidth Created 4 years, 2 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
« ui/views/window/dialog_delegate.h ('K') | « ui/views/window/dialog_delegate.h ('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_delegate.cc
diff --git a/ui/views/window/dialog_delegate.cc b/ui/views/window/dialog_delegate.cc
index d98274cde71a90871a5fd96875f70838ca61cb3f..badba3d61921210a0a3f81cac1d2ecfba1c3b8da 100644
--- a/ui/views/window/dialog_delegate.cc
+++ b/ui/views/window/dialog_delegate.cc
@@ -10,6 +10,7 @@
#include "build/build_config.h"
#include "ui/accessibility/ax_view_state.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/base/material_design/material_design_controller.h"
#include "ui/gfx/color_palette.h"
#include "ui/strings/grit/ui_strings.h"
#include "ui/views/bubble/bubble_border.h"
@@ -265,4 +266,13 @@ void DialogDelegateView::ViewHierarchyChanged(
NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
}
+gfx::Size DialogDelegateView::GetPreferredSize() const {
+ if (!ui::MaterialDesignController::IsSecondaryUiMaterial() ||
+ dialog_width() == DIALOG_WIDTH_UNSPECIFIED) {
+ return View::GetPreferredSize();
+ }
+ int width_px = dialog_width() * 32;
Evan Stade 2016/10/03 19:04:19 actually dp, not px. I'd suggest leaving the unit
Elly Fong-Jones 2016/10/05 13:20:31 Done.
+ return gfx::Size(width_px, GetHeightForWidth(width_px));
+}
+
} // namespace views
« ui/views/window/dialog_delegate.h ('K') | « ui/views/window/dialog_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698