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

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

Issue 1820983002: [Reland] [Media Router] Enable autoresizing for the Media Router dialog for Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
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 bf57e828fda7615ebbbe63da8085963e939279e9..ebf57fde0ae93a1014f845a4898a36f6fa8a0958 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,12 +41,8 @@ using content::WebUIMessageHandler;
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;
}
@@ -114,15 +110,10 @@ class MediaRouterDialogDelegate : public WebDialogDelegate {
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
@@ -243,29 +234,21 @@ void MediaRouterDialogControllerImpl::CreateMediaRouterDialog() {
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|.
- // 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);
+ WebDialogDelegate* web_dialog_delegate =
+ new MediaRouterDialogDelegate(action_, weak_ptr_factory_.GetWeakPtr());
// |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 |min_size| and |max_size| bounds based
- // on the currently rendered contents.
+ // The dialog will resize between the given minimum and maximum size bounds
+ // based on the currently rendered contents.
ConstrainedWebDialogDelegate* constrained_delegate =
ShowConstrainedWebDialogWithAutoResize(
- profile, web_dialog_delegate, initiator(), min_size, max_size);
-#endif
+ profile, web_dialog_delegate, initiator(),
+ gfx::Size(kWidth, kMinHeight), gfx::Size(kWidth, kMaxHeight));
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