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

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

Issue 1773073002: Revert of [Media Router] Enable autoresizing for the Media Router dialog for Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ebf57fde0ae93a1014f845a4898a36f6fa8a0958..bf57e828fda7615ebbbe63da8085963e939279e9 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
@@ -41,8 +41,12 @@
using ui::WebDialogDelegate;
namespace {
+#if defined(OS_MACOSX)
+const int kFixedHeight = 350;
+#else
const int kMaxHeight = 2000;
const int kMinHeight = 80;
+#endif
const int kWidth = 340;
}
@@ -110,10 +114,15 @@
void MediaRouterDialogDelegate::GetDialogSize(gfx::Size* size) const {
DCHECK(size);
+ // TODO(apacible): Remove after autoresizing is implemented for OSX.
+#if defined(OS_MACOSX)
+ *size = gfx::Size(kWidth, kFixedHeight);
+#else
// 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();
+#endif
}
} // namespace
@@ -234,21 +243,29 @@
Profile::FromBrowserContext(initiator()->GetBrowserContext());
DCHECK(profile);
+ WebDialogDelegate* web_dialog_delegate =
+ new MediaRouterDialogDelegate(action_, weak_ptr_factory_.GetWeakPtr());
// |web_dialog_delegate|'s owner is |constrained_delegate|.
// |constrained_delegate| is owned by the parent |views::View|.
- WebDialogDelegate* web_dialog_delegate =
- new MediaRouterDialogDelegate(action_, weak_ptr_factory_.GetWeakPtr());
+ // TODO(apacible): Remove after autoresizing is implemented for OSX.
+#if defined(OS_MACOSX)
+ ConstrainedWebDialogDelegate* constrained_delegate =
+ ShowConstrainedWebDialog(profile, web_dialog_delegate, initiator());
+#else
+ // TODO(apacible): Adjust min and max sizes based on new WebUI design.
+ gfx::Size min_size = gfx::Size(kWidth, kMinHeight);
+ gfx::Size max_size = gfx::Size(kWidth, kMaxHeight);
// |ShowConstrainedWebDialogWithAutoResize()| will end up creating
// ConstrainedWebDialogDelegateViewViews containing a WebContents containing
// the MediaRouterUI, using the provided |web_dialog_delegate|. Then, the
// view is shown as a modal dialog constrained to the |initiator| WebContents.
- // The dialog will resize between the given minimum and maximum size bounds
- // based on the currently rendered contents.
+ // The dialog will resize between the |min_size| and |max_size| bounds based
+ // on the currently rendered contents.
ConstrainedWebDialogDelegate* constrained_delegate =
ShowConstrainedWebDialogWithAutoResize(
- profile, web_dialog_delegate, initiator(),
- gfx::Size(kWidth, kMinHeight), gfx::Size(kWidth, kMaxHeight));
+ profile, web_dialog_delegate, initiator(), min_size, max_size);
+#endif
WebContents* media_router_dialog = constrained_delegate->GetWebContents();
TRACE_EVENT_NESTABLE_ASYNC_INSTANT1("media_router", "UI", initiator(),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698