Index: chrome/browser/ui/webui/media_router/media_router_dialog_controller_impl.cc |
diff --git a/chrome/browser/ui/webui/media_router/media_router_dialog_controller_impl.cc b/chrome/browser/ui/webui/media_router/media_router_dialog_controller_impl.cc |
index ad69808749ce7dd72bfd8aedcdc801c2c8f82e9b..ae65f141d43e5d21033edda6530ba46911a82cdf 100644 |
--- a/chrome/browser/ui/webui/media_router/media_router_dialog_controller_impl.cc |
+++ b/chrome/browser/ui/webui/media_router/media_router_dialog_controller_impl.cc |
@@ -77,7 +77,21 @@ class MediaRouterDialogDelegate : public WebDialogDelegate { |
// MediaRouterUI adds its own message handlers. |
} |
- void GetDialogSize(gfx::Size* size) const override; |
+ void GetDialogSize(gfx::Size* size) const override { |
+ DCHECK(size); |
+#if defined(OS_MACOSX) |
+ // When WebDialogConstrainedWindowSheet::updateSheetPosition() calls |
+ // GetDialogSize() in OSX, we need to set |size| to be non-empty. Otherwise |
+ // the dialog may fail to show. |
+ if (size->IsEmpty()) |
+ *size = gfx::Size(kWidth, kMinHeight); |
+#endif |
+ // GetDialogSize() is called when the dialog is created or the browser |
+ // window resizes. We may want to update the maximum height of the dialog |
+ // and scale the WebUI to the new height. |size| is not set (except for in |
+ // OSX) because the dialog is auto-resizeable. |
+ controller_->UpdateMaxDialogSize(); |
+ } |
std::string GetDialogArgs() const override { |
return std::string(); |
@@ -106,14 +120,6 @@ class MediaRouterDialogDelegate : public WebDialogDelegate { |
DISALLOW_COPY_AND_ASSIGN(MediaRouterDialogDelegate); |
}; |
-void MediaRouterDialogDelegate::GetDialogSize(gfx::Size* size) const { |
- DCHECK(size); |
- // GetDialogSize() is called when the browser window resizes. We may want to |
- // update the maximum height of the dialog and scale the WebUI to the new |
- // height. |size| is not set because the dialog is auto-resizeable. |
- controller_->UpdateMaxDialogSize(); |
-} |
- |
} // namespace |
// static |