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

Unified Diff: chrome/browser/ui/views/extensions/chooser_dialog_view.cc

Issue 2654323002: harmony: convert device chooser (Closed)
Patch Set: attempt size hack Created 3 years, 10 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/views/extensions/chooser_dialog_view.cc
diff --git a/chrome/browser/ui/views/extensions/chooser_dialog_view.cc b/chrome/browser/ui/views/extensions/chooser_dialog_view.cc
index dffa13c118584bacee809b05478cd2443aae44e4..ada0b1a6b15a41e2064e4985615c2fc3b0c03c12 100644
--- a/chrome/browser/ui/views/extensions/chooser_dialog_view.cc
+++ b/chrome/browser/ui/views/extensions/chooser_dialog_view.cc
@@ -11,13 +11,16 @@
#include "chrome/browser/extensions/chrome_extension_chooser_dialog.h"
#include "chrome/browser/extensions/device_permissions_dialog_controller.h"
#include "chrome/browser/ui/views/device_chooser_content_view.h"
+#include "chrome/browser/ui/views/harmony/layout_delegate.h"
+#include "chrome/browser/ui/views/harmony/sized_dialog_client_view.h"
#include "components/constrained_window/constrained_window_views.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/browser_thread.h"
#include "ui/gfx/geometry/insets.h"
+#include "ui/views/background.h"
#include "ui/views/controls/link.h"
#include "ui/views/controls/styled_label.h"
-#include "ui/views/layout/layout_constants.h"
+#include "ui/views/layout/fill_layout.h"
#include "ui/views/window/dialog_client_view.h"
ChooserDialogView::ChooserDialogView(
@@ -70,9 +73,20 @@ views::View* ChooserDialogView::CreateFootnoteView() {
}
views::ClientView* ChooserDialogView::CreateClientView(views::Widget* widget) {
+ const int kMinWidth = 402;
Peter Kasting 2017/02/07 00:17:15 Nit: constexpr
Elly Fong-Jones 2017/02/07 14:02:10 Done.
+ const int kMinHeight = 320;
+ int min_width = LayoutDelegate::Get()->GetDialogPreferredWidth(
+ LayoutDelegate::DialogWidth::MEDIUM);
+ if (!min_width)
+ min_width = kMinWidth;
+ gfx::Size minimum_size(min_width, kMinHeight);
views::DialogClientView* client =
- new views::DialogClientView(widget, GetContentsView());
- client->set_button_row_insets(gfx::Insets());
+ new SizedDialogClientView(widget, GetContentsView(), minimum_size);
+ LayoutDelegate* delegate = LayoutDelegate::Get();
+ client->set_button_row_insets(gfx::Insets(
+ delegate->GetMetric(
+ LayoutDelegate::Metric::UNRELATED_CONTROL_VERTICAL_SPACING),
+ 0, 0, 0));
return client;
}
@@ -81,9 +95,12 @@ views::NonClientFrameView* ChooserDialogView::CreateNonClientFrameView(
// ChooserDialogView always has a parent, so ShouldUseCustomFrame() should
// always be true.
DCHECK(ShouldUseCustomFrame());
+ LayoutDelegate* delegate = LayoutDelegate::Get();
return views::DialogDelegate::CreateDialogFrameView(
- widget, gfx::Insets(views::kPanelVertMargin, views::kPanelHorizMargin,
- views::kPanelVertMargin, views::kPanelHorizMargin));
+ widget,
+ gfx::Insets(
+ delegate->GetMetric(LayoutDelegate::Metric::PANEL_CONTENT_MARGIN),
Peter Kasting 2017/02/07 00:17:15 Nit: Factor to a temp
Elly Fong-Jones 2017/02/07 14:02:10 switched to the 1-arg form of gfx::Insets() instea
+ delegate->GetMetric(LayoutDelegate::Metric::PANEL_CONTENT_MARGIN)));
}
bool ChooserDialogView::Accept() {

Powered by Google App Engine
This is Rietveld 408576698