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

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

Issue 2758323002: Broke out layout metric information from ViewsDelegate to LayoutProvider (Closed)
Patch Set: Fix warning which causes one of the bots to fail Created 3 years, 8 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/extension_install_dialog_view.cc
diff --git a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
index e36d5b66f5a7d315c54bc203cbd8168555966a25..43b80934814c85b22254be8a690b5d0efe046da7 100644
--- a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
+++ b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
@@ -25,8 +25,8 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
+#include "chrome/browser/ui/views/harmony/chrome_layout_delegate.h"
#include "chrome/browser/ui/views/harmony/chrome_typography.h"
-#include "chrome/browser/ui/views/harmony/layout_delegate.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/grit/generated_resources.h"
#include "components/constrained_window/constrained_window_views.h"
@@ -86,8 +86,8 @@ constexpr int kExternalInstallLeftColumnWidth = 350;
// its parent. Therefore increase the indentation by one more unit to show that
// it is in fact a child item (with no missing bullet) and not a sibling.
int GetLeftPaddingForBulletedItems(bool parent_bulleted) {
- return LayoutDelegate::Get()->GetMetric(
- LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING) *
+ return ChromeLayoutDelegate::Get()->GetDistanceMetric(
+ ChromeDistanceMetric::RELATED_CONTROL_HORIZONTAL) *
(parent_bulleted ? 2 : 1);
}
@@ -248,7 +248,7 @@ void ExtensionInstallDialogView::InitView() {
prompt_->AppendRatingStars(AddResourceIcon, rating);
int rating_text_context, user_count_text_context;
- if (LayoutDelegate::Get()->IsHarmonyMode()) {
+ if (ChromeLayoutDelegate::Get()->IsHarmonyMode()) {
rating_text_context = CONTEXT_BODY_TEXT_LARGE;
user_count_text_context = CONTEXT_BODY_TEXT_SMALL;
} else {
@@ -269,9 +269,9 @@ void ExtensionInstallDialogView::InitView() {
layout->AddView(user_count);
}
- LayoutDelegate* layout_delegate = LayoutDelegate::Get();
- const int vertical_padding = layout_delegate->GetMetric(
- LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING);
+ ChromeLayoutDelegate* layout_delegate = ChromeLayoutDelegate::Get();
+ const int vertical_padding = layout_delegate->GetDistanceMetric(
+ ChromeDistanceMetric::RELATED_CONTROL_VERTICAL);
if (prompt_->ShouldShowPermissions()) {
layout->AddPaddingRow(0, vertical_padding);
layout->StartRow(0, column_set_id);
@@ -279,10 +279,10 @@ void ExtensionInstallDialogView::InitView() {
views::GridLayout::FILL);
}
- const int content_width =
- left_column_width +
- layout_delegate->GetMetric(LayoutDelegate::Metric::PANEL_CONTENT_MARGIN) +
- kIconSize;
+ const int content_width = left_column_width +
+ layout_delegate->GetDistanceMetric(
+ ChromeDistanceMetric::PANEL_CONTENT_MARGIN) +
+ kIconSize;
// Create the scrollable view which will contain the permissions and retained
// files/devices. It will span the full content width.
@@ -299,8 +299,8 @@ void ExtensionInstallDialogView::InitView() {
views::GridLayout::USE_PREF, content_width, content_width);
// Pad to the very right of the dialog, so the scrollbar will be on the edge.
- const int button_margin =
- layout_delegate->GetMetric(LayoutDelegate::Metric::DIALOG_BUTTON_MARGIN);
+ const int button_margin = layout_delegate->GetDistanceMetric(
+ ChromeDistanceMetric::DIALOG_BUTTON_MARGIN);
scrollable_column_set->AddPaddingColumn(0, button_margin);
layout->StartRow(0, column_set_id);
@@ -401,8 +401,8 @@ bool ExtensionInstallDialogView::AddPermissions(
if (prompt_->GetPermissionCount(perm_type) == 0)
return false;
- const int vertical_padding = LayoutDelegate::Get()->GetMetric(
- LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING);
+ const int vertical_padding = ChromeLayoutDelegate::Get()->GetDistanceMetric(
+ ChromeDistanceMetric::RELATED_CONTROL_VERTICAL);
layout->AddPaddingRow(0, vertical_padding);
layout->StartRow(0, column_set_id);
@@ -442,11 +442,11 @@ views::GridLayout* ExtensionInstallDialogView::CreateLayout(
int left_column_width,
int column_set_id) {
container_ = new views::View();
- LayoutDelegate* layout_delegate = LayoutDelegate::Get();
- const int horizontal_margin =
- layout_delegate->GetMetric(LayoutDelegate::Metric::DIALOG_BUTTON_MARGIN);
- const int bottom_margin =
- layout_delegate->GetMetric(LayoutDelegate::Metric::PANEL_CONTENT_MARGIN);
+ ChromeLayoutDelegate* layout_delegate = ChromeLayoutDelegate::Get();
+ const int horizontal_margin = layout_delegate->GetDistanceMetric(
+ ChromeDistanceMetric::DIALOG_BUTTON_MARGIN);
+ const int bottom_margin = layout_delegate->GetDistanceMetric(
+ ChromeDistanceMetric::PANEL_CONTENT_MARGIN);
// This is views::GridLayout::CreatePanel(), but without a top or right
// margin. The empty dialog title will then become the top margin, and a
@@ -466,8 +466,8 @@ views::GridLayout* ExtensionInstallDialogView::CreateLayout(
0, // no fixed width
left_column_width);
column_set->AddPaddingColumn(
- 0, layout_delegate->GetMetric(
- LayoutDelegate::Metric::UNRELATED_CONTROL_HORIZONTAL_SPACING));
+ 0, layout_delegate->GetDistanceMetric(
+ ChromeDistanceMetric::UNRELATED_CONTROL_HORIZONTAL));
column_set->AddColumn(views::GridLayout::TRAILING, views::GridLayout::LEADING,
0, // no resizing
views::GridLayout::USE_PREF,
@@ -654,8 +654,8 @@ void ExpandableContainerView::DetailsView::AddDetail(
const base::string16& detail) {
layout_->StartRowWithPadding(
0, 0, 0,
- LayoutDelegate::Get()->GetMetric(
- LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING_SMALL));
+ ChromeLayoutDelegate::Get()->GetDistanceMetric(
+ ChromeDistanceMetric::RELATED_CONTROL_VERTICAL_SMALL));
views::Label* detail_label =
new views::Label(PrepareForDisplay(detail, false));
detail_label->SetMultiLine(true);

Powered by Google App Engine
This is Rietveld 408576698