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

Unified Diff: chrome/browser/ui/webui/media_router/media_router_dialog_controller_impl.cc

Issue 2275413002: Make the MediaRouterDialogDelegate set initial dialog size in OSX (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Jennifer's comment Created 4 years, 3 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: 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

Powered by Google App Engine
This is Rietveld 408576698