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

Unified Diff: ui/views/bubble/bubble_frame_view.cc

Issue 2750063002: views: implement dialog width snapping (Closed)
Patch Set: width -> min_width and improve tests Created 3 years, 8 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
Index: ui/views/bubble/bubble_frame_view.cc
diff --git a/ui/views/bubble/bubble_frame_view.cc b/ui/views/bubble/bubble_frame_view.cc
index 7ba6184978fd9c1610e9d93b43daf94618ea74f4..459cb0861d049c215e2156dd33da3f684dbcac60 100644
--- a/ui/views/bubble/bubble_frame_view.cc
+++ b/ui/views/bubble/bubble_frame_view.cc
@@ -36,6 +36,7 @@
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
#include "ui/views/window/client_view.h"
+#include "ui/views/window/dialog_delegate.h"
namespace views {
@@ -530,6 +531,16 @@ gfx::Size BubbleFrameView::GetSizeForClientSize(
if (footnote_container_)
size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width()));
+ DialogDelegate* as_dialog =
Peter Kasting 2017/04/06 06:32:16 Nit: I'd name this |dialog| or |dialog_delegate|
+ GetWidget()->widget_delegate()->AsDialogDelegate();
Peter Kasting 2017/04/06 06:32:16 Nit: Move this line below the next comment since i
+
+ // Only apply width snapping to bubbles that are also dialogs, and let dialogs
+ // opt out of width snapping if they handle it themselves or are otherwise
+ // incompatible with it.
+ if (as_dialog && as_dialog->ShouldSnapFrameWidth()) {
+ size.set_width(
+ ViewsDelegate::GetInstance()->GetSnappedDialogWidth(size.width()));
+ }
return size;
}

Powered by Google App Engine
This is Rietveld 408576698