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; |
} |